The LCD2004 driver for LCDs drives a classic 2x16 or 4x20 display with HD44789 chipset via an I2C encoder on its back connected to the Builder Base. The display has separate backlight pins which can be jumped to light up the background of the display. It also has a pin to connect a contrast potentiometer on its back to adjust the contrast value.
The LCD2004 driver for LCDs has two parameters that need to be configured:
This is the address the device is being referenced by on the I2C bus. The LCD2004 can have an address of 0x3f or between 0x20 and 0x27. If the I2C adapter in the back of the display has solder points, then these determine the address between 0x20 and 0x27. Otherwise the address of the display is 0x3f. The default for this parameter is 0x3f.
This is the selection of the display layout. The options here are the 2x16 or the 4x20 version.
The SDA and SCL, and GND pins are connected between the Builder Base and the back fo the display, as well as the VCC and 5V pins.
Serial Data Line
Serial Clock Line
This pin provides the power
This pin provides the GND
How to write an App
Navigate to the App Builder and create a new application. You can find the “LCD” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.
Drag the “LCD” object onto the canvas.
Next, located under the interface tab find the “Button” and “Input Text” objects, and drag two “Button” objects and one “Input Text” object onto the canvas.
Finally, connect Text port form the “Input Text” object to the String port on the “LCD” object. Next, connect a State port from one of the “Button” objects to the Send to Display port on the LCD object, and connect the State port from the other “Button” object to the Clear port on the “LCD” object.
Finally, you may label your objects and save your application.
How to create a firmware
Navigate to the Firmware Builder and create a new firmware file.
Click the “+ Add Hardware” button which will open a modal window. Scroll down in the list to find the “Display” section and select the “LCD” hardware option.
Give your device a name, and click “Add Hardware”
Next, select the “HD44780 2 x 16 Display” driver under the driver dropdown menu.
For this example we select:
I2C Address: 0x3f
You may now save your firmware file and upload it to one of your clients.