Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Setup
- local modem = peripheral.wrap("back")
- local capacitorSide = "right"
- local cellType = 1 --basic,normal,vibrant
- local cells = 2
- local txChannel = 1400
- local rxChannel = 1410
- local production = "coal" --Where RF come from
- --Variables
- local cellsCapacities = {1000000,5000000,25000000}
- local cellCapacity = (cellsCapacities[cellType]) * (cells)
- local capacitor_1 = peripheral.wrap(capacitorSide)
- local energyLevelOld = 0
- local typeOf = "capacitor"
- while true do
- --Get the capacitor datas
- energyLevel = capacitor_1.getEnergyStored()
- energyLevel = (energyLevel) * (cells)
- term.clear()
- print("Current energy storage is "..energyLevel.." RF")
- print("capacity "..cellCapacity .." RF")
- if energyLevel ~= energyLevelOld then
- --prepare datas for sending to control room
- data = {production,typeOf,cellCapacity,energyLevel}
- --Sending to control room
- modem.transmit(txChannel,rxChannel,textutils.serialize(data))
- energyLevelOld = energyLevel
- end
- sleep(math.random(0,10))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement