Thank you everyone for the suggestions so far.
As an update, I have the lcd connected to the arduino mega as follows.
GND to negative of power supply
VCC to 4.5V power supply
SDA to SDA pin 20 on mega
SCL to SCL pin 21 on mega
I just tried tunning the I2C scanner an got the folloing message
Scanning...
Unknow error at address 0x3F
No I2C devices found
(side note for anyone new using the i2c scanner, after running the code you need to open the serial monitor under the tools tab to view results )
I currently have liquidcrystal_I2C installed in the library folder
its structure is as follows
Examples (folder)
Info (folder)
Keywords.txt
liquidCrystal_I2C.cpp
liquidCrystal_I2C.h
Using the following code and above library the lcd blinked.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f,20,4);
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
}
void loop()
{
}
I tried uninstalling the above library and replacing it with the download link on the bottom of the page at
http://www.sainsmart.com/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.htmland tried the sample codes in the sketch folder as well as the one provided by kd7eir in his post without success.
Thank you for the code by the way im sure it would work great if i was able to connect to my lcd.
Any ideas why i am getting the I2c error message??