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.
You must log in or register to comment.
pull-up isn’t only for bootstraps…
Don’t get me started on hardware debounce circuits.