Advertisement
RedbanditDEV

elevatorController

Mar 18th, 2023 (edited)
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | Gaming | 0 0
  1. --Hello public paste viewers! I am making an elevator controller for create
  2. local speaker = peripheral.find("speaker")
  3.  
  4. --Arrived at floor: bell, 1, 0
  5. --Travelling: bell, 1, 24
  6.  
  7. local floor = 0
  8. local targetFloor = 11
  9. while floor ~= targetFloor do
  10.     if floor < targetFloor then floor = floor + 1 end
  11.     if floor > targetFloor then floor = floor - 1 end
  12.     if floor ~= targetFloor then speaker.playNote("bell", 3, 24) else speaker.playNote("bell", 3, 0) end
  13.     os.sleep(0.5)
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement