'lcd' was not declared in this scope

Can someone help me with this sketch. Below is a list of the error messages which seems to be based on; ‘lcd’ was not declared in this scope.
Thanks

#include <lcd.h>


#include <LiquidCrystal.h>

#include<EEPROM.h>
int LED = 13; //LED to blink when DCC paclets are sent in loop
int PowerOn = 3; //pin to turn booster on /off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4;


#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27
#define BACKLIGHT_PIN    3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

#define LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin 4, D5_pin, D6_pin, D7_pin);
unsigned long time;
unsigned long now;
long cAverage = 0;
int avgTimes = 400;
int lastAverage = 0;
int resetFlag = 0;
float percentage = 0;
int temp1 = 0;
void setup() {
  delay(500);
  pinMode(LED, OUTPUT);
  pinMode(PowerOn, OUTPUT );
  lcd.begin (16,2); //LCD is 16 characters x 2 lines
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();
  Serial.begin (115200);
  lcd.setCursor(0, 0);
  lcd.print("DCC Booster");
  lcd.setCursor(0, 1);
  lcd.print("2-11-16 - v");
  lcd.print(version, 1);
  Serial.print("2-11-2016 version ");
  Serial.println(version, 1);
  delay(1000);
  lcd.clear();
  turnPowerOn();
  delay(500);
  now = millis();
}

void loop() {
  // put your main code here, to run repeatedly:
PotReading = analogueRead(Pot1);
PotReading = PotReading / 100;
lcd.setCursor(12, 0);
lcd.print(PotReading, 1);
lcd.print("  ");
lcd.setCursor(7, 0);
lcd.print("MaxA=");
showPercentage();
resetFlag++;
if (resetFlag >= 100) {
  resetFlag = 0;
}
cAverage =0;
for (int xx = 0; xx < avgTimes ; xx++) {
  CurrentPinReading = analogueRead(CurrentPin);
  if (CurrentPinReading >= 1000) {
  Serial.println("STOPPPPPPPPPPPPPPPPPPPPPPING");
  turnPowerOff();
  }
cAverage = cAverage + CurrentPinReading;
}
CurrentPinReading = cAverage / avgTimes;
if (CurrentPinReading != lastAverage) {
  if (millis() - now >= 450) {
    lcd.setCursor(0, 0);
    lcd.print("C=");
    lcd.print(CurrentPinReading);
    lcd.print("  ");
  }
  turnPowerOn();
}
lastAverage = CurrentPinReading;
}  //END LOOP
void showPercentage()
{
  percentage = (CurrentPinReading * 0.0105) / PotReading;
  percentge = percentage * 100;
  if (millis() - now >= 500)
  {
    lcd.setCursor(9, 1);
    lcd.print(percentage,1);
    lcd.print("% ");
    now = millis();
  }
  if (percentage > 100) turnPowerOff();
}
void turnPowerOff() {
  digitalWrite(PowerOn, Low);
  lcd.setCursor(0, 1);
  lcd.print("PWR OFF-2 sec");
  delay(2000);
  turnPowerOn();
  lcd.setCursor(0, 1);
  lcd.print("               ");
}
void turnPowerOn() {
  digitalWrite(PowerOn, HIGH);
  lcd.setCursor(0, 1); //This is the line that is sending back error message
  lcd.print("PWR On");
}

DCC_Booster2.ino: In function ‘void setup()’:
DCC_Booster2:45: error: ‘lcd’ was not declared in this scope
DCC_Booster2:46: error: ‘POSITIVE’ was not declared in this scope
DCC_Booster2.ino: In function ‘void loop()’:
DCC_Booster2:66: error: ‘analogueRead’ was not declared in this scope
DCC_Booster2:68: error: ‘lcd’ was not declared in this scope
DCC_Booster2.ino: In function ‘void showPercentage()’:
DCC_Booster2:102: error: ‘percentge’ was not declared in this scope
DCC_Booster2:105: error: ‘lcd’ was not declared in this scope
DCC_Booster2.ino: In function ‘void turnPowerOff()’:
DCC_Booster2:113: error: ‘Low’ was not declared in this scope
DCC_Booster2:114: error: ‘lcd’ was not declared in this scope
DCC_Booster2.ino: In function ‘void turnPowerOn()’:
DCC_Booster2:123: error: ‘lcd’ was not declared in this scope
Multiple libraries were found for “lcd.h”
Used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary902702
Not used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary
Multiple libraries were found for “LiquidCrystal.h”
Used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal
Not used: C:\Users\John\Documents\Arduino\libraries\WiShield-master
‘lcd’ was not declared in this scope

Read your log.
“Multiple libraries were found for “LiquidCrystal.h””

#include <lcd.h>


#include <LiquidCrystal.h>

#include<EEPROM.h>
int LED = 13; //LED to blink when DCC paclets are sent in loop
int PowerOn = 3; //pin to turn booster on /off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4;


#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

If you use i2c converter use only:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin 4, D5_pin, D6_pin, D7_pin);

Lose the “#define

Syntax: PotReading = analogueRead(Pot1); >> analogRead Spelling: percentge = percentage * 100; >> both should be percentage

Check for more things like that.

CrossRoads: Syntax: PotReading = analogueRead(Pot1); >> analogRead Spelling: percentge = percentage * 100; >> both should be percentage

Check for more things like that.

"analogRead"

I made changes to this sketch but still error bound.

#include <lcd.h>
#include <Wire.h>

int LED = 13; //LED to blink when DCC paclets are sent in loop
int PowerOn = 3; //pin to turn booster on /off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4;

#define I2C_ADDR    0x27
#define BACKLIGHT_PIN    3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin 4, D5_pin, D6_pin, D7_pin);
unsigned long time;
unsigned long now;
long cAverage = 0;
int avgTimes = 400;
int lastAverage = 0;
int resetFlag = 0;
float percentage = 0;
int temp1 = 0;
void setup() {
  delay(500);
  pinMode(LED, OUTPUT);
  pinMode(PowerOn, OUTPUT );
  lcd.begin (16,2); //LCD is 16 characters x 2 lines
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();
  Serial.begin (115200);
  lcd.setCursor(0, 0);
  lcd.print("DCC Booster");
  lcd.setCursor(0, 1);
  lcd.print("2-11-16 - v");
  lcd.print(version, 1);
  Serial.print("2-11-2016 version ");
  Serial.println(version, 1);
  delay(1000);
  lcd.clear();
  turnPowerOn();
  delay(500);
  now = millis();
}

void loop() {
PotReading = analogRead(Pot1);
PotReading = PotReading / 100;
lcd.setCursor(12, 0);
lcd.print(PotReading, 1);
lcd.print("  ");
lcd.setCursor(7, 0);
lcd.print("MaxA=");
showPercentage();
resetFlag++;
if (resetFlag >= 100) {
  resetFlag = 0;
}
cAverage =0;
for (int xx = 0; xx < avgTimes ; xx++) {
  CurrentPinReading = analogRead(CurrentPin);
  if (CurrentPinReading >= 1000) {
  Serial.println("STOPPPPPPPPPPPPPPPPPPPPPPING");
  turnPowerOff();
  }
cAverage = cAverage + CurrentPinReading;
}
CurrentPinReading = cAverage / avgTimes;
if (CurrentPinReading != lastAverage) {
  if (millis() - now >= 450) {
    lcd.setCursor(0, 0);
    lcd.print("C=");
    lcd.print(CurrentPinReading);
    lcd.print("  ");
  }
  turnPowerOn();
}
lastAverage = CurrentPinReading;
}  //END LOOP
void showPercentage()
{
  percentage = (CurrentPinReading * 0.0105) / PotReading;
  percentage = percentage * 100;
  if (millis() - now >= 500)
  {
    lcd.setCursor(9, 1);
    lcd.print(percentage,1);
    lcd.print("% ");
    now = millis();
  }
  if (percentage > 100) turnPowerOff();
}
void turnPowerOff() {
  digitalWrite(PowerOn, Low);
  lcd.setCursor(0, 1);
  lcd.print("PWR OFF-2 sec");
  delay(2000);
  turnPowerOn();
  lcd.setCursor(0, 1);
  lcd.print("               ");
}
void turnPowerOn() {
  digitalWrite(PowerOn, HIGH);
  lcd.setCursor(0, 1);
  lcd.print("PWR On");
}
DCC_Booster2:24: error: 'LiquidCrystal_I2C' does not name a type
DCC_Booster2.ino: In function 'void setup()':
DCC_Booster2:37: error: 'lcd' was not declared in this scope
DCC_Booster2:38: error: 'POSITIVE' was not declared in this scope
DCC_Booster2.ino: In function 'void loop()':
DCC_Booster2:59: error: 'lcd' was not declared in this scope
DCC_Booster2.ino: In function 'void showPercentage()':
DCC_Booster2:96: error: 'lcd' was not declared in this scope
DCC_Booster2.ino: In function 'void turnPowerOff()':
DCC_Booster2:104: error: 'Low' was not declared in this scope
DCC_Booster2:105: error: 'lcd' was not declared in this scope
DCC_Booster2.ino: In function 'void turnPowerOn()':
DCC_Booster2:114: error: 'lcd' was not declared in this scope
Multiple libraries were found for "lcd.h"
 Used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary902702
 Not used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary
'LiquidCrystal_I2C' does not name a type

Moderator edit: Tags corrected.

What do you have hardware wise, and what are you trying to do? It looks like you just ran around google stealing several codes and threw them together into a fustercluck. Your errors are so glaring, maybe you should start off a whole lot slower with some basics.

This is a sketch taken directly from the web pages of: http://trainelectronics.com/DCC_Booster/DCC++/, where they are using a Pro Mini to monitor Current in a Model Train Controller that is using a BTS 7960B H-Bridge. I would have thought this sketch had been tried and proven to function in the manner that it was designed but it would appear that this is not so. Since I am a beginner with the Arduino devices, I am at a loss to analyze where these errors are causing the sketch to fall over. Every little bit of help is greatly appreciated Thanks

BjohnO: This is a sketch taken directly from the web pages of: http://trainelectronics.com/DCC_Booster/DCC++/

Taken from where?

I haven't had a chance to connect any Grounds yet, I am still trying to go thru the software phase. I have been advised I should download the Library "LCDi2CW' into my libraries, but every attempt to download this file has been unsuccessful

  1. Delete
#include <lcd.h>

and include the previous LiquidCrystal library.

so that your code looks like:

#include <LiquidCrystal.h>
#include<EEPROM.h>
  1. Make sure that you use the right constructor for your I2C backpack (connected to your LCD display)

To identify this package, follow the instructions given here:
https://arduino-info.wikispaces.com/LCD-Blue-I2C

  1. If it doesn’t work after having done those modifications, you might DELETE ALL LCD related libraries and install the “NewLiquidCrystal library” of F.Malpartida (download link is in the wiki mentioned above) and try again to run a very simple sketch, just to prove the display function only (-> you might have to adjust the constructor depending on your given backpack):
#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
                                             // do nothing in 'loop'
  }

I have installed a library that was kindly supplied by the person who compiled this sketch and this has solved my original problem but now I am faced with different errors as listed below:

#include <Wire.h>

#include <LCDi2cW.h
  DCC Booster using the 43 amp H-Bridge from eBay & Amazon
*/
#include<EEPROM.h>
#include <LCD.h>
int LED = 13; // LED to blink when DCC packets are sent in loop
int PowerOn = 3; // pin to turn booster on/off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4;

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR    0x27 // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

LiquidCrystal_I2C  lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
unsigned long time;
unsigned long now;
long cAverage = 0;
int avgTimes = 400;
int lastAverage = 0;
int resetFlag = 0;
float percentage = 0;
int temp1 = 0;
void setup() {
  delay(500);
  pinMode(LED, OUTPUT);
  pinMode(PowerOn, OUTPUT );
  lcd.begin (16, 2); //  LCD is 16 characters x 2 lines
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);  // Switch on the backlight
  lcd.home (); // go home
  Serial.begin (115200);
  lcd.setCursor(0, 0);
  lcd.print("DCC Booster");
  lcd.setCursor(0, 1);
  lcd.print("2-11-16 - v");
  lcd.print(version, 1);
  Serial.print("2-11-2016  version  ");
  Serial.println(version, 1);
  delay(1000);
  lcd.clear();
  turnPowerOn();
  delay(500);
  now = millis();
}

// NOTE:  about 0.014 amps / digit of reading with 10K resistor on sense line
void loop() {
  PotReading = analogRead(Pot1);
  PotReading = PotReading / 100;
  lcd.setCursor(12, 0);
  lcd.print(PotReading, 1);
  lcd.print("   ");
  lcd.setCursor(7, 0);
  lcd.print("MaxA=");
  showPercentage();
  resetFlag++;
  if (resetFlag >= 100) {
    resetFlag = 0;
  }
  cAverage = 0;
  for (int xx = 0; xx < avgTimes ; xx++) {
    CurrentPinReading = analogRead(CurrentPin);
    if (CurrentPinReading >= 1000) {
      Serial.println("STOPPPPPPPPPPPPPPPPPPPPPPING");
      turnPowerOff();
    }
    cAverage = cAverage + CurrentPinReading;
  }
  CurrentPinReading = cAverage / avgTimes;
  if (CurrentPinReading != lastAverage) {
    if (millis() - now >= 450) {  // only update LCD every 1/2 second to limit flicker
      lcd.setCursor(0, 0);
      lcd.print("C=");
      lcd.print(CurrentPinReading);
      lcd.print("  ");
    }
    turnPowerOn();
  }
  lastAverage = CurrentPinReading; // keep for compare & print
}  //END LOOP

void showPercentage()
{
  percentage = (CurrentPinReading * 0.0105) / PotReading; // was 0.014
  percentage = percentage * 100;
  if (millis() - now >= 500)   // only update LCD every 1/2 second to limit flicker
  {
    lcd.setCursor(9, 1);
    lcd.print(percentage,1);
    lcd.print("%  ");
    now = millis();
  }
  if (percentage > 100) turnPowerOff();
}

void turnPowerOff() {
  digitalWrite(PowerOn, LOW);
  lcd.setCursor(0, 1);
  lcd.print("PWR OFF-2 sec");
  delay(2000);
  turnPowerOn();
  lcd.setCursor(0, 1);
  lcd.print("               ");
}

void turnPowerOn() {
  digitalWrite(PowerOn, HIGH);
  lcd.setCursor(0, 1);
  lcd.print("PWR On");
}



Error messages;

Build options changed, rebuilding all
DCC_Booster:3: error: missing terminating > character
DCC_Booster.ino:3:20: fatal error: LCDi2cW.h: No such file or directory
compilation terminated.
missing terminating > character

#include <LCDi2cW.h

Read the error message again, carefully.

LCDi2cW.h: No such file or directory

=> You have no such library installed (correctly).

I have been searching thru this sketch now for so long, and yet I cannot understand the errors that are returned.
[code #include <lcd.h>

#include <Wire.h>

//#include <LCDi2cW.h>
// DCC Booster using the 43 amp H-Bridge from eBay & Amazon

#include<EEPROM.h>
#include <LCD.h>
int LED = 13; // LED to blink when DCC packets are sent in loop
int PowerOn = 3; // pin to turn booster on/off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4;

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // <<----- Add your address here. Find it from I2C Scanner
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
unsigned long time;
unsigned long now;
long cAverage = 0;
int avgTimes = 400;
int lastAverage = 0;
int resetFlag = 0;
float percentage = 0;
int temp1 = 0;
void setup() {
delay(500);
pinMode(LED, OUTPUT);
pinMode(PowerOn, OUTPUT );
lcd.begin (16, 2); // LCD is 16 characters x 2 lines
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(HIGH); // Switch on the backlight
lcd.home (); // go home
Serial.begin (115200);
lcd.setCursor(0, 0);
lcd.print(“DCC Booster”);
lcd.setCursor(0, 1);
lcd.print(“2-11-16 - v”);
lcd.print(version, 1);
Serial.print("2-11-2016 version ");
Serial.println(version, 1);
delay(1000);
lcd.clear();
turnPowerOn();
delay(500);
now = millis();
}

// NOTE: about 0.014 amps / digit of reading with 10K resistor on sense line
void loop() {
PotReading = analogRead(Pot1);
PotReading = PotReading / 100;
lcd.setCursor(12, 0);
lcd.print(PotReading, 1);
lcd.print(" “);
lcd.setCursor(7, 0);
lcd.print(“MaxA=”);
showPercentage();
resetFlag++;
if (resetFlag >= 100) {
resetFlag = 0;
}
cAverage = 0;
for (int xx = 0; xx < avgTimes ; xx++) {
CurrentPinReading = analogRead(CurrentPin);
if (CurrentPinReading >= 1000) {
Serial.println(“STOPPPPPPPPPPPPPPPPPPPPPPING”);
turnPowerOff();
}
cAverage = cAverage + CurrentPinReading;
}
CurrentPinReading = cAverage / avgTimes;
if (CurrentPinReading != lastAverage) {
if (millis() - now >= 450) { // only update LCD every 1/2 second to limit flicker
lcd.setCursor(0, 0);
lcd.print(“C=”);
lcd.print(CurrentPinReading);
lcd.print(” ");
}
turnPowerOn();
}
lastAverage = CurrentPinReading; // keep for compare & print
} //END LOOP

void showPercentage()
{
percentage = (CurrentPinReading * 0.0105) / PotReading; // was 0.014
percentage = percentage * 100;
if (millis() - now >= 500) // only update LCD every 1/2 second to limit flicker
{
lcd.setCursor(9, 1);
lcd.print(percentage,1);
lcd.print("% ");
now = millis();
}
if (percentage > 100) turnPowerOff();
}

void turnPowerOff() {
digitalWrite(PowerOn, LOW);
lcd.setCursor(0, 1);
lcd.print(“PWR OFF-2 sec”);
delay(2000);
turnPowerOn();
lcd.setCursor(0, 1);
lcd.print(" ");
}

void turnPowerOn() {
digitalWrite(PowerOn, HIGH);
lcd.setCursor(0, 1);
lcd.print(“PWR On”);
}
code]

Error messages;

DCC_Booster:33: error: no matching function for call to ‘LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int)’
DCC_Booster.ino:33:88: note: candidates are:
In file included from DCC_Booster.ino:22:0:
C:\Users\John\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:3: note: LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, uint8_t)
LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);
^
C:\Users\John\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:3: note: candidate expects 3 arguments, 8 provided
C:\Users\John\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:56:7: note: LiquidCrystal_I2C::LiquidCrystal_I2C(const LiquidCrystal_I2C&)
class LiquidCrystal_I2C : public Print {
^
C:\Users\John\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:56:7: note: candidate expects 1 argument, 8 provided
DCC_Booster.ino: In function ‘void setup()’:
DCC_Booster:47: error: ‘class LiquidCrystal_I2C’ has no member named ‘setBacklightPin’
DCC_Booster:47: error: ‘POSITIVE’ was not declared in this scope
Multiple libraries were found for “lcd.h”
Used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary902702
Not used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary
no matching function for call to ‘LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int)’

