Forum

Arduino Mega + AdaF...
 
Notifications
Clear all

Arduino Mega + AdaFruit 4*20LCD

10 Posts
2 Users
1 Likes
4,316 Views
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

Hi,

I have an Arduino Mega hooked up by serial with an AdaFruit 4*20LCD + backpack hooked up. My script turns on the backlight, turns off the backlight.

I can't get it to sent text to the screen though. Please find script below. Hopefully I am doing something silly.

new string CC                             // declare a new string variable
CC = "0"                                      // set the variable to “backlight off” code
display "Interface1" 0 CC        // turns LCD backlight off
sleep 3000                                 // allow time for command to be sent to interface
CC = "1"                                      // set the variable to “backlight on” code
display "Interface1" 0 CC        // turns LCD backlight on
sleep 3000                                 // allow time for command to be sent to interface
CC = "2"                                     // set the variable to “clear display” code
display "Interface1" 0 CC       // clear the entire display
sleep 1000
CC = "hi Angus"
display "Interface1" 1 CC
display "Interface1" 2 CC
sleep 5000
CC = "0"                                      // set the variable to “backlight off” code
display "Interface1" 0 CC        // turns LCD backlight off
print "done"
sleep 1000
stop "LCD script"

Thanks,
Angus.


   
Quote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

Just as some extra info, the backlight on and off commands word properly. Sending text to LCD does nothing.

I just soldered up a second LCD + backpack, and exact same experience.

I also tried using the SCL1 and SDA1 terminals in case that made any difference, and strangely it suffered the same problems. I'm running 5V from the Arduino pin.

I followed https://learn.adafruit.com/i2c-spi-lcd-backpack/assemblym/i2c-spi-lcd-backpack/assembl y" target="true">these instructions to solder up the backpack + LCD

I figure I am doing something wrong... 😐
Would some photos of my LCD help?


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

The script looks correct.

Did you adjust the contrast via the potentiometer on the LCD (or backback)? Often they ship with this un-set.


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

I wound it round as far as I could, and I can now see the black blocks in the LCD.

But still no text. I'll attach some photos


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

SCL_SDA


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

backpack


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

LCD


   
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

Page 75 of the manual mentions the same special command will not be sent through to the display.

Is this something that might apply to line content as well?

I tried the below script and it is now working as expected

CC = "hi Angus"
display "Interface1" 1 CC
CC = "hi Angus"
display "Interface1" 2 CC


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

If the backlight control was working, the text should too. Glad to hear you got it worked out. 

The manual comment about duplicate messages is to reduce overhead. If the message being sent is the same as the previous, then it will not be sent as there is not much sense continually overwriting the same text.  


   
Angus reacted
ReplyQuote
(@angus_grant)
Trusted Member
Joined: 5 years ago
Posts: 52
Topic starter  

OK, makes sense.

Also got it working alright!!    😀


   
ReplyQuote
Share: