Possible bug, Push buttons turning on then off rather than staying on when pressed

Hey there.

I'm having some trouble. I'm trying to program the buttons in my app to send 1 value when pressed and another when released. It triggers a switch state on an arduino uno r3 via bluetooth. But it just toggles it on for a second then off again. Below is my logic. I've seen some people have this working, im wondering if it is a bug or something I did Wrong.

case 'A': button1State = HIGH; break;
case 'B': button1State = LOW; break;
case 'C': button2State = HIGH; break;
case 'D': button2State = LOW; break;
case 'E': button3State = HIGH; break;
case 'F': button3State = LOW; break;
case 'G': button4State = HIGH; break;
case 'H': button4State = LOW; break;
case 'I': button5State = HIGH; break;
case 'J': button5State = LOW; break;

Any help would be greatly appreciated

What are you expecting to happen with the touch down and touch up events for a button.

If we take the DUMP button, youare sending the letter I (i) on Touch Down and the letter J on touch up.

Is this not what you want?

Or do you want a toggle button, so if your press a button the first time it sends one letter, then if you press it again it sends another letter ? Another press would send the first letter again, and so on.

1 Like

Ah, I'm so sorry. I didn't do my switch case properly on the arduino. Problem resolved.