Week12:Output devices
Previous week |Assciment list |Next week
Preparation: Test the lcd module in arduino
Hardware testing:
I picked Hitachi HD44780U 1602 LCD module,Variable Resistor,, and . Trying to display "Hello world" message to testify the module.
Following this tutorial http://coopermaa2nd.blogspot.tw/2010/12/arduino-lab9-2x16-lcd-world.html
Connect the wire:
Arduino pin12 <-> LCD pin RS
Arduino pin11 <-> LCD pin E
Arduino pin5 <-> LCD pin DB4
Arduino pin4 <-> LCD pin DB5
Arduino pin3 <-> LCD pin DB6
Arduino pin2 <-> LCD pin DB7
Arduino 5V <-> LCD VCC
Arduino GND <-> LCD pin
Arduino GND <-> LCD R/W
Arduino GND <-> LCD VSS
Potentiometer left pin <-> Arduino GND
Potentiometer middle pin <-> LCD V0
Potentiometer right pin <-> Arduino 5V
Use the following sample code to drive the LCD display.
/*
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}
Using Attiny44 to drive LCD with Hello.LCD.44.c
connect the wire, reffer to output tutorial.
Atiny44 pin10 <-> LCD DB4
Atiny44 pin11 <-> LCD DB5
Atiny44 pin12 <-> LCD DB6
Atiny44 pin13 <-> LCD DB7
use the hello.lcd44.c sample code Download from fabacademy website to trigger LCD.
Use I2C protocol to control the LCD
In order to complete the final project, I find a I2C module that only use 2 pins to connect to the arduino board. I decide to use this module to control the LCD pannel with Analog pin4(SDA), Analog pin5(SCL), VCC and GND.
use LiquidCrystal_I2C sample codedownload from wikispaces
the sample code as fallows:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup(){
lcd.init();
lcd.backlight();
lcdprint("Hello World");
}
void loop(){
}
What I learn:
understand the character display method.
understand the lcd module operation method.
control the lcd message display and clear.
About me |
assignment |
About Final Project
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License .