Redstone lamp
Blinks a lamp, then lights it whenever you flip the lever next to the computer.
| 1 | -- The computer faces north: the lamp is behind it (its back side) and the |
| 2 | -- lever is on its left. Click the lever in the world view to flip it. |
| 3 | |
| 4 | print("Blinking the lamp...") |
| 5 | for _ = 1, 3 do |
| 6 | redstone.setOutput("back", true) |
| 7 | sleep(0.5) |
| 8 | redstone.setOutput("back", false) |
| 9 | sleep(0.5) |
| 10 | end |
| 11 | |
| 12 | print("Now flip the lever.") |
| 13 | while true do |
| 14 | local on = redstone.getInput("left") |
| 15 | redstone.setOutput("back", on) |
| 16 | print(on and "Lever on: lamp lit" or "Lever off: lamp dark") |
| 17 | os.pullEvent("redstone") |
| 18 | end |
Press Run to boot a computer.
- Redstone outputs drive the lamps and wire in the world below the computers, and its levers and buttons are inputs.
Network
Every request the program makes, and how the sandbox answered it. The program's own mocks answer first. Pastebin, GitHub and ccbin downloads go through ccbin. Anything else gets a placeholder, or an error if the scene says so. Nothing else leaves your browser unless you turn on live network.
Install in your world
wget run https://ccbin.dev/i/du8w6fFhwget https://ccbin.dev/raw/du8w6fFh startup.luaBlinks a lamp, then lights it whenever you flip the lever next to the computer.
This is one of the examples in the Workbench. Run it here, or open it in the Workbench to change it.
Comments
No comments yet.
Sign in to comment.