9551

manual cable switch

Jun 18th, 2021 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. --- manual cable switch by elektrobom1---
  2. local cable = "back"
  3. local cables = {
  4.     colors.white,
  5.     colors.orange,
  6.     colors.yellow
  7. }
  8. -----------------------------------------
  9. local b = require("button")
  10. local ffs = {}
  11. for i = 1, #cables do
  12.     ffs[i] = false
  13. end
  14. local function ff(num)
  15.     ffs[num] = not ffs[num]
  16. end
  17. while true do
  18.     local rec = tonumber(read())
  19.     if type(rec) == "number" and rec <= #cables then
  20.         ff(rec)
  21.         b.bundle(side, cables[rec], ffs[rec])
  22.     end
  23. end
Add Comment
Please, Sign In to add comment