void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(17, OUTPUT);
pinMode(16, OUTPUT);
Serial.println("Hello, ESP32!");
}
void loop()
{
delay(10);
Serial.println(analogRead(34));
Serial.println(analogRead(35));
delay(1000); // this speeds up the simulation
Serial.println(analogRead(34));
Serial.println(analogRead(35));
if((analogRead(35)>2000) || (analogRead(34)>2000))
{
digitalWrite(16, HIGH);
digitalWrite(17,LOW);
delay(1000);
}
else if((analogRead(35)<2000) || (analogRead(34)<2000))
{
digitalWrite(16, LOW);
digitalWrite(17, HIGH);
delay(1000);
}
else if((analogRead(35)>2000) || (analogRead(34)<2000))
{
digitalWrite(17, HIGH);
digitalWrite(16, LOW);
delay(1000);
}
else if((analogRead(35)<2000) || (analogRead(34)>2000))
{
digitalWrite(17, LOW);
digitalWrite(16, HIGH);
delay(1000);
}
}