SHOW:
|
|
- or go back to the newest paste.
| 1 | - | mon = peripheral.wrap( "left" ) |
| 1 | + | readout = "Awaiting time shift." |
| 2 | - | readout = "Monitoring" |
| 2 | + | |
| 3 | - | readout2 = "Monitoring" |
| 3 | + | |
| 4 | term.clear() | |
| 5 | term.setCursorPos(1,1) | |
| 6 | end | |
| 7 | ||
| 8 | while true do | |
| 9 | sunrise = os.setAlarm(6.00) | |
| 10 | - | function rnd() --reset and display |
| 10 | + | |
| 11 | - | mon.clear() |
| 11 | + | event, input = os.pullEvent("alarm")
|
| 12 | - | mon.setCursorPos(1,1) |
| 12 | + | if input == sunrise then |
| 13 | - | clear() |
| 13 | + | |
| 14 | clear() | |
| 15 | print("lights off.")
| |
| 16 | - | print("Press Q to exit.")
|
| 16 | + | elseif input == sunset then |
| 17 | - | print(readout2) |
| 17 | + | |
| 18 | - | mon.write(readout) |
| 18 | + | clear() |
| 19 | print("lights on.")
| |
| 20 | end | |
| 21 | - | rnd() |
| 21 | + | |
| 22 | ||
| 23 | clear() |