I have simple code . I wanted to blink the cursor below "ENTER PASSWORD".once btnUP arrow being pressed changed values also need to change with blink. once btnSELECT get saved in Enter_Array[0] similar for next array element.
Question here how to blink cursor with value while editing
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
#define btnRIGHT 0 // Okay
#define btnUP 1 // inc
#define btnDOWN 2 // dec
#define btnLEFT 3 // Select
#define btnSELECT 4 // Menu
#define btnNONE 5
int adc_key_in = 0;
#define shortBeep 100
#define longBeep 500
#define beeper A1 // Alarm buzzer
int Enter_Array[4]={0};
int Password_Array[4]={1,2,3,4};
void setup()
{
Serial.begin(9600);
lcdClear();
}
void loop()
{
int button=read_LCD_buttons();
lcd.setCursor(0,0);
lcd.print("ENTER PASSWORD");
lcd.setCursor(0,1);
lcd.blink();
lcd.cursor();
//lcd.noBlink();
delay(100);
}
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
// my buttons when read are centered at these valies: 0, 131, 307, 481, 722
// we add approx 50 to those values and check to see if we are close
// No button pressed should be 1023
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
//return btnNONE; // when all others fail, return this...
}
void timedBeep(int beepTime, int beepCount)
{
for (int i = 0; i < beepCount; i ++)
{
digitalWrite(beeper, HIGH);
delay(beepTime);
digitalWrite(beeper, LOW);
delay(beepTime);
}
}
void lcdClear(){
lcd.clear();
lcd.begin(16,2);
lcd.setCursor(0,0);
}