logo elektroda
logo elektroda
X
logo elektroda

Arduino Mega 2560 + 2x16 LCD Display + I2C Integration: Address 0x27 Library Compilation

mossa125125 5253 18
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16243096
    mossa125125
    Level 13  
    Hello
    After a few days of searching the web for a specific solution to the problem, I decided to ask for help here in the forum.
    To the point, I recently bought an arduino 2560 plate and several gadgets for educational purposes for my 12-year-old son. Everything was going well in reworking individual projects, until we came to the 2x16 LCD display, standard only that integrated with I2C. Connecting is very easy. Then I checked what address I2C has with the scanner program. It turned out that the address is 0x27. And from that moment the stairs began. I downloaded the appropriate library, installed it according to the instructions, which are a lot on the net, and in no way can I go through the compilation of the program code. I used different codes and each compilation attempt ends with the following message.
    Please, help me and my son.


    Arduino: 1.8.1 (Windows 7), Board: "Arduino / Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

    C: \ Users \ Krzyś \ Desktop \ Documents \ Miki \ arduino-1.8.1-windows \ arduino-1.8.1 \ libraries \ LiquidCrystal \ I2CIO.cpp: 35: 26: fatal error: ../Wire/Wire.h : No such file or directory

    #include

    ^

    compilation terminated.

    exit status 1
    Compilation error for Arduino / Genuino Mega or Mega 2560 tile.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 16243317
    krzysiek_krm
    Level 40  
    Hello,
    from the message, it appears that he cannot find the "Wire" library, probably it is not where it is expected.

    Regards
  • ADVERTISEMENT
  • #3 16243319
    Slawek K.
    Level 35  
    Show the code you want to compile.

    pozdr
  • ADVERTISEMENT
  • #4 16243348
    mossa125125
    Level 13  
    Here is an example (one of many codes) that I tried to compile:

    #include ;
    #include ;

    LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the system address to 0x27
    void setup ()
    {
    lcd.begin (16.2);

    lcd.backlight ();
    lcd.setCursor (0,0);
    lcd.print ("Hello, world!"); // Text that will be displayed on the first line of the display
    lcd.setCursor (0.1);
    lcd.print ( "homeguard24.pl"); // Text that will be displayed on the second line of the display

    }

    void loop ()
    {
    lcd.setCursor (0,0);
    lcd.print ("Hello, world!");
    lcd.setCursor (0.1);
    lcd.print ( "homeguard24.pl");
    }


    And as for the Wire library, I had such suspicions that it is not where it should be, only that in other projects we did there was also a reference to this library and everything reveled. But it's probably worth following this lead.
  • #5 16243375
    krzysiek_krm
    Level 40  
    Czort knows if the access path is too long (it's C: \ users, etc.), some programs get lost with too long access paths (although they loyally warn about it in the documentation).
    Try it can install in the root directory of the disk.

    Regards
  • ADVERTISEMENT
  • #6 16243379
    Slawek K.
    Level 35  
    It looks like it can't find the Wire library. You do not need semicolons because of the #include directives

    pozdr
  • #7 16243408
    mossa125125
    Level 13  
    Teraz przy próbie kompilacji tego kodu:

    #include
    #include
    #include

    #define I2C_ADDR 0x27 //
  • #8 16243426
    krzysiek_krm
    Level 40  
    So ".h" is missing
  • #9 16243452
    mossa125125
    Level 13  
    And you can get leads for this wire.h library?
  • #10 16243469
    krzysiek_krm
    Level 40  
    In my opinion, instead of:
    mossa125125 wrote:
    #include

    should:
    ... LiquidCrystal_I2C.h
    because he can't see this library.
  • #11 16243482
    mossa125125
    Level 13  
    I only have such a file in the library that it may not be in what format I need, what I have is a file of the H type
  • #12 16243529
    krzysiek_krm
    Level 40  
    I am very sorry, in the last version of the program, in the third "include" directive, ".h" is simply missing from the library name, which is why it cannot see it, the extension is not implied, the compiler does not add it.

    Added after 4 [minutes]:

    These errors are because you enter these lines manually.
    As far as I remember, in Arduino there is a mechanism (button or menu) that is used to import a library, select, click and the necessary lines are added as needed.
  • #13 16243566
    mossa125125
    Level 13  
    None of this, I changed it to another code, I transferred the whole program to drive C so that the path was short and here is the effect:

    #include
    #include

    LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the system address to 0x27

    void setup ()
    {
    lcd.begin (16.2);
    lcd.backlight (); // turn on the backlight
    lcd.setCursor (0,0);
    lcd.print ("LCD & I2C");
    delay (500);
    lcd.setCursor (0.1);
    lcd.print ( "**********");
    }

    void loop ()
    {
    lcd.backlight (); // turn on the backlight
    delay (5000);
    lcd.noBacklight (); // turn off the backlight
    delay (5000);
    }



    C: \ arduino-1.8.1-windows \ arduino-1.8.1 \ libraries \ LiquidCrystal \ I2CIO.cpp: 35: 26: fatal error: ../Wire/Wire.h: No such file or directory

    #include

    ^

    compilation terminated.

    exit status 1
    Compilation error for Arduino / Genuino Mega or Mega 2560 tile.
  • Helpful post
    #15 16244063
    adasikp
    Level 17  
    And if you replace #include with #include in the I2CIO.cpp file, what would happen then? by the way, line 35
    After all, he writes that on this path "/Wire/Wire.h: No such file or directory" there is no Wire.h file.
    You have to edit the library file, changing the code won't do anything because the declaration is in the library.
    The NewliquidCrystal version has a condition
    Code: C / C++
    Log in, to see the code
  • Helpful post
    #16 16244140
    krzysiek_krm
    Level 40  
    adasikp wrote:
    And if you replace #include with #include in the I2CIO.cpp file, what would happen then? by the way, line 35
    After all, he writes that on this path "/Wire/Wire.h: No such file or directory" there is no Wire.h file.
    You have to edit the library file, changing the code won't do anything because the declaration is in the library.

    This is something unfavorable "feature" of this platform: different versions of IDE, different versions of libraries, compatible, incompatible.
    You must either use the latest versions of libraries (sometimes the developers write that the latest version ensures compatibility with this and such IDE version) or:
    rs6000 wrote:
    Install version 1.0.6 and everything will work properly, there are a lot of problems with these latest versions.
  • #17 16244301
    mossa125125
    Level 13  
    adasikp wrote:
    And if you replace #include with #include in the I2CIO.cpp file, what would happen then? by the way, line 35
    After all, he writes that on this path "/Wire/Wire.h: No such file or directory" there is no Wire.h file.
    You have to edit the library file, changing the code won't do anything because the declaration is in the library.
    The NewliquidCrystal version has a condition
    Code: C / C++
    Log in, to see the code



    And it helped. Everything compiles, nicely uploads to the board, only one more problem arose, so the display has no text to display. The display reacts to a change in contrast and the text is gone. I will have to look at this display under the magnifying glass or cold solders are gone. Despite all thanks for the help.
  • #18 16245115
    Slawek K.
    Level 35  
    I assume that you connected the I2C bus correctly? I mean SDA and SCL lines, pins 20 and 21.
  • #19 16245680
    mossa125125
    Level 13  
    Of course it's correct. On Saturday I will have a moment and I will take the display to the workshop.

Topic summary

The discussion revolves around troubleshooting issues with an Arduino Mega 2560 and a 2x16 LCD display integrated with I2C, specifically addressing compilation errors related to the "Wire" library and the correct inclusion of header files. The user initially faced difficulties compiling their code after confirming the I2C address (0x27) using a scanner program. Responses highlighted potential issues such as missing library files, incorrect include statements, and the impact of long file paths on compilation. Suggestions included installing an older version of the Arduino IDE (1.0.6) and ensuring proper library imports. Ultimately, the user managed to compile the code successfully but encountered a new issue where the display showed no text, prompting further investigation into hardware connections and display functionality.
Summary generated by the language model.
ADVERTISEMENT