#include <LiquidCrystal.h>
#include <TimerOne.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
volatile int myVar;
volatile byte myVar2 = 0;
const byte STEP1[8] = {
0b01110,
0b10001,
0b10001,
0b01110,
0b11111,
0b00100,
0b01010,
0b10001
};
const byte STEP2[8] = {
0b01110,
0b10001,
0b10001,
0b01110,
0b11111,
0b00100,
0b01010,
0b01010
};
const byte STEP3[8] = {
0b01110,
0b10001,
0b10001,
0b01110,
0b11111,
0b00100,
0b00100,
0b00100
};
void setup(void) {
// Timer1.initialize(1000000); // init the timing interval
Timer1.initialize(500000); // init the timing interval
//for event triggering (1s = 10-6s)
Timer1.attachInterrupt(ShowMessage); // The function is
//called at the preset time interval
lcd.begin(16, 2);
// The 2 character are stored in the CGROM, user defined
//area, pos. 0 and 1
lcd.createChar(0, STEP1);
lcd.createChar(1, STEP2);
lcd.createChar(2, STEP3);
}
void ShowMessage(void) {
//lcd.setCursor(0,0);
//lcd.print(myVar);
//myVar++;
lcd.setCursor(0,1);
lcd.write(myVar2);
myVar2++;
if (myVar2 > 2) {
myVar2 = 0;
}
}
void loop(void) {
// Do something else …
}