An I2C device will only need an address and number of rows/columns, won’t it?
I thought the whole point of such a device was that you don’t need separate data, enable and read/write pins.

AWOL:
An I2C device will only need an address and number of rows/columns, won’t it?
I thought the whole point of such a device was that you don’t need separate data, enable and read/write pins.

If by “i2c device” you mean an actual text based i2c lcd then that would be true; however, very few people actually have and use text based i2c LCDs. The most common setup is a hd44780 LCD using a PCF8574 i/o expander chip based backpack to convert the LCD to an i2c interface. The issue becomes that the 8 pins on the i/o expander can be wired up literally any way to the 7 HD44780 pins (rs, rw, en, d4, d5, d6, d7) and backlight circuit.

The library must be configured to know how the i/o expander is wired to the hd44780 pins. Different library handle this needed differently.
Many libraries hard code it, a few allow it to be configured, hence why the constructor can be very important.
My own hd44780 library will automatically figure it out.


BJohnO,
Your sketch code is a total mess. There is no way you have downloaded what you have been showing us from anywhere. You have made modifications to the code you are showing us.
It has syntax errors, as well as incorrect library includes, like trying to include non existent files and it is even trying to reference multiple different lcd libraries in the same sketch.

My suggesting is to toss that out and start with something simple like a “hello world” example sketch that does nothing more than initialize the device and print a simple message. Nearly all libraries come with such a sketch and that you can run.
Getting this simple example sketch running first will ensure that you have the library installed correctly and that it works with your h/w.

Once that is working you can advance to doing something else.

i.e. start with something simple first then advance to something more complicated.

— bill

I have tried using preferred libraries supplied online to me from the author of this sketch and yet I still cannot get this sketch to compile. Below is the attached error message.

