
/*
Project: LCD til test
Hardware: LCD 8x2
Filename: LCD_test_8x2_standard.pde
Rev. nr.: 001
Author : Hans Erik Tjelum
Company: www.let-elektronik.dk
Date: 2011-03-31
Copyright: Copyleft
Detaljeret beskrivelse:
LCD-program til at teste et LCD
The circuit:
LCD pins:
1: GND - digital common
2: +5V - digital supply
3: Vo - LCD contrast input*
4: RS - Register Select -> Arduino pin 12
5: Enable - Active low -> GND
6: R/W - Read/Write 1=Read -> Arduino pin 11
7: D0 - Not used
8: D1 - Not used
9: D2 - Not used
10: D3 - Not used
11: D4 - Used for 4-bit mode -> Arduino pin 5
12: D5 - Used for 4-bit mode -> Arduino pin 4
13: D6 - Used for 4-bit mode -> Arduino pin 3
14: D7 - Used for 4-bit mode -> Arduino pin 2
15: LED Anode -> Arduino pin 9 (PWM)
16: LED Cathode -> GND
* 10K trimmer resistor:
ends to +5V and ground, wiper to LCD Vo
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(8, 2);
// Print a message to the LCD.
lcd.print(" LE 2011");
pinMode(9, OUTPUT);
analogWrite(9, 128);
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
analogWrite(9, 64);
delay(1000);
analogWrite(9, 255);
delay(1000);
}
Thanks alot!