Electronic Brick : BUS
Most of the sensor and switch are a single line for signal. There is some other module need more than one signal line, so we need the bus connection.
The 1602LCD module have 16 pins, there are 5 power pins and 11 signal pins. To control the 1602LCD module at least 10 pins, so we need a bus to connect it to Arduino.
Connect the 1602LCD Brick with the 10pins cable to the BUS2 connector of Chassis. And put the power switch to ‘On’.
We can use the library for Liquid Crystal to control the LCD easily. This library allows an Arduino board to control Liquid Crystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4- or 8-bit mode.
Library Function:
LiquidCrystal() Creates a variable of type Liquid Crystal.
Syntax: LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)
clear() Clears the LCD screen and positions the cursor in the upper-left corner.
home() Positions the cursor in the upper-left of the LCD. That is, use that location in outputting subsequent text to the display. To also clear the display, use the clear() function instead.
setCursor() Position the LCD cursor; that is, set the location at which subsequent text written to the LCD will be displayed.
Syntax: lcd.setCursor(col, row)
write() Write a character to the LCD.
Syntax: lcd.write(data)
print() Prints text to the LCD.
Syntax: lcd.print(data)
lcd.print(data, BASE) (BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16).)
#include <LiquidCrystal.h> // include a library headfile // LiquidCrystal display with: // rs on pin 10 // rw on pin 11 // enable on pin 12 // d4, d5, d6, d7 on pins 13, 14, 15, 16 LiquidCrystal lcd(10, 11, 12, 13, 14, 15, 16);
void setup() { lcd.clear();//clears the LCD and positions the cursor in the upper-left corner lcd.print("hello, world!");// Print a message to the LCD. lcd.setCursor(2,1); // set to the 3th column and 2nd row lcd.print("Seeedstudio");// Print a message to the LCD. }
void loop() { }
More information about the LCE1602 and Library is here:
http://www.seeedstudio.com/depot/lcd-162-characters-green-yellow-back-light-p-62.html
http://arduino.cc/en/Reference/LiquidCrystal
You both are right. It worked for mi with LiquidCrystal lcd(10,11,12,13, A0, A1, A2);
But the background was too dark so I solved that with Fabio’s answer. I needed to put lcd.begin(16,2) to solve the rest of problems I had.
I’ve got an Arduino Mega 2560 and Electronic Brick Starter Kit.
Hope some day this error will be officially fixed.
Pau
The above code has an error. It’s necessary to add this line to work correctly:
lcd.begin(16, 2);
before the line lcd.clear();
Question on the pin outs above? The Shield page labels the pins differently on bus 2 (http://www.seeedstudio.com/depot/electronic-brick-chassis-v11-p-460.html )
That pages says it is (d10, d11, d12, d13, a0, a1, a2, a3) Am i confused or is a0 also d14, and so one?