Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("left")
- local tArgs = {...}
- --Table to define the frequency to pulse
- local Move = {
- Dig = 100,
- Down = 100,
- Up = 101,
- West = 102,
- North = 103,
- East = 104,
- South = 105}
- --Movement frequency set and redstone signal
- function Motor(a)
- m.setFreq(a)
- redstone.setOutput("left", true)
- sleep(2)
- redstone.setOutput("left", false)
- sleep(2)
- end
- --Dig down and reset to original height based on input
- function Dig(a)
- for i = 1, a do
- Motor(Move[Dig])
- end
- for i = 1, a do
- Motor(Move[Up])
- end
- end
- --Main Program
- if tArgs[1] == Dig then
- Dig(tArgs[2])
- else
- for i = 1, tArgs[2] do
- Motor(Move[tArgs[1]])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement