/*
* 1602 LCD Sample with
ATtiny85-LCD-library-master.zip
* https://github.com/platisd/ATtiny85-LCD-library
*
* BackPack-----ATTiny85
* SDA -----PB0
* SCL -----PB2
*
* BackPack-----ATTiny84
* SDA -----PA6
* SCL -----PA4
*
* BackPack-----ATTiny861
* SDA -----PB0
* SCL -----PB2
*
* BackPack-----ATTiny4313
* SDA -----PB5
* SCL -----PB7
*/
#include <TinyWireM.h>
#include <LiquidCrystal_attiny.h>
#define i2cAddress 0x27
LiquidCrystal_I2C lcd(i2cAddress,16,2); // set the LCD
address to 0x27 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());
}
}
|