ODROID-GO-lib-example 16X2LCD_I2C, slight mistake?

Post Reply
aschommer
Posts: 4
Joined: Mon Feb 04, 2019 4:49 pm
languages_spoken: english, german
ODROIDs: ODROID GO
Contact:

ODROID-GO-lib-example 16X2LCD_I2C, slight mistake?

Unread post by aschommer » Thu Feb 14, 2019 6:11 pm

Hi,

I just wanted to double check a maybe broken 20x4 LCD and came across this fine example.

But in the first run i wondered that it seemed not to find the LCD: the only response (on serial) was: "Slave address : 0x0".
After reviewing the source, my first thought was: Hey, shouldn't it mention "Does not find any slave address of the LCD" four times before?

Well, i guess: no!
Because:

Code: Select all

void setup() {
    // put your setup code here, to run once:
    uint8_t lcd_addr = 0;
    uint8_t cnt = 0;

    [...]
    
    while (cnt > 4) {
        lcd_addr = getAddress();
        if (lcd_addr > 0)
            break;
        Serial.println("Does not find any slave address of the LCD");
        delay(1000);
        cnt++;
    }

    Serial.print("Slave address : 0x");
    Serial.println(lcd_addr, HEX);

}
Note: cnt is initialized as 0, but the loop body would only be entered if it was >4, i.e. not at all. (sorry: i did not get markup working within {code})

For myself, i've fixed it to

Code: Select all

while (cnt < 4) 
Now it found my display (at 0x27) but again nothing was really displayed - so i am not too confident my finding is correct.
(not to forget: i changed the display size: "lcd = new LiquidCrystal_I2C(lcd_addr, 20, 4)")

cheers,

aschommer

lsc1117
Posts: 101
Joined: Thu Aug 22, 2013 12:46 am
languages_spoken: english
Location: South Korea
Contact:

Re: ODROID-GO-lib-example 16X2LCD_I2C, slight mistake?

Unread post by lsc1117 » Wed Mar 13, 2019 10:38 am

Hi, aschommer.

You are right. The source code was wrong.
It should be "cnt < 4".

And now, It shows the "Hello, ODROID-GO" in the first line of the 16x2 LCD.
And the second line shows the battery voltage of ODROID-GO.

Can't you see anything on your 16x2 LCD?

aschommer
Posts: 4
Joined: Mon Feb 04, 2019 4:49 pm
languages_spoken: english, german
ODROIDs: ODROID GO
Contact:

Re: ODROID-GO-lib-example 16X2LCD_I2C, slight mistake?

Unread post by aschommer » Thu Mar 14, 2019 7:23 am

First: My (likely) broken LCD is not the topic here, so please don't worry.

I have just a 20x4 LCD with a little i2c interface attached (i think the display itself has a kind of parallel interface), and that i can't even get to switch on the backlight. i'm not even sure the library from this example should work, and that the i2c communication seems to work does not prove anything else.

lsc1117
Posts: 101
Joined: Thu Aug 22, 2013 12:46 am
languages_spoken: english
Location: South Korea
Contact:

Re: ODROID-GO-lib-example 16X2LCD_I2C, slight mistake?

Unread post by lsc1117 » Mon Mar 18, 2019 12:08 pm

It works well. :)
I also have a 20x4 LCD with an i2c interface attached. And When I run the same example, it shows the same behaviour.
1st line : "Hello, ODROID-GO"
2nd line : Battery: 4.20 V

Post Reply

Return to “Arduino Coding Camp”

Who is online

Users browsing this forum: No registered users and 1 guest