Advertisement
DerMarten

Licht

Jul 19th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("back")
  3. m.clear()
  4. lichtRsSide = "left"
  5. lichtBool = false
  6. --------------------------------
  7. function fillTable()
  8. button.setTable("Licht", licht, 3, 13, 3, 5)
  9. button.screen()
  10. end
  11.  
  12. function getClickt()
  13. event, side,x,y = os.pullEvent("monitor_touch")
  14. button.checkxy(x,y)
  15. end
  16. function licht()
  17. button.toggleButton("Licht")
  18. write("Tag: ")
  19. write(os.day())
  20. write(" - Zeit: ")
  21. write(os.time())
  22. write(" - ")
  23. if lichtBool == false then
  24. rs.setOutput(lichtRsSide, true)
  25. lichtBool = true
  26. print("Licht an")
  27. else
  28. rs.setOutput(lichtRsSide, false)
  29. lichtBool = false
  30. print("Licht aus")
  31. end
  32. end
  33. ----------------------------------
  34. fillTable()
  35. button.heading("Haus Steuerung")
  36. --button.label(4,7,"Nicht angeschlossen")
  37. while true do
  38. getClickt()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement