It's always a floating input.
It's always a floating input.
![](https://lemmy.ca/pictrs/image/f1639d96-08bb-40b6-b25c-2c1bfa1a6ee1.jpeg?thumbnail=1024&format=webp)
If your circuit is behaving weirdly, switching on when you touch a wire or move your hand over the circuit you almost certainly have a floating input. You can solve this problem with a pull-up resistor. Many AVRs have built-in pull-up resistors that you can turn on using code.
In Sketch:
pinMode(2, INPUT_PULLUP);
In BascomAVR:
Config Portb.1 = Input Set Portb.1
There's a great article at SparkFun about Pull-up Resistors.
0
comments