Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("h2touchpanel")
- FLINT = 1
- LID = 2
- function on()
- turtle.select(FLINT)
- turtle.up()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(FLINT)
- turtle.place()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.down()
- end
- function off()
- turtle.select(LID)
- turtle.up()
- turtle.dig()
- turtle.place()
- turtle.down()
- end
- local btnCfg = {}
- btnCfg[1] = {name="ON", cmd=on}
- btnCfg[2] = {name="OFF", cmd=off}
- panelCfg = {topPos=2,scale=1, bgPattern={colors.blue, colors.red}}
- while true do
- sleep(1)
- local mon = peripheral.wrap("front")
- local panel = h2touchpanel.makePanel(btnCfg, 1, 2, mon, panelCfg)
- panel:draw()
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.gray)
- mon.write(string.format("%d", turtle.getFuelLevel()))
- local event, button = panel:pullButtonPushEvent()
- panel:drawPushedButtonEffect(button)
- button:evalCmd()
- end
Advertisement
Add Comment
Please, Sign In to add comment