'POSITIVE' was not declared in this scope

Hello everybody
I have a problem that doesn't let me go on with programming because it gives me a stupid problem but it really makes me angry. The "Positive" does not read me.
I can already tell you that I have installed all the possible libraries and nothing works. I tried to write the code in other ways, but nothing !!!!!
Help me please
Here is the program code for those interested:

#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int retro = 5;
int verdefisso = 8;
int verdelampe = 10;
int rossofisso = 9;
int rossolampe = 11;
int rele = 13;
#define wirebus1 12
OneWire onewire1(wirebus1);
DallasTemperature sonda1(&onewire1);
#define wirebus2 2
OneWire onewire2(wirebus2);
DallasTemperature sonda2(&onewire2);
int pulsante = 3;
int sda = A4;
int scl = A5;
float celsius1=0;
float celsius2=0;
int buz = 4;

void setup() {
Serial.begin(9600);
lcd.begin(20,4);
sonda1.begin();
sonda2.begin();
pinMode(retro, OUTPUT);
analogWrite(retro, 150); //da 0 a 255
pinMode(verdefisso, OUTPUT);
pinMode(verdelampe, OUTPUT);
pinMode(rossofisso, OUTPUT);
pinMode(rossolampe, OUTPUT);
pinMode(rele, OUTPUT);
pinMode(pulsante, INPUT);
pinMode(buz, OUTPUT);

} void loop() {
sonda1.requestTemperatures();
celsius1=sonda1.getTempCByIndex(0);
sonda2.requestTemperatures();
celsius2=sonda2.getTempCByIndex(0);
int val=digitalRead(pulsante);
if(val==1){
digitalWrite(rele, HIGH); //spento
//lcd.setCursor(3,0);
// lcd.print("Digita sul");
digitalWrite(buz, HIGH);
digitalWrite(verdefisso, HIGH);
digitalWrite(verdelampe, HIGH);
digitalWrite(rossofisso, HIGH);
digitalWrite(rossolampe, HIGH);
Serial.print("Sonda 1: ");
Serial.println(celsius1);
Serial.println("Sonda 2: ");
Serial.println(celsius2);
delay(1000);
//lcd.setCursor(1,0);
//lcd.print("Digita sul");
digitalWrite(rele, LOW);
digitalWrite(buz, LOW);
digitalWrite(verdefisso, LOW);
digitalWrite(verdelampe, LOW);
digitalWrite(rossofisso, LOW);
digitalWrite(rossolampe, LOW);
delay(1000);
}else{
digitalWrite(verdefisso, HIGH);
digitalWrite(verdelampe, HIGH);
digitalWrite(rossofisso, HIGH);
digitalWrite(rossolampe, HIGH);
}
}

Post your code using code blocks and provide the exact error message you are getting.

Where did you get that LiquidCrystal_I2C.h library? The constructor you're using looks nothing like the one I'm used to.

So where do you think that POSITIVE should have been defined and what does it mean in that context?

Steve

Where did you get that LiquidCrystal_I2C.h library?

Yes, there are several with the same name, and they all have different syntax.

I would recommend that you use the currently best available library for the i2c lcd modules which is Bill Perry's hd44780.h. It is available through the library manager. It will auto configure the i2c address and the pin configuration. There is a comprehensive diagnostic sketch as part of the library if there are any issues.

Install the library, and this sketch should work with your device

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip

void setup()
{
  // initialize LCD with number of columns and rows:
  lcd.begin(20, 4);

  // Print a message to the LCD
  lcd.print("Hello, World!");
}

void loop()
{
  lcd.setCursor(0, 1);
  lcd.print(millis() / 1000);
  delay(1000);
}
1 Like

OK thanks. Soon I'll try to do as you told me. Thanks and see you later

I installed the library you gave me and I put the sketch you shared but it doesn't work anyway. I tried on 2 different displays with i2c. How can I do?????? I've been going crazy for days. Thank you and good day

Please run the attached library diagnostic sketch and report back. It will help to read the information at the top of the sketch

I2CexpDiag.ino (33.8 KB)

When using the hd44780 library with a 20x4 I2C display, the class to use is the hd44780I2C_exp class. Did you try one of those example sketches or the diagnostic sketch?

You system might work with these lines that I use:

...
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
...

void setup()
{
  ...
  lcd.begin();
...

cattledog:
there are several with the same name

There should be an "Arduino Library Naming Authority" like with internet domains :wink:

12Stepper:
You system might work with these lines that I use:

...

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
...

void setup()
{
  ...
  lcd.begin();
...





There should be an "*Arduino Library Naming Authority*" like with internet domains ;)

I can't comuque. I had already tried. Thanks

groundFungus:
When using the hd44780 library with a 20x4 I2C display, the class to use is the hd44780I2C_exp class. Did you try one of those example sketches or the diagnostic sketch?

Nothing works. I have tried many examples but nothing !!!!!! I'm breaking my balls to do this thing. Other tips ???

Nothing works. I have tried many examples but nothing !!!!!! I'm breaking my balls to do this thing. Other tips ???

Please run the hd44780.h diagnostic sketch. Attached in reply #6, or available as a library example

File > Examples> hd44780 > ioClass> hd44780_I2Cexp class >I2CexpDiag

It will tell you what's wrong.

I agree with cattledog. Run the diagnostic and post a copy of the results from serial monitor. If none of us mere mortals can figure out what is wrong Bill Perry, the author of the library, visits the forum often and can certainly be of help.

What Arduino board are you using? Can you post a photo of the wiring of the project (Arduino board to LCD, especially). A photo showing the wiring of the LCD and the solder joints of the I2C backpack to the LCD is often very helpful.

What does "not working" mean? Does the backlight illuminate? Does any thing show on the display?

cattledog:
Please run the hd44780.h diagnostic sketch. Attached in reply #6, or available as a library example

File > Examples> hd44780 > ioClass> hd44780_I2Cexp class >I2CexpDiag

It will tell you what's wrong.

This is what I see in the Serial port


Serial Initialized

I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool

hd44780 lib version: 1.0.2

Reported Arduino Revision: 1.8.10
CPU ARCH: AVR - F_CPU: 16000000

SDA digital pin: 18 A4
SCL digital pin: 19 A5

Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted

Scanning i2c bus for devices..
i2c device found at address 0x27
Total I2C devices found: 1

Scanning i2c bus for all lcd displays
LCD at address: 0x27 | config: P01245673H | R/W control: Yes
Total LCD devices found: 1

LCD Display Memory Test
Display: 0
LCD stuck BUSY status

No working LCD devices

groundFungus:
I agree with cattledog. Run the diagnostic and post a copy of the results from serial monitor. If none of us mere mortals can figure out what is wrong Bill Perry, the author of the library, visits the forum often and can certainly be of help.

What Arduino board are you using? Can you post a photo of the wiring of the project (Arduino board to LCD, especially). A photo showing the wiring of the LCD and the solder joints of the I2C backpack to the LCD is often very helpful.

What does "not working" mean? Does the backlight illuminate? Does any thing show on the display?

I'm using an Arduino nano with the old bootloader. The backlight turns on but the text cannot be seen. If I have the chance I'll send you some pictures.

LCD Display Memory Test
Display: 0
LCD stuck BUSY status

The display is failing a test where the library is reading an internal status flag which appears on D7 of the display. It is reading HIGH when it should be LOW. I would carefully check all the solder connections around RS,RW,E and D7. If all the connections are good and not shorted to anything else, there may be an internal problem.

Please review the solder connections of the backpack to the display. Post photos if you can.

You say that multiple displays have not worked. Can you run the diagnostic test on them and see what you get? Are they separate units, or did you move the backpack around?

See this post and the following post from Bill Perry.
https://forum.arduino.cc/index.php?topic=489581.msg3351613#msg3351613

If something does not reveal itself quickly, you may want to post complete photographs and the diagnostic output in the display section of the forum where Bill will see it.

There have been cases of poor solder joints and solder bridges on the I2C expander chip causing problems. A clear close up photo of the I2C expander chip on the I2C backpack showing the quality of the solder joints would be most helpful.

I solved everything. It was a problem of welding and skipped bridges. Thanks anyway to everyone for their attention and for wasting time helping me. Thank you and good day