'POSITIVE' was not declared in this scope, error message for solar panel charger

Hello, I'm following an instruct-able (link below)

here is the error message I'm getting

LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address // In my case 0x27

                                                     ^

Multiple libraries were found for "LiquidCrystal_I2C.h"
 Used: C:\Users\Raptor\Documents\Arduino\libraries\LiquidCrystal_I2C
 Not used: C:\Users\Raptor\Documents\Arduino\libraries\LiquidCrystal
 Not used: C:\Users\Raptor\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
exit status 1
'POSITIVE' was not declared in this scope

Here is the the actual code

// ARDUINO SOLAR CHARGE CONTROLLER 
//Version-2.0
//by deba168,INDIA
//Dated : 22/10/2014


#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define SOL_ADC A0     // Solar panel side voltage divider is connected to pin A0 
#define BAT_ADC A1    // Battery side voltage divider is connected to pin A1
#define CURRENT_ADC A2  // ACS 712 current sensor is connected to pin A2
#define TEMP_ADC A3   // LM 35 Temperature is connected to pin A3
#define AVG_NUM 10    // number of iterations of the adc routine to average the adc readings
#define BAT_MIN 10.5  // minimum battery voltage for 12V system
#define BAT_MAX 15.0  // maximum battery voltage for 12V system
#define BULK_CH_SP 14.4 // bulk charge set point for sealed lead acid battery // flooded type set it to 14.6V
#define FLOAT_CH_SP 13.6  //float charge set point for lead acid battery
#define LVD 11.5          //Low voltage disconnect setting for a 12V system
#define PWM_PIN 3         // pin-3 is used to control the charging MOSFET //the default frequency is 490.20Hz
#define LOAD_PIN 2       // pin-2 is used to control the load
#define BAT_RED_LED 5
#define BAT_GREEN_LED 6
#define BAT_BLUE_LED 7
#define LOAD_RED_LED 8
#define LOAD_GREEN_LED 9
//--------------------------------------------------------------------------------------------------------------------------
///////////////////////DECLARATION OF ALL BIT MAP ARRAY FOR FONTS////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------------------------------

byte solar[8] = //icon for solar panel
{
  0b11111,0b10101,0b11111,0b10101,0b11111,0b10101,0b11111,0b00000
};
byte battery[8] =  //icon for battery
{
  0b01110,0b11011,0b10001,0b10001,0b10001,0b10001,0b10001,0b11111
};

byte energy[8] =  // icon for power
{
  0b00010,0b00100,0b01000,0b11111,0b00010,0b00100,0b01000,0b00000
};
/*byte alarm[8] =  // icon for alarm
{
 0b00000,0b00100,0b01110,0b01110,0b01110,0b11111,0b00000,0b00100
};*/
byte temp[8] = //icon for termometer
{
 0b00100,0b01010,0b01010,0b01110,0b01110,0b11111,0b11111,0b01110
};

byte charge[8] = // icon for battery charge
{
  0b01010,0b11111,0b10001,0b10001,0b10001,0b01110,0b00100,0b00100,
};
byte not_charge[8]=
{
  0b00000,0b10001,0b01010,0b00100,0b01010,0b10001,0b00000,0b00000,
};


//--------------------------------------------------------------------------------------------------------------------------
///////////////////////DECLARATION OF ALL GLOBAL VARIABLES//////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------------------------------
float solar_volt=0;
float bat_volt=0;
float load_current=0;
int temperature=0;
int temp_change=0;
float system_volt=0;
float bulk_charge_sp=0;
float float_charge_sp=0;
float charge_status=0;
float load_status=0;
float error=0;
float Ep=0;
int duty =0;
float lvd;
float msec=0;
float last_msec=0;
float elasped_msec=0;
float elasped_time=0;
float ampSecs = 0;
float ampHours=0;
float watts=0;
float wattSecs = 0;
float wattHours=0;

// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address // In my case 0x27
//******************************************************* MAIN PROGRAM START ************************************************
void setup()
{

Serial.begin(9600);

}

I'm using a Chinese knock-off nano (I've tested it and it works good)
any help would be great.

It appears that you have more than 1 version of the library and it is likely that the Arduino IDE has selected the wrong one.

I suggest you delete all but the correct version of the library.

...R

I've tried deleting the zip's and any other folders but it still says they're installed.

The error message lists the locations of the libraries. Have you checked all those places?

Have you restarted the Arduino IDE?

...R

thanks I found them deleted them but now get this

battry_charger_master:92: error: 'POSITIVE' was not declared in this scope

 LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address // In my case 0x27

                                                     ^

exit status 1
'POSITIVE' was not declared in this scope

Now it seems it can find the LiquidCrystal library but it the constant POSITIVE is not declared in it.

My guess is that the version of the library you have kept is the wrong version - and I don't mean any stupidity on your part, If my guess is correct finding which is the correct one was always going to be a trial and error business.

Delete the remaining library and re-install one of the others and see what happens.

...R

You're using an LCD with the I2C interface, which probably uses a different library. Unfortunately, there are a bunch of those libraries with the same name. This one works for my display, and you might want to try it.

#include <LiquidCrystal_I2C.h>

There are several libraries with the same name, and not all of them support the constructor as written. The instructable and the code are unclear as to which library is used. And the constructor might not even be for the configuration of your display.

LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

Rather than work through the library issues and what the actual constructor is for your display, I would recommend that you use the library hd44780 by Bill Perry available with the library manager. It will auto configure the display for plug and play operation.

The # includes and the constructor will look like this

#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

Here's the basic "Hello World" sketch from the library example.

// vi:ts=4
// ----------------------------------------------------------------------------
// HelloWorld - simple demonstration of lcd
// Created by Bill Perry 2016-07-02
// bperrybap@opensource.billsworld.billandterrie.com
//
// This example code is unlicensed and is released into the public domain
// ----------------------------------------------------------------------------
//
// This sketch is for LCDs with PCF8574 or MCP23008 chip based backpacks
// WARNING:
// Use caution when using 3v only processors like arm and ESP8266 processors
// when interfacing with 5v modules as not doing proper level shifting or
//  incorrectly hooking things up can damage the processor.
// 
// Sketch prints "Hello, World!" on the lcd
//
// If initialization of the LCD fails and the arduino supports a built in LED,
// the sketch will simply blink the built in LED.
//
// NOTE:
// If the sketch fails to produce the expected results, or blinks the LED,
// run the included I2CexpDiag sketch to test the i2c signals and the LCD.
//
// ----------------------------------------------------------------------------
// LiquidCrystal compability:
// Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal
// sketches should work with hd44780 hd44780_I2Cexp i/o class once the
// includes are changed to use hd44780 and the lcd object constructor is
// changed to use the hd44780_I2Cexp i/o class.

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

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;

void setup()
{
int status;

 // initialize LCD with number of columns and rows: 
 // hd44780 returns a status from begin() that can be used
 // to determine if initalization failed.
 // the actual status codes are defined in <hd44780.h>
 // See the values RV_XXXX
 //
 // looking at the return status from begin() is optional
 // it is being done here to provide feedback should there be an issue
 //
 // note:
 // begin() will automatically turn on the backlight
 //
 status = lcd.begin(LCD_COLS, LCD_ROWS);
 if(status) // non zero status means it was unsuccesful
 {
 status = -status; // convert negative status value to positive number

 // begin() failed so blink error code using the onboard LED if possible
 hd44780::fatalError(status); // does not return
 }

 // initalization was successful, the backlight should be on now

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

void loop() {}

I would recommend that you use the library hd44780 by Bill Perry available with the library manager. It will auto configure the display for plug and play operation.

I got it to work with the attached code. :slight_smile:

I'm still at the bread boarding stage and I don't have my buck-boost converter to test it (should arrive tomorrow)

Thanke you all so much :slight_smile:

BATT_EXP.ino (17 KB)