I posted the core on Bluebie's awesome tricks (http://digistump.com/wiki/digispark/tricks) page, here's the complete LCD valentine:
/* ATtiny85 as an I2C Master Ex2 BroHogan 1/21/11
* Modified for Digistump - Digispark LCD Shield by Erik Kettenburg 11/2012
* Modified for debugging and Valentine's day by bjh 14 Feb 2013
* Added debug macros
* SETUP:
* ATtiny Pin 1 = (RESET) N/U ATtiny Pin 2 = (D3) N/U
* ATtiny Pin 3 = (D4) to LED1 ATtiny Pin 4 = GND
* ATtiny Pin 5 = SDA on DS1621 & GPIO ATtiny Pin 6 = (D1) to LED2
* ATtiny Pin 7 = SCK on DS1621 & GPIO ATtiny Pin 8 = VCC (2.7-5.5V)
* NOTE! - It's very important to use pullups on the SDA & SCL lines!
* PCA8574A GPIO was used wired per instructions in "info" folder in the LiquidCrystal_I2C lib.
* This ex assumes A0-A2 are set HIGH for an addeess of 0x3F
* LiquidCrystal_I2C lib was modified for ATtiny - on Playground with TinyWireM lib.
* TinyWireM USAGE & CREDITS: - see TinyWireM.h
*/
#include <TinyWireM.h> // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos
#include <LiquidCrystal_I2C.h> // for LCD w/ GPIO MODIFIED for the ATtiny85
#define GPIO_ADDR 0x27 // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules.
LiquidCrystal_I2C lcd(GPIO_ADDR,16,2); // set address & 16 chars / 2 lines
// 0: Binary sketch size: 1,790 bytes (of a 6,010 byte maximum)
// 1: Binary sketch size: 2,114 bytes (of a 6,010 byte maximum)
#define DEBUG 0 // Set to 1 to enable, 0 to disable
#if DEBUG
#define DebugPin 1 // Digispark model A onboard LED
#define DebugBlink 75
#define DebugPause 300
#define debugDelay(ms) delay(ms) // Change if you need a special delay function (e.g. if you use libraries that need regular refresh calls)
void _debugBlink(int n) {
for ( int i = 0 ; i < n ; i++ ) {
digitalWrite(DebugPin, HIGH);
debugDelay(DebugBlink);
digitalWrite(DebugPin, LOW);
debugDelay(DebugBlink);
}
debugDelay(DebugPause);
}
void _debugSetup() {
pinMode(DebugPin, OUTPUT);
}
#define debugBlink(n) _debugBlink(n) // Do the blink when DEBUG is set
#define debugSetup() _debugSetup()
#else
#define debugBlink(n) // Make the calls disappear when DEBUG is 0
#define debugSetup()
#endif
void setup() {
debugSetup();
debugBlink(1);
TinyWireM.begin();
debugBlink(2);
lcd.init();
debugBlink(3);
lcd.backlight();
debugBlink(4);
// |0--------9------| // "ruler" for the 16 char LCD lines
lcd.print(" I love you!!!!");
lcd.setCursor(0,1);
lcd.print("<B @>-'-,-- <B");
debugBlink(5);
}
void loop() {
delay(500);
debugBlink(1);
}