Continual Wire/Wire.H Error Ardunio/Genuino UNO

Hello all,

First, totally new to this, and I am having an issue. Here is what I have Arduino/Genuino UNO, Digital Can-Bus Shield, D1 Robot LCD KeyPad Shield (6 button). At this point why I had assembled these units doesn't matter, because I have now moved on to just trying to get the LCD to work or any of it for that matter. Here is the code that I was currently trying to run

//Sample using LiquidCrystal library
#include <LiquidCrystal.h>

/*******************************************************

This program will test the LCD panel and the buttons
Mark Bramwell, July 2010

********************************************************/

// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

// read the buttons
int read_LCD_buttons()
{
 adc_key_in = analogRead(0);      // read the value from the sensor 
 // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
 // we add approx 50 to those values and check to see if we are close
 if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
 // For V1.1 us this threshold
 if (adc_key_in < 50)   return btnRIGHT;  
 if (adc_key_in < 250)  return btnUP; 
 if (adc_key_in < 450)  return btnDOWN; 
 if (adc_key_in < 650)  return btnLEFT; 
 if (adc_key_in < 850)  return btnSELECT;  

 // For V1.0 comment the other threshold and use the one below:
/*
 if (adc_key_in < 50)   return btnRIGHT;  
 if (adc_key_in < 195)  return btnUP; 
 if (adc_key_in < 380)  return btnDOWN; 
 if (adc_key_in < 555)  return btnLEFT; 
 if (adc_key_in < 790)  return btnSELECT;   
*/


 return btnNONE;  // when all others fail, return this...
}

void setup()
{
 lcd.begin(16, 2);              // start the library
 lcd.setCursor(0,0);
 lcd.print("Push the buttons"); // print a simple message
}
 
void loop()
{
 lcd.setCursor(9,1);            // move cursor to second line "1" and 9 spaces over
 lcd.print(millis()/1000);      // display seconds elapsed since power-up


 lcd.setCursor(0,1);            // move to the begining of the second line
 lcd_key = read_LCD_buttons();  // read the buttons

 switch (lcd_key)               // depending on which button was pushed, we perform an action
 {
   case btnRIGHT:
     {
     lcd.print("RIGHT ");
     break;
     }
   case btnLEFT:
     {
     lcd.print("LEFT   ");
     break;
     }
   case btnUP:
     {
     lcd.print("UP    ");
     break;
     }
   case btnDOWN:
     {
     lcd.print("DOWN  ");
     break;
     }
   case btnSELECT:
     {
     lcd.print("SELECT");
     break;
     }
     case btnNONE:
     {
     lcd.print("NONE  ");
     break;
     }
 }

}

And here is the error that I am getting (I get this Wire/Wire.h code with almost everything I try to download:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\I2CIO.cpp:35:26: fatal error: ../Wire/Wire.h: No such file or directory

 #include <../Wire/Wire.h>

                          ^

compilation terminated.

Multiple libraries were found for "LiquidCrystal.h"
 Used: C:\Users\user\Documents\Arduino\libraries\LiquidCrystal
 Not used: C:\Users\user\Documents\Arduino\libraries\LiquidCrystal.DonotUse.ignoreWarning
 Not used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Eventually I would like to run the following code, as it was the reason for starting this project:

#include <SPI.h>
#include <can.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Defines for setting up the CAN Bus
#define mode NORMAL // define CAN mode
#define bitrate 250 // define CAN speed (bitrate)
MCP CAN1 (10); //Create CAN Channel
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

unsigned int last_vane_position = 40;
unsigned int DesiredPosition;
unsigned int vane_position;
int VanePos = 0;

void setup() {
// Initialize Serial communications with computer to use serial monitor
Serial.begin(115200);
lcd.begin(20, 4); // initialize the lcd for 20 chars 4 lines and turn on backlight
// Set CAN mode and speed
CAN1.begin(NORMAL, bitrate);

lcd.setCursor(0, 0);
lcd.print("CM^2 = ");
}

void loop(){

if(DesiredPosition > 800){
DesiredPosition = 100;
}
else{ DesiredPosition += 1;}
// Set the Turbo Position
SendTurboPosition( DesiredPosition );

// Delay for Processor
delay(5);


VanePos = constrain(map(DesiredPosition,40,960,3,25), 3, 25);
String TurboPos = String(String(VanePos, DEC) + " ");
lcd.setCursor(6, 0);
lcd.print(TurboPos);
}
void SendTurboPosition( int TurboPosition )
{
last_vane_position = DesiredPosition;
int FinalPosition = map( TurboPosition, 0, 1023, 960, 40 );
byte lobyte = lowByte(FinalPosition);
byte hibyte = highByte(FinalPosition);
unsigned long ID = 0x0CFFC600; // Random Extended Message ID
byte length = 8; // Data length
byte data[] = { lobyte, hibyte, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; // data message with an added counter

CAN1.send ( ID, extID, length, data ); // Load message and send

}

Any guidance or help would greatly be appreciated. Thanks to anyone in advance!! Gerry D

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\I2CIO.cppRelates to a library installed by the user rather than the one installed with the IDE and from its name I would infer that it is to do with an LCD that uses an I2C interface which yours presumably doesn't.

Try deleting or moving the LiquidCrystal folder referred to in the error message.

You need to be sure to use a LiquidCrystal library that works with the LCD on your D1 Robot LCD KeyPad Shield.

If you do need to use that garbage LiquidCrystal library you currently have installed then you can solve the problem by:

Open C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\I2CIO.cpp in a text editor
Change line 35 from:

#include <../Wire/Wire.h>

to:

#include <Wire.h>

Save the file

This is my arrangement for a working set of : UNO-I2C 16x2 LCD

#include<Wire.h>      //automatically installed by IDE 
#include <LiquidCrystal_I2C.h>     //installed by Add .ZIP option of IDE; downloadable from link given below
LiquidCrystal lcd(0x27, 16, 2);      //deviceAddress is 0b0100111; 2-line 16-characters

void setup()
{
   lcd.init();                         //must be 
   lcd.backlight();                //must be
   lcd.setCursoe (1, 0);       //Cursor position: DP1 (display position 1) Top Line
   lcd.print("OK!");             //OK! should appear on LCD
} 

void loop()
{

}

BTW: In case the message OK! is not seen on the LCD, adjust the contrast pot of the IO Extender Board which is attached with at the back of LCD.

download LiquidCrystal_I2C.h (there are many versions of .h files; not all versions work!)

First of all, thank you all for the super fast replies.

UKHeliBob:
Try deleting or moving the LiquidCrystal folder referred to in the error message.

UKHeliBob, the code that I am going to be using this for does call out for I2C, so I really need to get the unit to work with that at all possible. I did install a new library and was able to get past the error, but have not gotten the LCD to work even without the error. I am currently just trying to get the LCD to run the simple "OK" code below....so far it is not working however.

pert:
You need to be sure to use a LiquidCrystal library that works with the LCD on your D1 Robot LCD KeyPad Shield.

If you do need to use that garbage LiquidCrystal library you currently have installed then you can solve the problem by:

Open C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\I2CIO.cpp in a text editor
Change line 35 from:
#include <../Wire/Wire.h>
to:
#include <Wire.h>
Save the file

Pert, I totally understand the statement "garbage LiquidCrystal library", that was my futile attempt at solving this on my own, again I am very new to this. As stated above, I removed both of the libraries I had loaded and installed the one listed in the reply below from GolamMostafa. I am now just concentrating on getting the LCD to work with the basic "OK" code below....Also, just to get familiar with this I did figure out how to change line 35 as you described, so although I will not be using the same library I was able to change that code....

GolamMostafa:
This is my arrangement for a working set of : UNO-I2C 16x2 LCD

#include<Wire.h>      //automatically installed by IDE 

#include <LiquidCrystal_I2C.h>     //installed by Add .ZIP option of IDE; downloadable from link given below
LiquidCrystal lcd(0x27, 16, 2);      //deviceAddress is 0b0100111; 2-line 16-characters

void setup()
{
  lcd.init();                         //must be
  lcd.backlight();                //must be
  lcd.setCursoe (1, 0);       //Cursor position: DP1 (display position 1) Top Line
  lcd.print("OK!");             //OK! should appear on LCD
}

void loop()
{

}




**BTW:** In case the message OK! is not seen on the LCD, adjust the contrast pot of the IO Extender Board which is attached with at the back of LCD.
![|500x282](http://www.krdcbd.com/I2CLCD.png)

[download LiquidCrystal_I2C.h](http://www.krdcbd.com/LiquidCrystal_I2C.zip) (there are many versions of .h files; not all versions work!)

GolamMostafa, I am trying to get this to work, I downloaded the library that you linked to, here is the error that I am now getting:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

LCDTEST4:3: error: 'LiquidCrystal' does not name a type

 LiquidCrystal lcd(0x27, 16, 2);      //deviceAddress is 0b0100111; 2-line 16-characters

 ^

C:\Users\user\Documents\Arduino\LCDTEST4\LCDTEST4.ino: In function 'void setup()':

LCDTEST4:7: error: 'lcd' was not declared in this scope

    lcd.init();                         //must be

    ^

exit status 1
'LiquidCrystal' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I am not sure why it says that 'LiquidCrystal' does not name a type, should I add "I2C"?? Thank you all again for your help, I feel that I am getting somewhat of a grasp of the basics

I am not sure why it says that 'LiquidCrystal' does not name a type, should I add "I2C"?? Thank you all again for your help, I feel that I am getting somewhat of a grasp of the basics

A typo mistake in my code as follows:

Not this one: LiquidCrystal lcd(0x27, 16, 2); //deviceAddress is 0b0100111; 2-line 16-characters

This one: LiquidCrystal_I2C lcd(0x27, 16, 2); //deviceAddress is 0b0100111; 2-line 16-characters

(1) You should have been able to correct it. You need to know some basics of C/C++ programming.
(2) Have you included the LiquidCrystal_I2C.h file in ypur IDE? If you have not yet done it, include it this way:

IDE ---> Menu Bar ---> Sketch ---> Include Library ---> Add .ZIP Library...

I called the library garbage because the author did that stupid relative #include directive that assumes the library and Wire.h will be in very specific locations which would only happen if you installed the library to the Arduino AVR Boards hardware package folder. This is not necessarily a simple process and needs to be repeated every time you update to a new version of the package or the IDE. That odd decision they made years ago has causes tremendous amounts of trouble to the people trying to use it and it seems to be a library that is commonly distributed by the sellers of LCDs even though many other libraries exist without that problem.

GolamMostafa:
A typo mistake in my code as follows:

Not this one: LiquidCrystal lcd(0x27, 16, 2); //deviceAddress is 0b0100111; 2-line 16-characters

This one: LiquidCrystal_I2C lcd(0x27, 16, 2); //deviceAddress is 0b0100111; 2-line 16-characters

(1) You should have been able to correct it. You need to know some basics of C/C++ programming.
(2) Have you included the LiquidCrystal_I2C.h file in ypur IDE? If you have not yet done it, include it this way:

IDE ---> Menu Bar ---> Sketch ---> Include Library ---> Add .ZIP Library...

GolamMostafa, First, you are correct I do need to know more of the basics of C/C++ programming, that is what I am concentrating on at this point. Again, just trying to get the LCD to run the "OK" code. Yes, I did include the LiquidCrystal_I2c.h to the library as you described.

When I changed the line in the code as you described I go the following code:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\user\Documents\Arduino\LCDTEST4\LCDTEST4.ino:3:34: warning: invalid conversion from 'int' to 't_backlighPol' [-fpermissive]

 LiquidCrystal_I2C lcd(0x27, 16, 2);      //deviceAddress is 0b0100111; 2-line 16-characters

                                  ^

In file included from C:\Users\user\Documents\Arduino\LCDTEST4\LCDTEST4.ino:2:0:

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h:53:4: note: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'

    LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);

    ^

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h: In function 'void setup()':

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.h:154:9: error: 'int LiquidCrystal_I2C::init()' is private

    int  init();

         ^

LCDTEST4:7: error: within this context

    lcd.init();                         //must be

             ^

LCDTEST4:9: error: 'class LiquidCrystal_I2C' has no member named 'setCursoe'

    lcd.setCursoe (1, 0);       //Cursor position: DP1 (display position 1) Top Line

        ^

exit status 1
within this context

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

At this point I am sure that my lack of C/C++ programming skills are the issue here, but I also would not think that everything I try should end up in at a brick wall or need to be recoded. My current end goals is to just get the LCD to show "OK" after that I can try to implement the real code that I started out wanting to use. Thank you again for your help so far, sincerely trying to learn.....

pert:
I called the library garbage because the author did that stupid relative #include directive that assumes the library and Wire.h will be in very specific locations which would only happen if you installed the library to the Arduino AVR Boards hardware package folder. This is not necessarily a simple process and needs to be repeated every time you update to a new version of the package or the IDE. That odd decision they made years ago has causes tremendous amounts of trouble to the people trying to use it and it seems to be a library that is commonly distributed by the sellers of LCDs even though many other libraries exist without that problem.

Pert, I understand exactly what you are saying and would say that you are exactly right in this. This kind of issue makes it even harder on newbe, but it has made me learn more about the libraries and even making moderate changes to the file codes. Thank you again for responding and helping me with this...

@Dgerry

These are the codes that I have just now executed on my I2C LCD, and these are working fine under Platform: IDE 1.8.0, Windows 8.1.

#include<Wire.h>      //automatically installed by IDE 
#include <LiquidCrystal_I2C.h>     //installed by Add .ZIP option of IDE; downloadable from link given below
LiquidCrystal_I2C lcd(0x27, 16, 2);      //deviceAddress is 0b0100111; 2-line 16-characters

void setup()
{
   lcd.init();                         //must be 
   lcd.backlight();                //must be
   lcd.setCursor (1, 0);       //Cursor position: DP1 (display position 1) Top Line
   lcd.print("OKK!");             //OK! should appear on LCD
} 

void loop()
{

}

If your LCD is not still working, check the following:
(1) Address of your IO Extender. If the chip is 8574, the address is: 0x20- 0x27. If the chip is 8574A, the address is : 0x38 - 0x3F. The lower three bits of the address are configured by the solder bridges (A2, A1, A0) on the Extender Card.

(2) Try by changing the LCD.
(3) Try with IDE 1.8.0 and Win-10
(4) Try with another PC with IDE 1.8.0 and Windows 8.1.
(5) Try in all possible ways without causing injury to yourself and equipment.

Please post a link to the shield that you use; I have a suspicion that it's not an I2C lcd but one that uses a parallel interface.

sterretje:
Please post a link to the shield that you use; I have a suspicion that it's not an I2C lcd but one that uses a parallel interface.

Hello sterretje, here is a link to the shield that I am using (trying to use):

Let me know what you think and it if it not correct, could point me in the right direction? Thanks!

Dgerry:
it has made me learn more about the libraries and even making moderate changes to the file codes.

It is a valuable lesson. I think to a lot of Arduino users the libraries are just black boxes. It's important to understand that you can look at the compilation output to find the path, then open any library file in a text file to see what's going on under the hood or even tinker with it a bit. Understanding a bit more how includes work is great too.

Sorry, should have been clearer. The lcd / keypad shield.

pert:
It is a valuable lesson. I think to a lot of Arduino users the libraries are just black boxes. It's important to understand that you can look at the compilation output to find the path, then open any library file in a text file to see what's going on under the hood or even tinker with it a bit. Understanding a bit more how includes work is great too.

pert, that is exactly right, because of this issue, I have gotten very familiar with these process, really just started to complete a project I found online, now very interested and enjoying learning, thanks for you help...

sterretje:
Sorry, should have been clearer. The lcd / keypad shield.

sterretje, I think that you are on to something here....This is a link to the LCD/KeyPad Shield:

https://www.ebay.com/itm/LCD-Keypad-Shield-for-Arduino-1602-Blue-LCD-6-Button-US-Seller-Fast-Ship/181956872475?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

It does not say it is I2C compatible, when I was first ordering these parts I was going off of a list and had no idea what I was ordering. I have now ordered this one:

Let me know if you see anything wrong with this one. I will report back once the new one gets here tomorrow. Thank you for your help!

The first one looks very much like Arduino_LCD_KeyPad_Shield__SKU__DFR0009_-DFRobot; you can try the examples that come with the IDE for the (normal) LCD; adjust the pin numbers as needed.

More here; you do not need the dedicated library.

No experience with the second one; it's I2C according to the description :wink:

https://www.amazon.com/gp/product/B071W84MQQ/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

Let me know if you see anything wrong with this one. I will report back once the new one gets here tomorrow. Thank you for your help!

The shield from amazon uses the I/O expander MCP23017. They recommend that you use the Adafruit RGBLCD Shield library. It is available through the library manager.

sterretje:
The first one looks very much like Arduino_LCD_KeyPad_Shield__SKU__DFR0009_-DFRobot; you can try the examples that come with the IDE for the (normal) LCD; adjust the pin numbers as needed.

More here; you do not need the dedicated library.

No experience with the second one; it's I2C according to the description :wink:

sterretje, I tried everything with that LCD, I could never get any text only the backlight would light up, nothing else, I adjusted the contrast every way with no change. I did get the new one in and got it to run the "HELLO WORLD" text immediately. So, there was some triumph there. I am assuming the the first LCD was DOA. Problem is that this has opened up a whole new list of problems for my project. From the beginning I started this to run a program that someone else had previously built for their list of components. Now, I actually have worked through all of this and have a working LCD, but I am not familiar with coding enough to change the original code to use this new LCD. Here is the first tab of the code I want to use:

#include <LiquidCrystal.h>
#include <SPI.h>
#include <can.h>
#include <Wire.h>
#include <Timer.h>
#include <EEPROM.h>

// Defines for setting up the CAN Bus
#define mode NORMAL // define CAN mode
#define bitrate 250 // define CAN speed (bitrate)
MCP CAN1 (10);       //Create CAN Channel

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);  // Set the LCD I2C address


// define some values used by the panel and buttons
int lcd_key     = 0;
int adc_key_in  = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5



/*
 * Turbo Size (cm^2) vs Position
 *   3   4   5   6   7   8   9  10  11  12  13  14
 * 960 918 876 835 793 751 709 667 625 584 542 500
 *  15  16  17  18  19  20  21  22  23  24  25
 * 458 416 375 333 291 249 207 165 124  82  40
 */


// Timers
Timer t1;
//Timer t2;
unsigned int timer = 0;

unsigned int last_vane_position = 40;
unsigned int vane_position;
unsigned int DesiredPosition;
int StoredPos = 0;

int VanePos = 0;
int ErrorCount = 0;
int CountDown = 0;
int TestCount = 0;
int CanMessagesReceived = 0;                   //number of CAN messages recieved since last serial display update
#define VGTaddress  0x0CFFC600UL      //CAN bus address of the VGT controller
#define StatusMessageID  0x18FFC502UL //this is the message id of the messages we're concerned with
#define BreakMessageID  0x18FF0A02UL  //This is the message id of a 'terminator' string, or something... no relevant information it seems
#define ErrorMessageID  0x18EEFF02UL  //Seems to be an error message ID when low voltage is triggered?

//VGT return values
int VgtRealPosition;         //The position the VGT is actually at (read from the CAN messages)
int VgtCommandPosition;      //The position the VGT target
int VgtMotorCommandSpeed;    //The speed and direction the vane motor is set to
int VgtRawTemp;              //Temperature of the VGT control unit... should be pretty close to coolant temp in most situations

int CommandPos = 0;
int RealPos = 0;
int RespondCount = 0;
boolean LowEnd = false;
boolean HighEnd = true;
byte Command;

boolean CyclePrompt = false;
boolean MessageRecieved = false;

I have the rest of the tabs as well with all of the functions, but no reason to post all of that here. Anyway, you see #include <LiquidCrystal.h> at the beginning of the code, but to get the "HELLO WORLD" code to finally run I had to use #include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h> . So, I am not really sure how to proceed or if it is hopeless. I would assume that I have to rewrite the complete code and change everything that pertains to <LiquidCrystal.H> to the new #include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>

Any input would be great, in the meantime I am going to start trying to plug different things in a try them. Thank you!!

cattledog:
The shield from amazon uses the I/O expander MCP23017. They recommend that you use the Adafruit RGBLCD Shield library. It is available through the library manager.

cattledog, thanks for that I had overlooked that, I added that library to my manager. I actually got the "HELLO WORLD" text to come up on the LCD and for all of the buttons to function properly. I am now trying to figure out how to implement this to an existing code that someone else wrote. I briefly described this in the post above. Thank you again for the help!