LCD 16X2 with arduino uno


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?


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.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

How about some information about the serial adapter?



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!!