/*
* 1602 LCD Sample with LiquidCrystal_I2C_85V1.zip
*
http://playground.arduino.cc/uploads/Code/LiquidCrystal_I2C_85V1.zip
*
* PCF8574-----1602LCD-----TINY
*
A0
-----GRD
*
A1
-----GRD
*
A2
-----GRD
* P0 ----- D4
* P1 ----- D5
* P2 ----- D6
* P3 ----- D7
*
VSS
-----GRD
* P4 ----- EN
* P5 ----- RW
* P6 ----- RS
* P7 ----- N/C
*
VDD
-----5V
*
* PCF8574-----1602LCD-----ATTiny85
*
SDA
-----PB0
*
SCL
-----PB2
*
* PCF8574-----1602LCD-----ATTiny84
*
SDA
-----PA6
*
SCL
-----PA4
*
* PCF8574-----1602LCD-----ATTiny861
*
SDA
-----PB0
*
SCL
-----PB2
*
* PCF8574-----1602LCD-----ATTiny4313
*
SDA
-----PB5
*
SCL
-----PB7
*/
#include <TinyWireM.h>
#include <LiquidCrystal_I2C.h>
#define i2cAddress 0x20
LiquidCrystal_I2C lcd(i2cAddress,16,2); // set the LCD
address to 0x20 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
}
void loop()
{
static int number=0;
char buf[21];
if (number < 100) {
lcd.setCursor(0, 0);
// Print a message to the LCD.
sprintf(buf,"Hello, World
%03d!",number++);
lcd.print(buf);
// 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());
}
}
|