Debugging board
This commit is contained in:
parent
a16c98d7c6
commit
dca13dfe44
@ -4,6 +4,18 @@
|
||||
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
|
||||
#define TIME_TO_SLEEP 2 /* Time ESP32 will go to sleep (in seconds) */
|
||||
|
||||
#define OUTPUT_PUMP0 23 /**< GPIO 23 */
|
||||
#define OUTPUT_PUMP1 22 /**< GPIO 22 */
|
||||
#define OUTPUT_PUMP2 21 /**< GPIO 21 */
|
||||
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
|
||||
#define OUTPUT_PUMP4 18 /**< GPIO 18 */
|
||||
#define OUTPUT_PUMP5 5 /**< GPIO 5 */
|
||||
#define OUTPUT_PUMP6 15 /**< GPIO 15 */
|
||||
|
||||
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
|
||||
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
|
||||
|
||||
|
||||
RTC_DATA_ATTR int bootCount = 0;
|
||||
int secondBootCount = 0;
|
||||
|
||||
@ -22,25 +34,31 @@ void print_wakeup_reason(){
|
||||
}
|
||||
}
|
||||
|
||||
void setAll2Off() {
|
||||
digitalWrite(OUTPUT_PUMP0, LOW);
|
||||
digitalWrite(OUTPUT_PUMP1, LOW);
|
||||
digitalWrite(OUTPUT_PUMP2, LOW);
|
||||
digitalWrite(OUTPUT_PUMP3, LOW);
|
||||
digitalWrite(OUTPUT_PUMP4, LOW);
|
||||
digitalWrite(OUTPUT_PUMP5, LOW);
|
||||
digitalWrite(OUTPUT_PUMP6, LOW);
|
||||
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(GPIO_NUM_23, OUTPUT);
|
||||
pinMode(GPIO_NUM_22, OUTPUT);
|
||||
pinMode(GPIO_NUM_21, OUTPUT);
|
||||
pinMode(GPIO_NUM_19, OUTPUT);
|
||||
pinMode(GPIO_NUM_18, OUTPUT);
|
||||
pinMode(GPIO_NUM_5, OUTPUT);
|
||||
pinMode(GPIO_NUM_4, OUTPUT);
|
||||
pinMode(GPIO_NUM_15, OUTPUT);
|
||||
pinMode(GPIO_NUM_13, OUTPUT);
|
||||
digitalWrite(GPIO_NUM_23, HIGH);
|
||||
digitalWrite(GPIO_NUM_22, HIGH);
|
||||
digitalWrite(GPIO_NUM_21, HIGH);
|
||||
digitalWrite(GPIO_NUM_19, HIGH);
|
||||
digitalWrite(GPIO_NUM_18, HIGH);
|
||||
digitalWrite(GPIO_NUM_5, HIGH);
|
||||
digitalWrite(GPIO_NUM_4, HIGH);
|
||||
digitalWrite(GPIO_NUM_15, HIGH);
|
||||
digitalWrite(GPIO_NUM_13, HIGH);
|
||||
pinMode(OUTPUT_PUMP0, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP1, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP2, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP3, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP4, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP5, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP6, OUTPUT);
|
||||
pinMode(OUTPUT_SENSOR, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP, OUTPUT);
|
||||
|
||||
setAll2Off();
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
//Increment boot number and print it every reboot
|
||||
@ -77,31 +95,52 @@ void setup() {
|
||||
pinMode(GPIO_NUM_12, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
Serial.println("------------");
|
||||
Serial.flush();
|
||||
delay(1000);
|
||||
digitalWrite(GPIO_NUM_23, analogRead(GPIO_NUM_34) > 3500);
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_34));
|
||||
digitalWrite(OUTPUT_PUMP0, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_35));
|
||||
digitalWrite(OUTPUT_PUMP1, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_32));
|
||||
digitalWrite(OUTPUT_PUMP2, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_33));
|
||||
digitalWrite(OUTPUT_PUMP3, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_25));
|
||||
digitalWrite(OUTPUT_PUMP4, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_26));
|
||||
digitalWrite(OUTPUT_PUMP5, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
Serial.println(analogRead(GPIO_NUM_27));
|
||||
Serial.println(analogRead(GPIO_NUM_14));
|
||||
Serial.println(analogRead(GPIO_NUM_12));
|
||||
digitalWrite(OUTPUT_PUMP6, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
gpio_hold_en(GPIO_NUM_4);
|
||||
gpio_hold_en(GPIO_NUM_13);
|
||||
gpio_hold_en(GPIO_NUM_15);
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
digitalWrite(OUTPUT_PUMP, HIGH);
|
||||
delay(1000);
|
||||
setAll2Off();
|
||||
|
||||
delay(1000);
|
||||
delay(1000);
|
||||
gpio_deep_sleep_hold_en();
|
||||
|
||||
esp_deep_sleep_start();
|
||||
|
Loading…
Reference in New Issue
Block a user