Using LCD Displays with Arduino
Thanks For The Replies i will try the suggestions when i next revisit the program
the suggestions the library is out of date and POSITVE is talking about the backlight makes sense
Best Regards And Thankyou
In this older sketch from 2018 I am trying to make it work for me.
Line--LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);
I keep getting error--exit status 1,
'POSITIVE' was not declared in this scope' And I don't know how to fix it.
If anyone can help I would be very grateful, since I'm new to this.
Positive is located in LiquidCrystal_i2c.h around line 162 for my h file
/* PCF8574 backlight controls */
typedef enum : uint8_t
POSITIVE = 0x01, //backlight switching polarity
NEGATIVE = 0x00 //backlight switching polarity
Sorry if this question is self-evident, but is the LiquidCrystal_i2c.h included in the library?
(◕(' 人 ') ◕)
@sean451yes it is
Check to see if POSITIVE is declared after the sketch is trying to use it?
Likewise, very new at this, but an issue is, if you call for variable before it has been set up, you will get that error.
The Arduino IDE lets you get away with setting your variables anywhere in the sketch but other IDe's won't!
None of the posts seem to me to offer a solution to my problem as to why, when I have copied the sketch and pasted it faithfully in to my Arduino IDE it will not verify. Giving the error " 'POSITIVE' was not declared in this scope "
clearly as I see it 8 elements are declared in the Define LCD pinout statement const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3; while the line (i2c_LiquidCrystal_I2C lcdaddr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE); contains 9 elements surely this is incompatible.
This issue has been discussed in another thread, but I can't seem to find it at the moment. In fact I even looked into in that thread and tested the code and provided the solution.
I found that the newer versions of the libraries used would not work, but if you went backwards through the older versions, and I don't remember what version I finally landed on, but it would finally work just fine.
Bill even commented in the tread that he possibly needed to redo that lesson. I personally hope he spends his time working on new material and leaves items like this as a "teaching" moment for users to "learn" how to "troubleshoot" their code. Mainly because you'll find this issue many time going forward.
If I find that thread I'll reply again with a link to it.
I have a little egg on my face I guess. I found the thread I was referring to, but it was actually about IR sensors and not LCD screens! But I have a sneaking suspicion that the same issue of a newer library not functioning exactly the same as the library that was used back in 2018 when the lesson was published.
If I can carve out some extra time I'll take a look at it and see if I can help you out.
Can you go to the Library Manager in your Arduino IDE and provide us with the exact library you are using and the version number? I'd like to be sure I'm using as close to exactly the same code as you are using to troubleshoot this issue.
Bill even commented in the tread that he possibly needed to redo that lesson. I personally hope he spends his time working on new material and leaves items like this as a "teaching" moment for users to "learn" how to "troubleshoot" their code. Mainly because you'll find this issue many time going forward
Thanks Steve, my thoughts exactly!
@rdacosta I moved your post into the thread about the LCD Display video, where, as you can see, this has already been discussed.
Unfortunately, libraries, especially ones from coders other than Adafruit or Sparkfun, will get updated and often "break" code relying upon older versions. This is one big advantage of using Platform IO instead of the Arduino IDE - your library version follows the project individually so you can "mix and match" versions.
In the PlatformIO article & video, I used the LiquidCrystal_PCF8574 library, which is a good choice if you are using the I2C backpack with the display.
"Never trust a computer you can’t throw out a window." — Steve Wozniak
Where do I find the version number of the library. It states it is compatible with the Arduino IDE 1.8.3 which is the version I am using and it was downloaded from https://github.com/lucasmaziero/LiquidCrystal_I2C