2

When this 3 wire LCD code is compiled the following message results: NewLiquidCrystal-master\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 for board Arduino Nano.

Thanks for your help.

 // Original LiquidCrystal library that can be inherited from to support other 
 // connectivity: 
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home 


 #include <LiquidCrystal_SR_LCD3.h> 


 // Standard HD44780 20x4 LCD display driven via 3 output pins to a 4094 8-bit 
 // shift register like 74HC4094 pebblev2's MC14094 

  // This demo was written for the PebbleV2 to test LiquidCrystal_SR_LCD3, but it 
 // should work with other LiquidCrystal Displays that are 20x4. 
 // http://www.freetronics.com/pages/pebble-v2 
 // https://github.com/lukeweston/pebble20 


 // Data are the input bits 
 // Clock tells the SR that the data pin holds the next valid bit 
 // Strobe gets data input to be made visible on the parallel output pins. 


 const int PIN_LCD_STROBE         =  2;  // Out: LCD IC4094 shift-register strobe 
 const int PIN_LCD_DATA           =  3;  // Out: LCD IC4094 shift-register data 
 const int PIN_LCD_CLOCK          =  4;  // Out: LCD IC4094 shift-register clock 
 const int PIN_LCD_BACKLIGHT      =  5;  // Out: LCD backlight (PWM) 


 // srdata / srclock / strobe 
 LiquidCrystal_SR_LCD3 lcd(PIN_LCD_DATA, PIN_LCD_CLOCK, PIN_LCD_STROBE); 


 // Creat a set of new characters 
 byte heart[8] = { 
   0b00000, 0b01010, 0b11111, 0b11111, 0b11111, 0b01110, 0b00100, 0b00000 
 }; 


 byte smiley[8] = { 
   0b00000, 0b00000, 0b01010, 0b00000, 0b00000, 0b10001, 0b01110, 0b00000 
 }; 


 byte frownie[8] = { 
   0b00000, 0b00000, 0b01010, 0b00000, 0b00000, 0b00000, 0b01110, 0b10001 
 }; 


byte armsDown[8] = { 
   0b00100, 0b01010, 0b00100, 0b00100, 0b01110, 0b10101, 0b00100, 0b01010 
 }; 


 byte armsUp[8] = { 
   0b00100, 0b01010, 0b00100, 0b10101, 0b01110, 0b00100, 0b00100, 0b01010 
 }; 


 void setup(){ 
     pinMode(PIN_LCD_BACKLIGHT, OUTPUT); 
     analogWrite(PIN_LCD_BACKLIGHT, 80); 


     lcd.begin(20, 4);               // initialize the lcd  


     // load characters to the LCD 
     lcd.createChar(0, smiley); 
     lcd.createChar(1, frownie); 
     lcd.createChar(2, armsDown);   
     lcd.createChar(3, armsUp);   
     lcd.createChar(4, heart); 


     lcd.home ();                   // go home 
     lcd.setCursor (0, 0); 
     lcd.print(F("LiquidCrystal_SRLCD3"));   
     lcd.setCursor (0, 1); 
     lcd.print(F("he..")); 
     lcd.setCursor (0, 2); 
     lcd.print(F("..lo")); 
     lcd.setCursor (0, 3); 
     lcd.print(F("World ")); 
     lcd.print(char(4)); 
     lcd.print(char(2)); 
     lcd.print(char(3)); 
     delay(2000); 
 } 


void loop() 
 { 
     for (int i = 5; i <= 15; i++){ 
       lcd.setCursor ( i, 1 ); 
       lcd.print(char(random(0,2))); 
       delay(100); 
       lcd.setCursor ( i, 1 ); 
       lcd.print(F(" ")); 
     } 

     for (int i = 15; i >= 5; i--){ 
       lcd.setCursor ( i, 1 ); 
       lcd.print(char(random(0,2))); 
       delay(100); 
       lcd.setCursor ( i, 1 ); 
  lcd.print(F(" ")); 
     } 


     // Turn the display on/off 
     lcd.setCursor ( 5, 2 ); 
     lcd.print(F("Turn screen off")); 
     delay(1000); 
     lcd.noDisplay(); 
     delay(1000); 
     lcd.display();    


     lcd.setCursor ( 5, 2 ); 
     lcd.print(F("Toggle Cursor  ")); 
     delay(1000); 
     lcd.setCursor ( 19, 2 ); 
     lcd.cursor(); 
     delay(2000); 
     lcd.noCursor(); 


     lcd.setCursor ( 5, 2 ); 
     lcd.print(F("Toggle Blink   ")); 
     lcd.setCursor ( 19, 2 ); 
     lcd.blink(); 
     delay(2000); 
     lcd.noBlink(); 


     lcd.setCursor ( 5, 2 ); 
     lcd.print(F("Scroll screen  ")); 
     delay(1000); 
 // This is an autoscroll demo, not super useful but here just in case. 
 //    lcd.setCursor(16,0); 
 //     lcd.autoscroll(); 
 //     // print from 0 to 9: 
 //     for (uint8_t thisChar = 0; thisChar < 10; thisChar++) { 
 //   lcd.print(char(2)); 
 //  delay(250); 
 //  lcd.print(char(3)); 
 //  delay(250); 
 //     } 
 //     // turn off automatic scro 
 //     lcd.noAutoscroll(); 


     for (uint8_t positionCounter = 0; positionCounter < 10; positionCounter++) { 
       // scroll one position left: 
       lcd.scrollDisplayLeft();  
       // wait a bit: 
       delay(50); 
     } 


     // scroll 29 positions (string length + display length) to the right 
     // to move it offscreen right: 
     for (uint8_t positionCounter = 0; positionCounter < 20; positionCounter++) { 
       // scroll one position right: 
       lcd.scrollDisplayRight();  
       // wait a bit: 
       delay(50); 
    } 


       // scroll 16 positions (display length + string length) to the left 
       // to move it back to center: 
     for (uint8_t positionCounter = 0; positionCounter < 10; positionCounter++) { 
       // scroll one position left: 
       lcd.scrollDisplayLeft();  
       // wait a bit: 
       delay(50); 
     } 
     lcd.setCursor ( 5, 2 ); 
     lcd.print(F("               ")); 
 } 
6
  • The error message is rather clear, the file Wire.h is not in the expected location. Either edit the file I2CIO.cpp and change the #include statement or create that directory and copy the file to it.
    – ott--
    Apr 3 '16 at 2:53
  • Thanks for your reply. I'm still learning Arduino programming and uncertain how to create the directory. I want to verify that after the directory is created I2CI).cpp is copied in the newly created directory? What should be the name of the directory? Thanks for your assistance.
    – Tom Evans
    Apr 3 '16 at 4:05
  • Go to the directory where I2CIO.cpp is located. Change one directory up with cd ... Create the new directory with mkdir Wire. Copy Wire.h to the new directory.
    – ott--
    Apr 3 '16 at 16:44
  • The programmer did not include the Wire/Wire.h. I don't see in the code any reference to this library. Is it wire.h or wire/wire.h?
    – Tom Evans
    Apr 3 '16 at 22:46
  • It's there in the LiquidCrystal_V1.2.1.zip. In newer versions it's gone.
    – ott--
    Apr 3 '16 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.