PIN input without connection
Posted: Sat May 11, 2024 4:34 pm
I've been trying to do some basic stuff on ESP32 DevKit v1 but then run into some issues. Input pin reads values even if it's not connected to anything. It doesn't matter which pin i use (I've tried 18,15,12,27,35 and 25) it's still the same. I used this code to test it out:
Code: Select all
void setup() {
Serial.begin(115200);
pinMode(27,INPUT);
pinMode(23,OUTPUT);
pinMode(19,OUTPUT);
digitalWrite(19,HIGH);
}
void loop() {
Serial.println(digitalRead(27));
delay(100);
if (digitalRead(27)==1){
digitalWrite(23,HIGH);
}
digitalWrite(23,LOW);
}