Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time;
- String d = "Door";
- d.Open = false;
- int lockOpening = 0; // waits for the button to release before it tries to open/close the door again to prevent it getting stuck
- while (true)
- {
- X = 1.chimera;
- Signal( “Off” ; X);
- User = int(input(1 OR 0)); //Press the button
- if (lockOpening == 0) //
- {
- if (User == 1)
- {
- lockOpening = 1;
- if (d.Open == false)
- {
- d.Open = true;
- print(“Opening”);
- }
- else
- {
- d.Open = false;
- print(“Closing”);
- }
- }
- }
- else if (lockOpening == 1)
- {
- if (User == 0)
- {
- lockOpening = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment