Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #30 on: September 05, 2012, 08:39:47 am » |
Andrew!!!!!! You are the Man! I just hooked it up , downloaded library and uploaded and it worked like a champ! Thank you so much bro!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 36
|
 |
« Reply #31 on: September 05, 2012, 08:53:51 am » |
Andrew!!!!!! You are the Man! I just hooked it up , downloaded library and uploaded and it worked like a champ! Thank you so much bro!
Hey that's great!!! I'm really glad you got it working! I'm loving playing with this LCD too. Cheers, Andrew
|
|
|
|
|
Logged
|
|
|
|
|
Málaga, Spain
Offline
Edison Member
Karma: 33
Posts: 2017
|
 |
« Reply #32 on: September 05, 2012, 08:56:57 am » |
You did use my New LiquidCrystal library right?
The whole thing is that these folks sell their stuff and rely on someone else to sort it out for them. The link in the LCD product page is not for my library (didn't check). But if it was, they could at least mention how they've mapped the I2c extender pins to the LCD to simplify the initialisation and use of what they sell!
|
|
|
|
|
Logged
|
|
|
|
|
Málaga, Spain
Offline
Edison Member
Karma: 33
Posts: 2017
|
 |
« Reply #33 on: September 05, 2012, 09:11:43 am » |
It is a zipped image of my library the one they have on their site! http://www.sainsmart.com/home-page-view/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.htmlThey have even writen a sample sketch to go with it that is not correctly initialised as it uses 0x27 as its base address as opposed to 0x3F used by you LCD module. The sample sketch is called "sainlcdtest". /* ** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens ** Readily found on eBay or http://www.sainsmart.com/ ** The LCD2004 module appears to be identical to one marketed by YwRobot ** ** Address pins 0,1 & 2 are all permenantly tied high so the address is fixed at 0x27 ** ** Written for and tested with Arduino 1.0 ** This example uses F Malpartida's NewLiquidCrystal library. Obtain from: ** https://bitbucket.org/fmalpartida/new-liquidcrystal ** ** Edward Comer ** LICENSE: GNU General Public License, version 3 (GPL-3.0) ** ** NOTE: TEsted on Arduino NANO whose I2C pins are A4==SDA, A5==SCL */ #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // Define I2C Address where the PCF8574A is #define BACKLIGHT_PIN 3 #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7
int n = 1;
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
void setup() { lcd.begin (20,4); // Switch on the backlight lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); // go home
lcd.print("SainSmart I2C tester"); lcd.setCursor ( 0, 1 ); // go to the 2nd line lcd.print("F Malpartida library"); lcd.setCursor ( 0, 2 ); // go to the third line lcd.print("Test By Edward Comer"); lcd.setCursor ( 0, 3 ); // go to the fourth line lcd.print("Iteration No: "); }
void loop() { // Backlight on/off every 3 seconds lcd.setCursor (14,3); // go col 14 of line 3 lcd.print(n++,DEC); lcd.setBacklight(LOW); // Backlight off delay(3000); lcd.setBacklight(HIGH); // Backlight on delay(3000); }
How intersting!
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #34 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......
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #35 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
|
|
|
|
|
Logged
|
|
|
|
|
Málaga, Spain
Offline
Edison Member
Karma: 33
Posts: 2017
|
 |
« Reply #36 on: September 05, 2012, 02:13:49 pm » |
@Aaron_dyer - thanks for your comments, much appreciated. This whole thing of not publishing correct information about device addresses is a bit of a bother.
What I am pleased about is that they've linked the library in and respected the Open Source Creative Commons license! Cool.
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #37 on: September 07, 2012, 02:17:39 pm » |
FM,
Is that you in your picture for your profile? It looks like a girl I went to High school with
|
|
|
|
|
Logged
|
|
|
|
|
Málaga, Spain
Offline
Edison Member
Karma: 33
Posts: 2017
|
 |
« Reply #38 on: September 07, 2012, 02:46:28 pm » |
FM,
Is that you in your picture for your profile? It looks like a girl I went to High school with
Lets just say that the picture was taken 22 odd years ago. Lets also say that fm = fmalpartida
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #39 on: September 07, 2012, 02:58:52 pm » |
Pretty!
|
|
|
|
|
Logged
|
|
|
|
|
Málaga, Spain
Offline
Edison Member
Karma: 33
Posts: 2017
|
 |
« Reply #40 on: September 07, 2012, 03:06:12 pm » |
Pretty!
Thanks. 
|
|
|
|
« Last Edit: September 07, 2012, 04:49:53 pm by fm »
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #41 on: September 07, 2012, 04:42:34 pm » |
 you know it too
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #42 on: September 07, 2012, 05:44:12 pm » |
Ya, that was the idea, to use the SPI printouts for a GPS to interface the I2c LCD as well as our other circuitry......ill post my YouTube video of it all later today or tomorrow....
|
|
|
|
|
Logged
|
|
|
|
|
Raleigh, NC.
Offline
Full Member
Karma: 0
Posts: 129
Addicted to Arduino
|
 |
« Reply #43 on: September 07, 2012, 06:03:32 pm » |
Pinouts*
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 1
|
 |
« Reply #44 on: November 17, 2012, 03:13:15 pm » |
This whole thing of not publishing correct information about device addresses is a bit of a bother.
What I am pleased about is that they've linked the library in and respected the Open Source Creative Commons license! Cool.
Hey, Thanks for all your work and support on the library and being willing to support different devices. I have the SainSmart LCD 2004 also and was able to get mine working by following this thread. My device uses 0x27 as the address. /*---When I asked the people at Sainsmart why their code didn't work, they sent me some other documentation etc that didn't work. I don't understand how they can sell products marketed specifically at the Arduino market and not have legitimate support. ---*/ Is there a way to have a 16x2 display with address 0x20 and a 20x4 with address 0x27 on the same I2C bus and be able to differentiate them in the code??? sending each different information etc.?
|
|
|
|
|
Logged
|
|
|
|
|
|