LCD 16X2 with arduino uno

Hi

i am trying to write to my 16x2 sparkfun LCD, however I dont know how to do this and unable to find a code online that works, as every time it displays random characters.

wondering whether anyone could help me out or direct me in the direction of a working code.

Thanks Angela

Why don't you show us what you have done so far?

Don

This is the code i have at the moment, although i have been trying lots of different ones I have found but all come up with random characters on the screen.

#include <SoftwareSerial.h>

 

SoftwareSerial lcd(2, 2); //connect LCD RX to TX (D2) on Arduino

 

void setup()

{

Serial.begin(9600);  // start serial monitor serial

lcd.begin(9600);  // start lcd serial

lcd.write(0xFE);  // send the special command

lcd.write(0x01);  // send the clear screen command

}

 

void loop()

{

while(Serial.available())  // If serial data is available do this

lcd.print((char) Serial.read());

lcd.write(0xFE);  //special LCD command character

lcd.write(0xC0);  //send cursor to line 2 position 0

lcd.print(millis()/1000); //number of seconds since reset

lcd.write(0xFE);  //special LCD command character

lcd.write(0x80);  //send cursor to line 1 position 0

}

i know i need to use serial coms with the LCD although i have no clue how to do this with arduino. I have attached a photo of what the setup is at the moment and the result of the above code.

Thanks alot

I don't recognise that "backpack" PCB, and pin 14 does not appears to be soldered on that display.

Now almost all applications use the display in 4-bit mode, so pins 7 to 10 generally do not matter, but pins 11 to 14 are the essential data pins.

Hi, My 2 cents I would use an I2C back pack, Using serial seems harder for me. I now use I2C with 4 wires Vcc, Earth, SDA and SCL, device address can be altered with jumpers default is 0X26 From ebay http://www.ebay.co.uk/itm/IIC-I2C-TWI-SP-Serial-Interface-Board-Module-Port-For-5V-Arduino-1602LCD-Display/291116790762?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222003%26algo%3DSIC.FIT%26ao%3D1%26asc%3D22704%26meid%3D7496716301796427428%26pid%3D100005%26prg%3D9178%26rk%3D6%26rkt%3D6%26sd%3D261500584739&rt=nc

How about some information about the serial adapter?

Don

Hi

thanks for the help everyone. Turns out one of my friends had a LCD from sparkfun with three pins (GND, +V and one that i connected to pin2) which worked with the code I had.

Thanks again though!!