[code
#include <lcd.h>
#include <Wire.h>
#include <LCDi2cW.h>
// DCC Booster using the 43 amp H-Bridge from eBay & Amazon

int LED = 13; // LED to blink when DCC packets are sent in loop
int PowerOn = 3; // pin to turn booster on/off
int Pot1 = 1;
float PotReading = 0;
int CurrentPin = 0;
int CurrentPinReading = 0;
int SetPotFlag = 0;

float version = 1.4

#define I2C_ADDR 0x27 // <<----- Add your address here. Find it from I2C Scanner
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
unsigned long time;
unsigned long now;
long cAverage = 0;
int avgTimes = 400;
int lastAverage = 0;
int resetFlag = 0;
float percentage = 0;
int temp1 = 0;
void setup() {
delay(500);
pinMode(LED, OUTPUT);
pinMode(PowerOn, OUTPUT );
lcd.begin (16, 2); // LCD is 16 characters x 2 lines
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(HIGH); // Switch on the backlight
lcd.home (); // go home
Serial.begin (115200);
lcd.setCursor(0, 0);
lcd.print(“DCC Booster”);
lcd.setCursor(0, 1);
lcd.print(“2-11-16 - v”);
lcd.print(version, 1);
Serial.print("2-11-2016 version ");
Serial.println(version, 1);
delay(1000);
lcd.clear();
turnPowerOn();
delay(500);
now = millis();
}

// NOTE: about 0.014 amps / digit of reading with 10K resistor on sense line
void loop() {
PotReading = analogRead(Pot1);
PotReading = PotReading / 100;
lcd.setCursor(12, 0);
lcd.print(PotReading, 1);
lcd.print(" “);
lcd.setCursor(7, 0);
lcd.print(“MaxA=”);
showPercentage();
resetFlag++;
if (resetFlag >= 100) {
resetFlag = 0;
}
cAverage = 0;
for (int xx = 0; xx < avgTimes ; xx++) {
CurrentPinReading = analogRead(CurrentPin);
if (CurrentPinReading >= 1000) {
Serial.println(“STOPPPPPPPPPPPPPPPPPPPPPPING”);
turnPowerOff();
}
cAverage = cAverage + CurrentPinReading;
}
CurrentPinReading = cAverage / avgTimes;
if (CurrentPinReading != lastAverage) {
if (millis() - now >= 450) { // only update LCD every 1/2 second to limit flicker
lcd.setCursor(0, 0);
lcd.print(“C=”);
lcd.print(CurrentPinReading);
lcd.print(” ");
}
turnPowerOn();
}
lastAverage = CurrentPinReading; // keep for compare & print
} //END LOOP

void showPercentage()
{
percentage = (CurrentPinReading * 0.0105) / PotReading; // was 0.014
percentage = percentage * 100;
if (millis() - now >= 500) // only update LCD every 1/2 second to limit flicker
{
lcd.setCursor(9, 1);
lcd.print(percentage,1);
lcd.print("% ");
now = millis();
}
if (percentage > 100) turnPowerOff();
}

void turnPowerOff() {
digitalWrite(PowerOn, LOW);
lcd.setCursor(0, 1);
lcd.print(“PWR OFF-2 sec”);
delay(2000);
turnPowerOn();
lcd.setCursor(0, 1);
lcd.print(" ");
}

void turnPowerOn() {
digitalWrite(PowerOn, HIGH);
lcd.setCursor(0, 1);
lcd.print(“PWR On”);
}

code]

Error Message;

In file included from DCC_Booster.ino:3:0:
C:\Users\John\Documents\Arduino\libraries\LCDi2cW/LCDi2cW.h:24:15: error: conflicting return type specified for ‘virtual void LCDi2cW::write(uint8_t)’
virtual void write(uint8_t);
^
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:26,
from DCC_Booster.ino:2:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:48:20: error: overriding ‘virtual size_t Print::write(uint8_t)’
virtual size_t write(uint8_t) = 0;
^
DCC_Booster:27: error: expected ‘,’ or ‘;’ before ‘LiquidCrystal_I2C’
DCC_Booster.ino: In function ‘void setup()’:
DCC_Booster:40: error: ‘lcd’ was not declared in this scope
DCC_Booster:41: error: ‘POSITIVE’ was not declared in this scope
DCC_Booster.ino: In function ‘void loop()’:
DCC_Booster:63: error: ‘lcd’ was not declared in this scope
DCC_Booster.ino: In function ‘void showPercentage()’:
DCC_Booster:101: error: ‘lcd’ was not declared in this scope
DCC_Booster.ino: In function ‘void turnPowerOff()’:
DCC_Booster:111: error: ‘lcd’ was not declared in this scope
DCC_Booster.ino: In function ‘void turnPowerOn()’:
DCC_Booster:121: error: ‘lcd’ was not declared in this scope
Multiple libraries were found for “lcd.h”
Used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary902702
Not used: C:\Users\John\Documents\Arduino\libraries\lcdlibrary
expected ‘,’ or ‘;’ before ‘LiquidCrystal_I2C’

float version = 1.4Oops

I'll say it again in case you missed it:

bperrybap: My suggesting is to toss that out and start with something simple like a "hello world" example sketch that does nothing more than initialize the device and print a simple message. Nearly all libraries come with such a sketch and that you can run. Getting this simple example sketch running first will ensure that you have the library installed correctly and that it works with your h/w.

Once that is working you can advance to doing something else.

i.e. start with something simple first then advance to something more complicated.

--- bill