Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("back")
- local hystMem = 0
- local limitLow = 50
- local limitHigh = 95
- local outputSide = "top"
- while true do
- modem.open(1)
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- modem.closeAll()
- print("energy reading was: "..message)
- local energy = message
- if energy < limitLow then
- redstone.setOutput(outputSide,false)
- hystMem = 0
- end
- if (energy >= limitLow) and (energy <= limitHigh) then
- if hystMem == 0 then redstone.setOutput(outputSide,false) end
- if hystMem == 1 then redstone.setOutput(outputSide,true) end
- end
- if energy > limitHigh then
- redstone.setOutput(outputSide,true)
- hystMem = 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment