Go Down

Topic: #include<..wire/wire.h> error using i2c lcd display (Read 5759 times) previous topic - next topic

bogdan94

Hello everybody, this is my first post, so I want to apologise if I will make any mistakes or I won't explain my problem good enough.

So, a few days back I bought a 16x02 i2c lcd display, and I managed to make it work doing like in the link below, with the same library(LiquidCrystal_V1.2.1).

http://forum.arduino.cc/index.php?topic=128635.0

I used the exemple posted in the first post, and I used the same instructions/functions for my project and it worked perfectly!

After this, I tried to make a few modifications to my code, but nothing about the lcd instructions and I think I updated the LCD library, as the compiler said there are updates available.

From this point, I couldn't run my project, nor the exemple anymore.

I thought the problem was that update for the library, so I deleted it and reinstalled the original library, but the error persisted.

This is the error:
Code: [Select]
Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"

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

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

                          ^

compilation terminated.

exit status 1
Error compiling.



And this is the exemple I used from that link:
Code: [Select]

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

#define I2C_ADDR    0x3F // <<----- 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

int n = 1;

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
 lcd.begin (16,2); //  <<----- My LCD was 16x2
 
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home

 lcd.print("SainSmartI2C16x2"); 
}

void loop()
{
 // Backlight on/off every 3 seconds
 lcd.setCursor (0,1);        // go to start of 2nd line
 lcd.print(n++,DEC);
 lcd.setBacklight(LOW);      // Backlight off
 delay(3000);
 lcd.setBacklight(HIGH);     // Backlight on
 delay(3000);
}



I searched a lot but i couldn't find a proper solution for this, does anyone know what I should do to make it work again?

PS: I want to mention that I still have the code running in my board, because after that, I couldn't make it compile again, so no chance to upload it.

PaulS

Look at the I2CIO.cpp file. If it really says
Code: [Select]
#include <../Wire/Wire.h>
change it to
Code: [Select]
#include <Wire.h>

bogdan94

Thank you very much! It worked!
I guess I should not update that library anymore!

DavidI

Look at the I2CIO.cpp file. If it really says
 #include <../Wire/Wire.h>
change it to
 #include <Wire.h>
The versions of I2CIO.cpp that I have seen (from Malpartita) have the following lines
Code: [Select]

#if (ARDUINO <  100)
   #include <WProgram.h>
#else
   #include <Arduino.h>
#endif

#if (ARDUINO < 10000)
   #include <../Wire/Wire.h>
#else
   #include <Wire.h>
#endif

#include <inttypes.h>

#include "I2CIO.h"

now I'm running IDE 1.6.9 under win10 and I don't get the error reported, it seems that the value of ARDUINO returned by my system is 10609.
A colleague is running 1.6.9 under win 7 and the error is hitting him with the same error reported by the op.
Apart from the win7 win10 difference the only difference that I know of between us is that his library is in programfiles\arduino\libraries and mine is in  documents\arduino\libraries.
Dave

PaulS

Quote
A colleague is running 1.6.9 under win 7 and the error is hitting him with the same error reported by the op.
So, why not do the obvious?

Delete
Code: [Select]
#if (ARDUINO < 10000)
   #include <../Wire/Wire.h>
#else
   #include <Wire.h>
#endif

and put in:
Code: [Select]
   #include <Wire.h>

Just curious.

DavidI

It it so obvious?  this is the error line reported at the beginning of this thread:

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

Why is ../Wire/Wire.h not written as ..\Wire\Wire.h   ?

To me it seems that changing ../Wire/Wire.h to ..\Wire\Wire.h is the correct thing to do even though replacing the entire if..else..endif with #include <Wire.h> seems to have worked.

What was intended by the original if else endif?

As you can see from the number of posts I've made I'm still a Newbee and I had discovered the ARDUINO 'variable' while investigating this problem.
 
ARDUINO 100 seems to be IDE ver 1.0, so what is ARDUINO 10000? IDE ver 1.0.0?

But more specifically why is my colleagues IDE 1.6.9 taking the route
#if (ARDUINO < 10000)
 #include <../Wire/Wire.h>

while  my IDE 1.6.9 is taking the route
#else
 #include <Wire.h>

Unfortunately for further investigation he removed all reference to Arduino from his PC over the weekend and re-installed the Arduino software and no longer has the problem !!!!!!

I have just one other query the file I quoted has
Code: [Select]


#if (ARDUINO <  100)
   #include <WProgram.h>
#else
   #include <Arduino.h>
#endif

#if (ARDUINO < 10000)
   #include <../Wire/Wire.h>
#else
   #include <Wire.h>
#endif

What is the effective difference between (ARDUINO <  100) and (ARDUINO < 10000)? I assume IDE ver 1.0.0 never existed
Regards
Dave



PaulS

Quote
I assume IDE ver 1.0.0 never existed
Why?

Lots of things that the Arduino team does are mysteries, like changing the value set for Arduino from 1xy to 1xxyy.

To the compiler, the slash is just a directory separator. Its political leaning is irrelevant.

DavidI

because it doesn't make sense to return to 1.0.0 after 1.0 thru 1.99 (or 1.999999999999  :) )

So the compiler really doesn't care if its ..\wire\wire.h or ../wire/wire.h or any mixture thereof, it still goes up one directory level and tries to get wire.h from directory wire?   Is that really true?

PaulS


fatma_kr


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy