SerLCD and C Code

Hello good people of SparkFun,

I recently upgraded to the serLCD with the Qwiic connection. It is great to be able to just plug and play.

However, I’m having trouble figuring out how to communicate with the ATmega328P over I2C with C code. I’m using wiringPi for the I2C communication. I can get the splash text to display on the serLCD with the following code.

int fd = wiringPiI2CSetup(0x72);

wiringPiI2CWriteReg8(fd, 0x7C, 0b00001000);

I think that code puts the serLCD into setting mode, which triggers the splash text.

I haven’t figured out how to display text yet. Has anyone figured this out?

Thanks,

Jarrod

Are you using this library?

https://github.com/WiringPi/WiringPi/bl … ingPiI2C.h

Thanks for the reply! I am using that library.

I think I may have just been lucky that the wiringPiI2CWriteReg8 function worked for me. I’m now using wiringPiI2CWrite, and I can change settings and display text! I’ve copied some of that code below in case it helps anyone else. I think the next step is to write a function that takes a string and sends it to the display one character at a time.

// Open I2C connection to the serLCD

int fd = wiringPiI2CSetup(0x72);

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x7C);

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x08); // software reset

delayMicroseconds(3000000); // needs more than 1 s to finish the reset

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x7C);

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x2D); // clear the serLCD

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x48); // display H

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x65); // display e

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x6C); // display l

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x6C); // display l

delayMicroseconds(500);

wiringPiI2CWrite(fd, 0x6f); // display o