Shield LCD16x2 with Arduino Uno

Started by franknh, June 22, 2016, 07:29:39 PM

Previous topic - Next topic

franknh

I purchased an Olimex Shield LCD16x2 unit with 16x2 LCD and 4 buttons for use with Arduino.
I downloaded the example programs and the LCD16x2 library from the website.
I plug the shield LCD board on to the Arduino Uno, load an example program (Buttons_And_LCD), but it does not compile correctly.  It is giving errors as if it cannot find the wire.h library.  I did see that the wire.h library is located in a different directories than the majority of the libraries used with Arduino.
None of the example programs can compile properly.  They all give a similar error message.  I even selected the Arduino Duemilanova w/ATmega328 board in the IDE like the readme.txt file said to do.
This made no difference and I still get the same error message.

I loaded another example program supplied with the Arduino IDE (digital potentiometer) that uses the same wire.h library and it compiled just fine and I was able to upload it to the board.
Can someone give me some tips as to what might be wrong??  I really would like to use the LCD with 4 buttons in my project.  I have the plain LCD16x2 with buttons separate, but like the 4 buttons built in on the Olimex shield because it is low cost and compact.

Thanks   :(       
Frank Medros


LubOlimex

Hey,

Did you copy the whole folder "LCD16x2" to the libraries folder of your Arduino IDE (ex. "..\arduino-x.x.x\libraries")?

What us the Arduino IDE version that you use?

Did you download the Arduino IDE from arudino.cc or from arudino.org?

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

franknh

I did copy the whole LCD16x2 folder to the arduino\library folder.
I was using arduino IDE version 1.6.8 and recently updated to 1.6.9 and had downloaded both from arduino.cc.
I didn't know there was arduino.org.

So just today I downloaded the even more updated arduino IDE 1.7.10 from arduino.org and after much fighting with the computer, and going back and forth with COM ports, etc to make sure the IDE was communicating properly with the board, I was finally able to load the example program Buttons_and_LCD and successfully compiled it and uploaded to the board and it is operating correctly.

Thanks for the quick reply and pointing me to the arduino.org site.
I am happy that it is finally working and now I can try writing some code for the shield to use in my project.  I may now purchase more units to work with.

LubOlimex

Glad you got it solved. However, this is very interesting since we used the Arduino IDE from arduino.cc to make the project. I thought you attempted to use the Arduino IDE from arduino.org... Makes me think if it is possible that Arduino guys started to detect hardware manufactured from the opposing front and block communication...

Anyway, glad it is working.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

NewtoC

I have the same problems when compiling. I use the IDE version 1.8.5 and have also tried the beta version 1.9. I have even tried different boards, Uno, Nano and Pro Mini.

The LCD16x2 file is placed under Arduino-1.8.5/libraries.

I always receive the followíng text when compiling:


:\Program Files (x86)\Arduino\libraries\LCD16x2\LCD16x2.cpp:24: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 Pro or Pro Mini.

Being absolutely no expert I am probably doing something wrong but what ?

Regards,

LubOlimex

Hey,

Probably something with the include location or syntax between Arduino revisions. Try opening the .cpp file inside the library and change #include <../Wire/Wire.h> to #include <Wire.h>.

If the problem persists you might also try starting the example following this guide: https://www.olimex.com/Products/Duino/_resources/Arduino_instructions.pdf - just make sure to select OLIMEXINO-328 instead of Arduino UNO in the board's manager, else the LCD demo wouldn't be selectable/visible.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

NewtoC

Lub,
Thanks a lot for the quick reply and help !

Now compiling and uploading works.
However, it was not possible to change with the .cpp file inside the library. Instead I put a copy of it in another file, made the change and then reloaded it into the library.

Best regards,
Urban


Dan

Hallo

I got same issue with compiling, cant find LCD16x2.h. With Arduino IDE 2.3.6. Half a year a go i had it to work with Arduino IDE 2.?.?. I changed my computer a month a go, so installed the latest ArduinoIDE. To day i tried with Arduino 1.8.19, with that version it works. How can i get it to work with the latest ArduinoIDE version?

Best regards Dan

LubOlimex

#8
Seems like a different error.

Instead of placing the contents of the archive manually in  "..\arduino-x.x.x\libraries"), try importing the zip archive via the library manager. First delete it from  "..\arduino-x.x.x\libraries" then add the library from the Arduino interface and point to "OLIMEXINO-328-LCD16x2.zip". The archive can be downloaded from the product page of SHIELD-LCD16x2. Refer to these instructions ("Importing a .zip library"):

https://support.arduino.cc/hc/en-us/articles/5145457742236-Add-libraries-to-Arduino-IDE
Technical support and documentation manager at Olimex

Dan

Hallo

One step forward, thank you, and thank you for the fast respons. I had to add it manually, couldnt get the automatic import function to work.

Now it works with Arduino UNO. But not with my Arduino Nano 33 BLE. Now i got this compilation error instead, see below. This was working half a year a go. Is this soemthing you have an idea to as well?

Best regards. Dan

C:\Users\danst\Documents\Arduino\libraries\LCD16x2\LCD16x2.cpp: In member function 'void LCD16x2::lcdWrite(float, uint8_t)':
C:\Users\danst\Documents\Arduino\libraries\LCD16x2\LCD16x2.cpp:220:2: error: 'dtostrf' was not declared in this scope
  dtostrf(floatVal, 3, precision, charBuf);
  ^~~~~~~
C:\Users\danst\Documents\Arduino\libraries\LCD16x2\LCD16x2.cpp:220:2: note: suggested alternative: 'strstr'
  dtostrf(floatVal, 3, precision, charBuf);
  ^~~~~~~
  strstr
exit status 1

Compilation error: exit status 1

LubOlimex

Good. Getting it working with Arduino UNO is a success. Now about the Nano 33 BLE, one board has AVR chip and architecture and the other is ARM. This is a problem since certain libraries are only available for AVR, and they do not work properly with ARM. In this case dtostrf library for example is only available for AVR. You will need to find alternative and edit the code to work for ARM architecture.

Google "dtostrf" and then google "strstr".
Technical support and documentation manager at Olimex