//bloque de declaracion de variables
const int analogInput0 =36;
const int ANI6 = 34;
const int ANI7 = 35;
const int RED = 12;
const int GRE = 14;
const int BLU = 27;
int val= 0;
float voltaje = 0;
void Leo_algo(int PUERTO){
val = analogRead(PUERTO);
voltaje = (val*5.0)/4095.0;
Serial.print("sec/div");
if (PUERTO == 36){
Serial.print("ANI0 ="); //, PUERTO, "=");
analogWrite(RED, val/4);
}
else if (PUERTO == 34){
Serial.print("ANI6 =");
analogWrite(GRE, val/4);
}
else if (PUERTO == 35){
Serial.print("ANI7 =");
analogWrite(BLU, val/4);
}
Serial.print(val);
Serial.print(" voltaje=");
Serial.println(voltaje);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(12, OUTPUT);
pinMode(BLU, OUTPUT);
pinMode(GRE, OUTPUT);
pinMode(RED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
delay(500); // this speeds up the simulation
Leo_algo(analogInput0);
Leo_algo(ANI6);
Leo_algo(ANI7);
}