2022-08-08 06:47:03 +00:00
|
|
|
// manually define all the An ports on ESP32 board
|
2022-08-15 20:54:42 +00:00
|
|
|
#define A0 (36)
|
|
|
|
#define A1 (39)
|
|
|
|
#define A2 (34)
|
|
|
|
#define A3 (35)
|
|
|
|
#define A4 (32)
|
|
|
|
#define A5 (33)
|
2022-08-08 06:47:03 +00:00
|
|
|
|
2022-08-15 20:54:42 +00:00
|
|
|
// define the divident of sizeof()'s return value, to the correct length of our list
|
2022-08-08 06:47:03 +00:00
|
|
|
#define SIZE_DIV 4 // for esp32, the resolution is doubled than the usual arduino board, so we double the factor, too
|
2022-08-15 20:54:42 +00:00
|
|
|
#define WAIT_TIME 1000UL
|
|
|
|
int pins[] = { A0, A1, A2, A3, A4, A5 };
|
2022-08-08 06:47:03 +00:00
|
|
|
int i, j;
|
|
|
|
unsigned long currTime; // non-blocking time tracker
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(19200);
|
|
|
|
currTime = millis();
|
2022-08-15 20:54:42 +00:00
|
|
|
Serial.println();
|
2022-08-08 06:47:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
if (millis() - currTime >= WAIT_TIME) { // non-blocking time delay
|
|
|
|
Serial.print("[");
|
2022-08-15 20:54:42 +00:00
|
|
|
for (i = 0; i < sizeof(pins) / SIZE_DIV; i++) {
|
|
|
|
Serial.print(analogReadMilliVolts(pins[i]), DEC);
|
|
|
|
if (i != sizeof(pins) / SIZE_DIV - 1) { // fence-post the list print
|
2022-08-08 06:47:03 +00:00
|
|
|
Serial.print(", ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Serial.println("]");
|
2022-08-15 20:54:42 +00:00
|
|
|
currTime = millis();
|
2022-08-08 06:47:03 +00:00
|
|
|
}
|
|
|
|
}
|