Hi, fairly new to the world of coding and Arduino.
Have been messing around with this piece of code for hours and cannot figure out why it wont break when # is pressed on the keypad.
if(key == 'B'){
keyB = true;
while(keyB=true){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Power generated:");
lcd.print(power2);
lcd.setCursor(0,1);
lcd.print("Power needed:");
lcd.print(load);
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Power used:");
lcd.setCursor(0,1);
lcd.print("Power deficit:");
delay(2000);
if(key == '#'){
keyB=false;
break;
}
}
}
Its probably something simple, but I cannot pick it. Any help would be appreciated.
Cheers