#ifndef CARROESP32_h #define CARROESP32_h #define OUT1 36 #define OUT2 39 #define OUT3 34 #define OUT4 35 #define OUT5 32 int sensores[5] = {0, 0, 0, 0, 0}; void readSensors() { sensores[0] = analogRead(OUT1); sensores[1] = analogRead(OUT2); sensores[2] = analogRead(OUT3); sensores[3] = analogRead(OUT4); sensores[4] = analogRead(OUT5); } void printSensores() { for (int i = 0; i < 5; i++) { Serial.print(sensores[i]); Serial.print(','); } Serial.println(); } void init_sensores(){ analogSetAttenuation(ADC_0db); pinMode(OUT1, INPUT); pinMode(OUT2, INPUT); pinMode(OUT3, INPUT); pinMode(OUT4, INPUT); pinMode(OUT5, INPUT); } int readSensors(int chanel) { switch (chanel) { case 0: return analogRead(OUT1); case 1: return analogRead(OUT2); case 2: return analogRead(OUT3); case 3: return analogRead(OUT4); case 4: return analogRead(OUT5); default: return 0; } } # endif