I have the code shown below. The goal is to change the value of hours, minutes or seconds based on where the cursor is placed.
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
void setup() {
lcd.begin(16, 2); //format of display
}
void loop() {
int hours = 11;
int minutes = 11;
int seconds = 11;
lcd.setCursor(0,0);
lcd.print(hours);
lcd.print(":");
lcd.print(minutes);
lcd.print(":");
lcd.print(seconds);
lcd.noBlink();
delay(300);
lcd.blink();
delay(300);
if (buttons & BUTTON_RIGHT) {
move cursor right;
if(lcd.setCursor == lcd.setCursor(0,3) {
minutes += 1 }
}
I though of a way to do this. I would have three variables and print each of these out with a default value. With the use of the buttons, the user should be able to move the blinking cursor to hours, minutes or seconds, and increase or decrease the value of the variable.
I would do this by seeing what location the cursor is at. For example, if the cursor was on minutes, I would write something like if(lcd.setCursor == lcd.setCursor(0,3) or lcd.setCursor == lcd.setCursor(0,4)) { minutes += 1}.
Of course these functions don't exist, so I am wondering what I can do to move a cursor and check its position.
Thanks in advance