louino

redstone to http request

Jul 26th, 2021
1,332
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local redstats_left
  2. local redstats_front
  3. local redstats_right
  4. local redstats_back
  5.  
  6. while true do
  7.   local event = os.pullEvent("redstone")
  8.   if rs.getInput("left") ~= redstats_left then
  9.     redstats_left = rs.getInput("left")
  10.     if redstats_left == true then
  11.       http.request("http://192.168.1.18/1/HIGH")
  12.     else
  13.       http.request("http://192.168.1.18/1/LOW")
  14.     end
  15.   end
  16.   if rs.getInput("front") ~= redstats_front then
  17.     redstats_front = rs.getInput("front")
  18.     if redstats_front == true then
  19.       http.request("http://192.168.1.18/2/HIGH")
  20.     else
  21.       http.request("http://192.168.1.18/2/LOW")
  22.     end
  23.   end
  24.   if rs.getInput("right") ~= redstats_right then
  25.     redstats_right = rs.getInput("right")
  26.     if redstats_right == true then
  27.       http.request("http://192.168.1.18/3/HIGH")
  28.     else
  29.       http.request("http://192.168.1.18/3/LOW")
  30.     end
  31.   end
  32.   if rs.getInput("back") ~= redstats_back then
  33.     redstats_back = rs.getInput("back")
  34.     if rs.getInput("back") == true then
  35.       http.request("http://192.168.1.18/4/HIGH")
  36.     else
  37.       http.request("http://192.168.1.18/4/LOW")
  38.     end
  39.   end
  40.   print("---------------")
  41.   print(redstats_left)
  42.   print(redstats_front)
  43.   print(redstats_right)
  44.   print(redstats_back)
  45. end
RAW Paste Data