This commit is contained in:
2020-07-16 23:08:21 -05:00
parent 7604f25fca
commit de90a43021
10 changed files with 427 additions and 75 deletions

View File

@@ -1,10 +1,10 @@
#ifndef CARROESP32_h
#define CARROESP32_h
#define OUT1 A13
#define OUT2 A16
#define OUT3 A15
#define OUT4 A10
#define OUT5 A14
#define OUT1 36
#define OUT2 39
#define OUT3 34
#define OUT4 35
#define OUT5 32
int sensores[5] = {0, 0, 0, 0, 0};
@@ -15,6 +15,7 @@ void readSensors()
sensores[2] = analogRead(OUT3);
sensores[3] = analogRead(OUT4);
sensores[4] = analogRead(OUT5);
}
void printSensores()
@@ -35,8 +36,27 @@ void init_sensores(){
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;
}
}