Forum

Arduino Mega + AdaF...
 

Arduino Mega + AdaFruit 4*20LCD  

  RSS

(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 10:12 am  

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
Topic Tags
(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 12:16 pm  

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)
Estimable Member Admin
Joined: 2 years ago
Posts: 241
March 18, 2019 12:19 pm  

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)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 12:44 pm  

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)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 12:44 pm  

SCL_SDA


ReplyQuote
(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 12:44 pm  

backpack


ReplyQuote
(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 12:44 pm  

LCD


ReplyQuote
(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 1:08 pm  

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)
Estimable Member Admin
Joined: 2 years ago
Posts: 241
March 18, 2019 2:59 pm  

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 liked
ReplyQuote
(@angus_grant)
Eminent Member
Joined: 7 months ago
Posts: 46
March 18, 2019 3:39 pm  

OK, makes sense.

Also got it working alright!!    😀


ReplyQuote
Share: