I'm having problems when my arduino uno is plugged in with a 9V DC input.
When plugged with the USB cable, everything works fine.
Here is what my program is suppose to do:
(1) LCD monitor displays: RECYCLE BIN
(2) When Capacitive proximity sensor is HIGH, display: Thank You!
Cans: (no. of count)
When the arduino is powered by 9V DC:
step(1) is excecuted properly
but when sensor is HIGH, the whole LCD monitor is filled with black squares
when sensor is LOW, sometimes it goes back to what is shown in step(1), sometimes there are black squares on the first row, and sometimes nonsensical things come out.
I also noticed sometimes that the LEDs labled tx and rx lights up.
My program is as shown below:
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
const int sensorPin = 7;
int sensorProxCounter = 0;
int sensorState = 0;
int lastSensorState = 0;
lcd.print(" RECYCLE BIN");
lcd.print(" Let's Recycle");
sensorState = digitalRead(sensorPin);
if (sensorState != lastSensorState)
if (sensorState == HIGH)
sensorProxCounter = sensorProxCounter + 1;} //count increases by 1 when sensor is high
lcd.print("Thank You! ");
lcd.print(sensorProxCounter); //lcd displays number of counts
lastSensorState = sensorState;
Could there be a problem with the board? Or is it just my program? Please assist. Thanks