#include <LiquidCrystal_I2C.h>
#include "AgriKeyManager.h"
LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x3F for a 16 chars and 2 line display
uint8_t char_key_OFF[8] = { 0x00, 0x0e, 0x04, 0x04, 0x0e, 0x0e, 0x00, 0x00 };
uint8_t char_key_ON[8] = { 0x00, 0x00, 0x00, 0x0e, 0x04, 0x04, 0x0e, 0x0e };
AgriKeyManager keyMngr(7, 6, 5);
const int buttonPin_A = 7; // the number of the pushbutton A pin
const int buttonPin_B = 6; // the number of the pushbutton B pin
const int buttonPin_C = 5; // the number of the pushbutton C pin
const int ledPin = 13; // the number of the LED pin
void setup() {
// put your setup code here, to run once:
delay(100);
Serial.begin(9600);
Serial.println("AgriKeyManager");
pinMode(ledPin, OUTPUT);
lcd.init();
lcd.clear();
lcd.createChar(0, char_key_OFF);
lcd.createChar(1, char_key_ON);
lcd.backlight();
keyMngr.debug();
}
void loop() {
uint8_t tmp = keyMngr.read();
Serial.print("keyMngr.read():");
Serial.println(tmp);
lcd.setCursor(17, 0);
lcd.print((char)keyMngr.readBtnA());
lcd.print((char)keyMngr.readBtnB());
lcd.print((char)keyMngr.readBtnC());
//Serial.print("NO_ACTIVE_KEYS ");
//Serial.println(NO_ACTIVE_KEYS);
if (tmp != NO_ACTIVE_KEYS)
{
// Serial.println("Go Menù");
}
delay(300);
}