So I want to know how to create a toggle-type code that could make the R1 set the digiout to low and then with the press of R1 again set the digilow to high. I am doing this in blocks aswell, I don’t know how to code this in or if itd be possible, any help would be aprriciated!
Hopefully the “code” below works
set DigitalOutH to high;
if (DigitalOutH is high and R1 is pressed) {
set DigitalOutH to low;
}
if (DigitalOutH is low and R1 is pressed) {
set DigitalOutH to high;
}
I didn’t know that blocks had enums
1 Like
You could use a variable to track the state of the piston and run an if/else checking that variable when the button is pressed.