Hi Bob thanks
to answer the questions above if butChange is high it should move a blinking cursor 1 space to the left (but its going twice)
and lines of code will be executed whatever the state of butChange will ask for another button input to change that character
here is the rest of the code to show what i mean.
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonChange = 9;
const int buttonDigit = 6;
const int buttonEnter = 7;
const int buttonPause = 8;
int butChangeCounter = 11;
int butChange = 0;
int butChangeLBS = 0;
int butDigit = 0;
int butDigitCounter = 0;
int butDigitLBS = 0;
int butEnter = 0;
int butEnterLBS = 0;
int butPause = 0;
int butPauseLBS = 0;
int ua = 0;
int ub = 0;
int uc = 0;
int ud = 0;
int ue = 0;
int uf = 0;
int ug = 0;
int uh = 0;
int la = 0;
int lb = 0;
int lc = 0;
int ld = 0;
int le = 0;
int lf = 0;
int lg = 0;
int lh = 0;
void setup() {
pinMode(buttonChange, INPUT);
// pinMode(buttonDigit, INPUT);
// pinMode(buttonEnter, INPUT);
// pinMode(buttonPause, INPUT);
Serial.begin(9600);
// set up the LCD number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(" Batch counter");
lcd.setCursor(0, 1);
lcd.print(" V1.0");
delay(1000);
lcd.clear();
//sets display for eight 0's upper display and eight 0' for lower display:
// upper display settings:
lcd.setCursor(4, 0);
lcd.print (ua);
lcd.setCursor(5, 0);
lcd.print (ub);
lcd.setCursor(6, 0);
lcd.print (uc);
lcd.setCursor(7, 0);
lcd.print (ud);
lcd.setCursor(8, 0);
lcd.print (ue);
lcd.setCursor(9, 0);
lcd.print (uf);
lcd.setCursor(10, 0);
lcd.print(ug);
lcd.setCursor(11, 0);
lcd.print(uh);
lower display settings:
lcd.setCursor(4, 1);
lcd.print (la);
lcd.setCursor(5, 1);
lcd.print (lb);
lcd.setCursor(6, 1);
lcd.print (lc);
lcd.setCursor(7, 1);
lcd.print (ld);
lcd.setCursor(8, 1);
lcd.print (le);
lcd.setCursor(9, 1);
lcd.print (lf);
lcd.setCursor(10, 1);
lcd.print(lg);
lcd.setCursor(11, 1);
lcd.print(lh);
lcd.setCursor(11, 1);
lcd.blink();
}
void loop() {
// read the state of the pushbutton value:
butChange = digitalRead(buttonChange);
//butDigit = digitalRead(buttonDigit);
//butEnter = digitalRead(buttonEnter);
//butPause = digitalRead(buttonPause);
if (butChange != butChangeLBS) {
if (butChange == HIGH)
delay(50);
lcd.blink();
delay(50);
{
(butChangeCounter--);
lcd.setCursor(butChangeCounter , 1);
if (butChangeCounter <= 3) {
butChangeCounter = 11;
}
lcd.blink();
delay(50);
}
butChangeLBS = butChange;
}
}
// moves cursor on lower display to input a number at a desired location:
// Change digit value on position 11 lower display
if (butChangeCounter != butChangeCounterLBS) {
if ((butChangeCounter = 11) && (butDigit == HIGH)) {
(butDigit = lh + 1);
if (lh > 9)
lh = 0;
}
lcd.blink();
delay(50);
}
// Change digit value on position 10 lower display
// moves cursor on lower display to input a number at a desired location:
// Change digit value on position 10 lower display
if (butDigit != butDigitLBS) {
if ((butChangeCounter = 10) && (butDigit == HIGH))
(butDigit = lg++);
//if (butDigit == HIGH){
if (lg > 9)
lg = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 9 lower display
if ((butChangeCounter = 9) && (butDigit == HIGH)) (butDigit = lf++); {
// if (butDigit == HIGH){
if (lf > 9)
lf = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 8 lower display
if ((butChangeCounter = 8) && (butDigit == HIGH)) {
// if (butdigit == HIGH){
(butDigit = le++);
if (le > 9)
le = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 7 lower display
if ((butChangeCounter = 7) && (butDigit == HIGH)) {
// if (butDigit == HIGH){
(butDigit = ld++);
if (ld > 9)
ld = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 6 lower display
if ((butChangeCounter = 6) && (butDigit == HIGH)) {
// if (buttonState2 == HIGH){
(butDigit = lc++);
if (lc > 9)
lc = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 5 lower display
if ((butChangeCounter = 5) && (butDigit == HIGH)) (butDigit = lb++); {
// if (butDigit == HIGH){
if (lb > 9)
lb = 0;
delay(50);
lcd.blink();
delay(50);
}
// Change digit value on position 4 lower display
if ((butChangeCounter = 4) && (butDigit == HIGH)) {
//if (buttonState2 == HIGH){
(butDigit = la++);
if (la > 9)
la = 0;
delay(50);
lcd.blink();
delay(50);
}
}
}