Hi guys.I bought a sanguino board recently.If I use a pin as an input pin,and if I apply a HIGH or LOW ,the kit is working perfectly. But if I leave the pin unconnected,the input in that pin alternates between HIGH and LOW and so my output toggles.Is there a way to obtain a LOW in that input pin when it is not connected and a HIGH when it is connected ?
Search for "floating pin", "pull up resistor", and "pull down resistor".
This looks like a good place to start...
For an unused input if you do a digtalWrite(PIN, HIGH) you will enable
the internal pullup of the ATmega. This will keep your floating pin from
changing state.
(* jcl *)
www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org
Thanks for your replies guys.Now its working fine. ;D