Go Down

Topic: Serial LCD on Uno demo problem, I2C/TWI serial LCD [SOLVED] (Read 2416 times) previous topic - next topic

Ashton

Feb 23, 2013, 08:42 pm Last Edit: Feb 25, 2013, 05:46 pm by Ashton Reason: 1
I'm trying to test a serial 20X4 LCD on an Uno, I just want to run 'Hello World', etc.

But I'm getting errors unclear to me:
HelloWorld:12: error: 'TKLCD_Local' does not name a type
HelloWorld.ino: In function 'void setup()':
HelloWorld:16: error: 'lcd' was not declared in this scope

Code: [Select]
/**
* Simple Hello World program. To be run on an Arduino connected
* to a TinkerKit LCD module via Serial.
*/

#include <Wire.h>
#include <LiquidCrystal.h>
#include <TKLCD.h>

//TKLCD_Serial lcd = TKLCD_Serial(); // when connecting to TKLCD over Serial
TKLCD_Local lcd = TKLCD_Local(); // when programming a TKLCD module itself

void setup() {
 lcd.begin();
  lcd.clear();
  lcd.print("Hello World!");
}
void loop() {
 ; // nothing do be done
}


I have added the TKLCD library.

Any suggestions appreciated.

johnwasser

Do you also get an error saying that the file TKLCD.h was not found?  Did you remember to re-start the Arduino IDE after putting the TKLCD library in place?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Ashton

#2
Feb 23, 2013, 10:18 pm Last Edit: Feb 23, 2013, 10:24 pm by Ashton Reason: 1
Yes I restarted it.

I do not get an error stating the TKLCD was not found.  Just the 3 above errors.

This is strange, when I go to Sketch, Import Library, select TKLCD, it Does Not place the '#include <TKLCD.h>' line in the code for me.
Should it?  I have manually entered it.

Here is another, why are the 'Wire' and 'LiquidCrystal' library names in Red, but the 'TKLCD' library name is black?
Does this indicate anything?

johnwasser

You use TKLCD_Local only when you are using the TinkerKit LCD as if it were an Arduino Leonardo.  If you connect it to an Arduino UNO you use TKLCD_Serial.

http://www.tinkerkit.com/lcd/
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Ashton

#4
Feb 23, 2013, 10:47 pm Last Edit: Feb 23, 2013, 11:12 pm by Ashton Reason: 1
Ok

I selected the TKLCD_Serial lcd = TKLCD_Serial(); and commented the Local.
Same errors.  I think there is a clue with the library not displaying when added, or in red.

Can a Library have old version references, that are not acceptable to the UNO R3 firmware?

TKLCD Library location:
http://www.tinkerkit.com/tklcd-library/#tklcd_serial

Hello world demo sketch:
http://www.tinkerkit.com/lcd-arduino-two-wires-tutorial/

johnwasser


TKLCD Library location:
http://www.tinkerkit.com/tklcd-library/#tklcd_serial

Hello world demo sketch:
http://www.tinkerkit.com/lcd-arduino-two-wires-tutorial/


I downloaded the library .zip file, expanded the .zip file in the libraries folder, re-started the Arduino IDE, and copied and pasted the demo sketch.  It compiled just without errors.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Ashton

Thanks for your time John.

I'll start over from scratch, retest, and report back.

Ashton

Thanks

The sketch compiles without errors after reinstalling the TKLCD library.

Now I just need to determine why the serial LCD displays I have (with terminals GND, VCC, SDA, SCL) are not displaying the serial output of the UNO board when tested.  LCD display under test -> http://www.ebay.com/itm/200764158676

johnwasser


Now I just need to determine why the serial LCD displays I have (with terminals GND, VCC, SDA, SCL) are not displaying the serial output of the UNO board when tested.  LCD display under test -> http://www.ebay.com/itm/200764158676


That's an I2C/TWI serial LCD.  The TinkerKit library is for an LCD connected through the serial port.  You will need to download a matching I2C LCD library.  The PCF8574T chip on the board connected to the LCD is an I2C 8-bit I/O expander.  The library you want is probably "LiquidCrystal_I2C.zip":

http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Ashton

I had been testing a sketch using the LiquidCrystal_I2C library with no success.  Also another for the I2C LCD found here: http://www.strangeparty.com/2011/01/17/arduino-talking-to-an-i2c-lcd-display/ this supposedly displays any character keyed into Hyperterminal -- but nothing working.

I'm not sure where to go from here.  I feel like I did when trying to date a cheerleader.

Ashton

#10
Feb 25, 2013, 05:06 pm Last Edit: Feb 25, 2013, 05:34 pm by Ashton Reason: 1
I'm now testing using the below code, with a different library and IT WORKS!!!!
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//Addr: 0x3F, 20 chars & 4 lines
LiquidCrystal_I2C lcd(0x27,20,4);  //(0x3F,20,4) Didn't work!

void setup()
{
   lcd.init();
   lcd.backlight();
   lcd.setCursor(0, 0);
   lcd.print("Hello");
}
void loop()
{

}


All ok, no errors.

Code source:
http://bradsduino.blogspot.com/2012/10/sainsmart-iici2ctwi-serial-2004-20x4.html?showComment=1361809219336#c7382264317681315704
Using library:
https://arduino-info.wikispaces.com/file/detail/LiquidCrystal_I2C2004V1.zip

Thanks

Go Up