void setup() {
pinMode(7, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.println(digitalRead(7));
digitalWrite(13, digitalRead(7));
}
This is it my code, one wire in pin 7. Touching the wire sets pin 7 to read high. Sometimes just waving my hands around is enough. And simply having my extension cord next to the arduino in a 30cm radius is enough to make it go off (with the wire plugged in). No matter which wire i put, even a short one it still does this. Plugging the arduino in a laptop does not help. Is my arduino busted or is there something bigger at play here? Could I somehow ground the arduino better? It is extremely difficult to test anything at all while this is happening.
Using a leonardo board.
EDIT: putting in a resistor does not change behavior