An archive of community.esquilo.io as of Saturday January 26, 2019.

How to use PCA9633 & JHD1214 at same time

triste

Any solution? I would like to have a display screen with sentences and backlight rgb shown up together.

patrick

They're both used in the Grove RGB LCD demo, here:

triste

Thank you so much! smile

triste

1 more question, how to display 2 decimal places only if there are 4 decimals?

patrick

The String library format supports standard printf formatting:

http://www.esquilo.io/docs/#squirrel-library-string

Here's a simple example:

require("string");
print(format("%1.2f\n", 0.1234));
0.12

And here's an example with the RGB LCD:

require("string");

// Import the RGB and LCD drivers for the chips the Grove board uses
dofile("sd:/lib/displays/PCA9633/PCA9633.nut");
dofile("sd:/lib/displays/JHD1214/JHD1214.nut");

i2c <- I2C(0);

led <- PCA9633(i2c, 0x62);
led.on()
led.setColor(0x039deb);

lcd <- JHD1214(i2c, 0x3E);
lcd.write("Hello IoT!");

lcd.write(format(" %1.2f", 0.1234));