Advertisement
CdoubleOK

Fuel Control

Apr 10th, 2023 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local modem = peripheral.find("modem")
  2. local monitor = peripheral.wrap("front")
  3.  
  4. monitor.clear()
  5. monitor.setCursorPos(1,1)
  6. monitor.setTextScale(0.5)
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("Running...")
  10.  
  11. function fuelFeed(side, mode, bgc, tc)
  12.   rs.setOutput(side, true)
  13.   modem.transmit(3,4,mode)
  14.   monitor.setCursorPos(1,1)
  15.   monitor.clear()
  16.   monitor.setTextColor(tc)
  17.   monitor.setBackgroundColor(bgc)
  18.   monitor.setCursorPos(8, 4)
  19.   monitor.write("Automated Fuel Control")
  20.   monitor.setCursorPos(8, 5)
  21.   monitor.write("-=-=-=-=-=-=-=-=-=-=-=-")
  22.   monitor.setCursorPos(8, 6)
  23.   monitor.write(mode)
  24.   sleep(1)
  25.   rs.setOutput(side, false)
  26. end
  27.  
  28. function standBy(mode, bgc, tc)
  29.   modem.transmit(3,4,mode)
  30.   monitor.setCursorPos(1,1)
  31.   monitor.clear()
  32.   monitor.setTextColor(tc)
  33.   monitor.setBackgroundColor(bgc)
  34.   monitor.setCursorPos(8, 4)
  35.   monitor.write("Automated Fuel Control")
  36.   monitor.setCursorPos(8, 5)
  37.   monitor.write("-=-=-=-=-=-=-=-=-=-=-=-")
  38.   monitor.setCursorPos(8, 6)
  39.   monitor.write(mode)
  40. end
  41.  
  42. while rs.getInput("front") == false
  43. do
  44.  
  45. local batt = rs.getInput("right")
  46.  
  47. if batt <= 3
  48. then
  49. fuelFeed("left", "Feed Online", colors.green, colors.white)
  50. sleep(180)
  51. end
  52.  
  53. if batt >= 4
  54. then
  55. standBy("Feed Offline", colors.yellow, colors.black)
  56. end
  57.  
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement