#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
int seg[]={12,14,27,26,25,33,32};//a~g
int tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67};
unsigned time_current;
int t1;
int i,j,k,s,t,f;
void setup() {
for(j=0;j<7;j++)
{
pinMode(seg[j], OUTPUT);
digitalWrite(seg[j], HIGH);
}
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
// Print a message on both lines of the LCD.
lcd.setCursor(2,0); //Set cursor to character 2 on line 0
lcd.print("Hello world!");
lcd.setCursor(2,1); //Move cursor to character 2 on line 1
lcd.print("LCD Tutorial");
}
void display(int a)
{
for(i=0;i<7;i++)
{
if(a%2==0)
{
digitalWrite(seg[i], HIGH);
}
else
{
digitalWrite(seg[i], LOW);
}
a=a/2;
}
}
void loop()
{
//lcd.setCursor(2,0);
time_current=millis();
if((time_current-t1)>500)
{
t1=time_current;
k++;
if(k>9)k=0;
}
display(tab[k]);
}