Advertisement
kinderrs

Immersive Engineering Capacitor Monitoring

Dec 5th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. -- All of these are capactitors hooked up to the deisel
  2. -- generator from immersive engineering, one for each
  3. -- output post provided.  Then, each capacitor is hooked to
  4. -- a computer with a wired modem and network cable running
  5. -- this program.  
  6.  
  7. -- Written for Forgecraft the Modpack 1.1.1 (minecraft 1.7.10)
  8.  
  9. -- it's best to verify the names of the caps in the interactive
  10. -- lua shell with the command:
  11. --     peripheral.getNames()
  12.  
  13. leg1,leg2,leg3 = nil
  14. modem = peripheral.wrap("top")
  15.  
  16. modem.open(3)
  17.  
  18. samplingTimer = os.startTimer(1)
  19. while true do
  20.   event = os.pullEvent()
  21.   if event == "timer" then
  22.     leg1 = peripheral.call("immersiveengineering_capacitorhv_1","getStoredEnergy")
  23.     leg2 = peripheral.call("immersiveengineering_capacitorhv_2","getStoredEnergy")
  24.     leg3 = peripheral.call("immersiveengineering_capacitorhv_3","getStoredEnergy")
  25.     -- I listen for the capacitor readings on another computer so I string them together
  26.     -- and put them on the network (space delimited)
  27.     modem.transmit(3,3,leg1.." "..leg2.." "..leg3)
  28.  
  29.     --Then we set another timer and do it again in 1 second
  30.     samplingTimer = os.startTimer(1)
  31.   end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement