#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
int pin13 = LOW;
byte up[8] = // ^
{
B00000,
B00100,
B00100,
B01110,
B01110,
B11111,
B11111,
B00000,
};
byte down[8] = // v
{
B00000,
B11111,
B11111,
B01110,
B01110,
B00100,
B00100,
B00000,
};
byte yes[8] =
{
B00001,
B00001,
B00010,
B00010,
B00100,
B10100,
B01000,
B01000,
};
byte no[8] =
{
B10001,
B10001,
B01010,
B00100,
B00100,
B01010,
B10001,
B10001,
};
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(2, INPUT);
attachInterrupt(0, btnIsr, FALLING);
lcd.init();
lcd.backlight();
lcd.createChar(0, up);
lcd.createChar(1, down);
lcd.createChar(2, yes);
lcd.createChar(3, no);
lcd.setCursor(0,1);
lcd.write(byte(0));
lcd.setCursor(5,1);
lcd.write(byte(1));
lcd.setCursor(10,1);
lcd.write(byte(2));
lcd.setCursor(15,1);
lcd.write(byte(3));
}
void btnIsr(){
pin13 = !pin13;
digitalWrite(13, pin13);
tone(12, 250, 250);
}
void loop()
{
// static unsigned long tmr = 0;
// if(millis() - tmr > 1000){
// tmr = millis();
// Serial.println("sec");
// }
}