Quote:
Has anyone found a LCD library that works with this module? Arduino 1.0.1 is preferred environment.
SerialLCD library created for i2c, SPI and RS232 (UART) interfaces:
https://github.com/downloads/nkcelectronics/SerialLCD/SerialLCD.zipExample sketch to use the library:
Code:
/*
NKC Electronics serial display - Custom Characters
Demonstrates how to add custom characters on an LCD display.
This sketch prints "I <heart> Arduino!" and a little dancing man
to the LCD.
The circuit:
* LCD SCL pin to Arduino SCL pin or Analog 5
* LCD SDA pin to Arduino SDA pin or Analog 4
* LCD VSS pin to GND
* LCD VDD pin to +5V
Based on the original CustomCharacter example from Arduino
*/
#include <SerialLCD.h>
#include <Wire.h>
// make some custom characters:
byte heart[8] = {
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000
};
byte smiley[8] = {
0b00000,
0b00000,
0b01010,
0b00000,
0b00000,
0b10001,
0b01110,
0b00000
};
byte frownie[8] = {
0b00000,
0b00000,
0b01010,
0b00000,
0b00000,
0b00000,
0b01110,
0b10001
};
byte armsDown[8] = {
0b00100,
0b01010,
0b00100,
0b00100,
0b01110,
0b10101,
0b00100,
0b01010
};
byte armsUp[8] = {
0b00100,
0b01010,
0b00100,
0b10101,
0b01110,
0b00100,
0b00100,
0b01010
};
// Constructor. Parameters: rows, columns, baud/i2c_address, interface (RS232, I2C, SPI)
SerialLCD lcd(2,16,0x28,I2C);
void setup() {
// Initialize LCD module
lcd.init();
// create a new character
lcd.createChar(0, heart);
// create a new character
lcd.createChar(1, smiley);
// create a new character
lcd.createChar(2, frownie);
// create a new character
lcd.createChar(3, armsDown);
// create a new character
lcd.createChar(4, armsUp);
// Set Contrast
lcd.setContrast(40);
// Set Backlight
lcd.setBacklightBrightness(8);
lcd.home();
lcd.displayVersion();
delay(2000);
lcd.clear();
lcd.displayBaudRate();
delay(2000);
lcd.clear();
lcd.displayI2CAddress();
delay(2000);
lcd.clear();
// Write some text to the display
lcd.home();
lcd.print("I ");
lcd.write((byte)0);
lcd.print(" Arduino! ");
lcd.write(1);
}
void loop() {
// read the potentiometer on A0:
int sensorReading = analogRead(A0);
// map the result to 200 - 1000:
int delayTime = map(sensorReading, 0, 1023, 200, 1000);
// set the cursor to the bottom row, 5th position:
lcd.setCursor(2, 5);
// draw the little man, arms down:
lcd.write(3);
delay(delayTime);
lcd.setCursor(2, 5);
// draw him arms up:
lcd.write(4);
delay(delayTime);
}