I will use a stepper motor for a curtain, so when the motor opens the curtain by pressing button 1, I want that button to be disabled because if I press it again, it will rotate again in the same way and will break my things.
Button 1- Open the curtain by rotating right -> Disable Button 1 -> Enable Button 2.
Button 2- Close the curtain by rotating left -> Disable Button 2 -> Enable Button 1
My code:
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
switch(results.value)
{
case Button1: // Right button pressed
//Motor CODE
break;
case Button2: // Left button pressed
//Motor CODE
break;
Sorry but I don’t get that. What rightButtonPressed and leftButtonPressed should be?
In my code, Button1 = 0xFF6897 and Button2= 0xFF30CF. I need somehow to disable case 0xFF6897 after it’s pressed, enabling 2nd case option, and by pressing 2nd vice versa.