i wanted to test a sensor. so i uploaded a simple analood read exaple from the ide and as i uppload the sketch to my arduino uno. the tx light is turned on all the time. and the serial monitor shows some values. even though there is no connections the tx light keep blinking its frequency is same as the outputs of serial monitor. i thought my arduino is busted. i tried it on a arduino mega. same think happened. please help me out.
Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum as a whole.
thanks
if you do analogRead on a pin that is not connected to anything, random values are not unexpected - the pin is set as input, so the arduino isn't nudging it into any defined state; it is said to be "floating" - it will pick up ambient electromagnetic noise (like an antenna*) and you'll get random values with analogRead(). Connect it to something that outputs a voltage, and you'll get reasonable values.
The same thing happens with digitalRead on a pin not connected to anything.
*an antenna at it's simplest is just a "floating" wire connected to a pin that is capable of interpreting a signal at the desired frequency, though in practice there are usually a few other passives on for impedance matching and make it more selective for the desired frequency; antenna design gets really deep and complicated)