I'm having problem to use button to change a certain values, variables. I want to have a button to change the value (by adding 10 to it everytime someone push the button) and a button to validate their choice (push_button3). The user can change the value as long as possible. My code looks like this but it doesn't seem to work yet, so any help is appreciated, thanks in advance:
const int pushButton = 2 ;
const int pushButton1 = 3 ;
const int pushButton3 = 5 ;
int celsius_infu = 50 ;
int i = 0;
void setup() {
// put your setup code here, to run once:
pinMode(pushButton , INPUT);
pinMode(pushButton1 , INPUT);
pinMode(pushButton3 , INPUT);
Serial.begin (9600);
}
void loop() {
int button_on = digitalRead(pushButton);
int button_on1 = digitalRead(pushButton1);
int button_on3 = digitalRead(pushButton3);
if (button_on == HIGH ) {
Serial.print("Enter temperature");
Serial.print(celsius_infu);
while (i == 0){
if (button_on1 == HIGH ) {
celsius_infu = celsius_infu + 10 ;
if (celsius_infu=100){
celsius_infu=50 ;
}
Serial.print(celsius_infu);
if (button_on3 == HIGH) {
i = 1 ;
}