Pages: [1]   Go Down
Author Topic: Turning off I2C backlight  (Read 1990 times)
0 Members and 1 Guest are viewing this topic.
alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks to fm and bperrybap, I got my new LCDs working, http://arduino.cc/forum/index.php/topic,111266.0.html.
Now that bperrybap has told everyone on the net that my nibbles are flipped, does anyone know which one to flip back to shut off the backlight, or if it is even possible. I want to be able save the power when in sleep mode as I am running off (440ah) 12v batteries and might run them down,LOL. Actually, for aesthetics, the backlight is so bright it would light up the whole 5th wheel at night.
TomJ
Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, I got it, changing the keyword POSITIVE to NEGATIVE in the constructor parameters that Bperrybap gave me turned off the backlight. The only problem is when I switch back and forth from one sketch to another it sometimes needs me to press the reset button to update the sketch. How can I put that change in a sketch so I don't have to change the entire sketch to switch it off and on?
This is more of a programming question, moderators please move if needed.
Thanks
TomJ
Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2692
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually with fm's replacement library it is quite simple:
(Assuming your constructor is named "lcd")

Code:
lcd.backlight(); // turn on backlight.

lcd.noBacklight(); // turn off backlight


It is unfortunate that currently it isn't documented on the wiki and the examples on the wiki
and most of the supplied examples are not using it either.

There are also on() and off() which not only turn on/off the backlight but also turn on/off the display as well.
They essentially call display()/noDisplay() before calling backlight()/noBacklight().


Just keep in mind that if you use backlight() and noBacklight() or on()/off()
then the sketch will no longer compile or work
with original LiquidCrystal library that is supplied by the Arduino team, which probably isn't an issue for
you since they don't supply i2c support anyway.

--- bill
Logged

alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again bperrybap,
I had tried looking through any documentation I could find, and also the actual .h and .cpp files but they are pretty much greek to me. Guess it is time to seriously study C++ so I can understand more of this and quit asking simple questions.
I have replaced the old LiquidCrystal with FM's in both Arduino 1.0 and 1.0.1, I only use 2.3 when I run across old sketches that won't work with the newer versions.
TomJ
Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2692
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm curious, if you have found any sketches that don't work with fm's library?
The intent was that it was a drop in replacement and that all old sketches would "just work".

Here is a test sketch that you can try that tests the library and hardware.
(You will have to modify the LiquidCrystal_I2C constructor to match your hardware.)
Enjoy,

--- bill

* fmlibTester.pde.zip (3.75 KB - downloaded 36 times.)
Logged

Málaga, Spain
Offline Offline
Edison Member
*
Karma: 41
Posts: 2182
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do keep us posted should you come across a sketch that doesn't work. As Bill points out it is supposed to be a drop in replacement for the stock library.
Logged

   

Pages: [1]   Go Up
Jump to: