// include the library code:
#include
<tinySPI.h>
//http://github.com/JChristensen/tinySPI
#include <ShiftLCD_SPI.h>
// initialize the library with the numbers of the
interface pins
// SerialDataIn, ShiftClock, LatchClock
//ShiftLCD lcd(2, 4, 3);
#if defined(__AVR_ATtiny44__) ||
defined(__AVR_ATtiny84__)
ShiftLCD lcd(5, 6, 3); // DO, USCL, SS
#elif defined(__AVR_ATtiny45__) ||
defined(__AVR_ATtiny85__)
ShiftLCD lcd(1, 2, 3); // DO, USCL, SS
#elif defined(__AVR_ATtiny461__) ||
defined(__AVR_ATtiny861__)
ShiftLCD lcd(8, 7, 3); // DO, USCL, SS
#elif defined(__AVR_ATtiny2313__) ||
defined(__AVR_ATtiny4313__)
ShiftLCD lcd(15, 16, 3); // DO, USCL, SS
#endif
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
}
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());
}
}
|