Issue with Arduino Uno and 16x2 lcd

Hi everyone, i'm new of this forum. I've search if other posts can help me, but i can't find one so i'm asking you help.
I'm using an Arduino Uno with a 16x2 lcd. I charged my sketch and i works good (the strings start scrolling on the display from right to left only when i push a pushbutton), but when i unlink Arduino from Mac usb and link it to the electricity adaptor the strings go on loop like there's no pushbotton and also the led it's always turned on.
Why the pushbotton doesn't work with 9V electricity and works with usb?
Thanks for help :slight_smile:

Here are the sketch

You seem to have forgotten to include your sketch* and we also could use a description of what you are trying to do.

You do not need an external LED on pin 13 since there is already one connected to pin 13 on your board. If you do decide to add an external LED then you must use a series current limiting resistor.

You may be relying on the attached picture which I took from an otherwise reputable website, arduino.cc. I am deliberately not posting the complete link because the fewer people who find that particular page the better.

Unfortunately there are provisions to add new material to the website without the corresponding provisions to remove old obsolete material. The last time that particular page was updated was in April of 2006 and there have been several versions of the Arduino released since then, all of which have a different configuration for the wiring on pin 13. The last board that I know of for which the material on that page would be appropriate is the Arduino NG.

Don

  • On this website the term 'sketch' refers to your program. I'm not sure what word should be use for a quick drawing and I hesitate to suggest the word 'code'.

DONT DO THIS-LedOnPin13.jpg

Oops, i'm sorry! I was tired and i forgot my sketch, but it's not the problem and nor os the led. The problem is: if arduino is connected with usb pc the display and all works as it have to work, but if i disconnect it from the pc and connect it with a 9V battery, the display go on loop.
Anyway here is the sketch.
Thanks

prova_2.ino (5.46 KB)

... and nor os the led.

There is a possibility that the 9v battery can't supply the excessive current that the LED is drawing.

Don

Thanks for helping. I've solved simply changing the socket… i don't know what's the difference because the switch adaptor has selectable output voltage and it's at 6,5V

You should still deal with the LED (unless you have lots of Arduino's kicking around).

Don