Show Posts
|
|
Pages: 1 ... 6 7 [8] 9
|
|
114
|
Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno
|
on: September 05, 2012, 01:28:19 pm
|
|
I was going to mention...about the sainsmart stuff....forget their 0x27 garbage! you need to verify the I2C address for the device you're communicating with via this I2C scanner code:
// i2c_scanner // // This program (or code that looks like it) // can be found in many places. // For example on the Arduino.cc forum. // The original author is not know. // // This sketch tests the standard 7-bit addresses // from 0 to 127. Devices with higher bit address // might not be seen properly. // // Adapted to be as simple as possible by Arduino.cc user Krodal // // June 2012 // Using Arduino 1.0.1 // #include <Wire.h>
void setup() { Wire.begin(); Serial.begin(9600); Serial.println("\nI2C Scanner"); }
void loop() { byte error, address; int nDevices; Serial.println("Scanning..."); nDevices = 0; for(address = 0; address <= 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(" !"); nDevices++; } else if (error==4) { Serial.print("Unknow error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(8000); // wait 8 seconds for next scan }
Then open the serial monitor after uploading and check the address.....mine was 0x3F
|
|
|
|
|
115
|
Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno
|
on: September 05, 2012, 01:24:48 pm
|
|
FM,
Yes...your Library you were trying to Direct me to was the same Andrew was......and the one sainsmart has you download is the same as well.
Here is what i was doign wrong all along! So In the beginning I had my I2C scanner running so I knew it was address 0x3F i was communicating with right?
Well when I had first downloaded that new LiquidCrystal Library...I discarded the other liquidCrystal library that is in 1.0.1 but what I was doing wrong: I didn't discard the LiquidCrystal_I2C library I had downloaded before...it kept wanting to use that one......because the LiquidCrystal_i2c.h and LCD.h is already in the new LiquidCrystal library.....Now I just have to tinker with the code to make it say what I want in the loop etc...
But you guys have been so great and patient...I REALLY APPRECIATE it.....
Thanks to FM and Andrew......
|
|
|
|
|
119
|
Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno
|
on: August 31, 2012, 12:59:37 pm
|
|
Nah its definitely 0x3F...
Here is taken from my serial monitor just now:
I2C Scanner Scanning... I2C device found at address 0x3F ! done
Scanning... I2C device found at address 0x3F ! done
I switched code around a bit:
#include <Wire.h> #include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 20, 4);
void setup() { lcd.init(); // initialize the lcd lcd.backlight(); }
void loop() {
Wire.begin(); lcd.setCursor(0,0); lcd.print("Hello"); lcd.setCursor (0, 1); lcd.print (" World!");
}
my backlight will stay on now.....the pixels are fluxuating...adjusted the contrast still no characters....
|
|
|
|
|
120
|
Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno
|
on: August 31, 2012, 12:41:02 pm
|
|
I am so close I feel it...I just need some new tips....
here is my code:
#include <Wire.h> #include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 20, 4);
void setup() { lcd.init(); Wire.begin(0x3F); lcd.print("Hello"); lcd.setCursor ( 0, 1 ); lcd.print (" World!"); Wire.endTransmission(); }
void loop() {
}
pins 4 and 5 from arduino Uno plugged into I2C board on 20 x 4 LCD...along with ground and power.....just white pixels on LCD still and the LED backlight flashes from time to time.....
|
|
|
|
|