Let's Make Robots!

Arduino LCD Display Errors :(

Hi there i try to make an alarm with arduino and i have an lcd on it but my lcd have some strange marks and are not in the code

 

Can anyone help me please?

AttachmentSize
Error.jpg87.59 KB
Nc_Code.txt1.43 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Just a couple suggestions to help you figure it out and make the code a little easier to debug for everyone.

1 - what is the floating number for?  Probably wrap that in a constant so that the code is a bit more readable (will help us debug it).

2 - the line that says a=(analogRead(analogPin)/42.656).  You've already read the pin and stored the value in val.  Why not use val here instead of reading the pin twice.

3 - what does it display if you set a to a set number (like 4,8, 24, etc.)  Does it display correctly?  If not, then it's something with the LCD setup, if it does, then it might be the weird math issue mentioned above.

DigitalPin3 = 3;

AnalogPin3 = A3;

You are trying to use the same pin for both unless you put an "A" in front of the analog pin as above.

Analog and LCD both seem to use pin 3. Also your mixing datatypes for "a". You have a as an int, which is a 2 byte datatype. The screen expects a single byte per character. You then try dividing a with a float at some point, int and floats shouldn't happily divide without giving "weird" results although I may be mistaken as I have only recently taken up arduino coming from c# and python

No Lcd use Digital pin 3 and 

divider the analog pin 3

That explains the pin numbers then. Consider the rest of what I said though