I'm using the analog pin (A0) to control a relay using a power supply and a battery. The reading is perfect until I remove the battery. I get noise and numbers are all over the place.
I want to know what code can I write to detect that the reading has gone berserk so I can notify myself?
Here is the reading below coming out of the serial monitor
498
410
355
969
1023
1023
897
539
438
373
980
1023
1023
719
500
411
356
986
1023
1023
792
516
422
363
967
1023
1023
712
500
409
355