Farming & automation

Redstone lamp

Blinks a lamp, then lights it whenever you flip the lever next to the computer.

Likes
0
Views
2
In-game installs
0

Capabilities

  • Uses redstone

Licence

MIT

startup.lua 504 bytes Raw
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
4print("Blinking the lamp...")
5for _ = 1, 3 do
6 redstone.setOutput("back", true)
7 sleep(0.5)
8 redstone.setOutput("back", false)
9 sleep(0.5)
10end
11
12print("Now flip the lever.")
13while 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")
18end

Install in your world

wget run https://ccbin.dev/i/du8w6fFh
wget https://ccbin.dev/raw/du8w6fFh startup.lua
Embed on your site
<iframe src="https://ccbin.dev/du8w6fFh/embed" width="800" height="520" style="border:0" loading="lazy" allow="autoplay" title="Redstone lamp on ccbin.dev"></iframe>

Sites that understand oEmbed, such as Discord and many forums, make the embed from the program's link.

Blinks 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.