This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MuttiMatti's profile picture

Amount of inputs connected to a 7 segment display

Started by MuttiMatti, 25 September 2012 - 12:08 PM
MuttiMatti #1
Posted 25 September 2012 - 02:08 PM
I have 8 nuclear reaktors in my Technic SP world, each one of them turn on with a toggle button, what i am trying to do it have a 7 segment display show me the amount of reactors turned ON at all times , using bundled cabbles so i need 8 inputs ( When no input is on it will display 0) into the computer that will turn the amount of inputs on to an output, i know how to make it so when an output comes from the computer they will turn on or off certain segments but if someone would help me with connecting the inputs to the outpust via computer i'd appreciate it.
Doyle3694 #2
Posted 25 September 2012 - 02:33 PM
send rednet messages? like:

local reactorsOn
rednet.open()
while true do
senderID, message, distance = rednet.receive()
if message = "1" then
reactorsOn = reactorsOn + 1
end
if message = "0" then
reactorsOn = reactorsOn - 1
end
I can't come up with 7 segment display off the top of my head, sure I could figure it out if I thought about it for a bit more time

Then the other computers would have:

local ReactorStatus = "0"
local KeyPress = 0
local RecieveComputerID = 1

rednet.open()

while true do
KeyPress = os.pullEvent("key")
if KeyPress == 2 then
ReactorStatus = "1"
end
if KeyPress == 11 then
ReactorStatus = "0"
end

rednet.send(ReceiveComputerID, ReactorStatus)
endd
MuttiMatti #3
Posted 25 September 2012 - 03:43 PM
How does this code work, basicly what i meant to ask is if it's possible to do what this here says V
  • The amount of reactors on (they all have their own color in the bundled cable)
  • the amount of reactors on is amount of colours turning on in the Computer ( 5 reactors on means the computer says 5 reactors on and turns output 5 on)
  • Each output will put different number on ( I know how to do this part)
Basicly it should turn outputs 1 - 8 on depending on how many inputs are on.


Reactors =========Computer=====(Circuit for each output)===7 Segment Display
Doyle3694 #4
Posted 25 September 2012 - 05:01 PM
hmmm… that one was to recieve and send if reactors is on, I can get crackin' on that one straight away than :P/>/>
Doyle3694 #5
Posted 25 September 2012 - 05:43 PM
Can you have one computer at each reactor that you can simply go into and press "1" or "0" to turn on or off? it would simplify the code alot. then have from those rednet signals?
MuttiMatti #6
Posted 25 September 2012 - 06:02 PM
Can't you take the input from the bundled cable? Like my system is all on 1 bundled cable, monitoring for each reactors heat and the MFSU it supplies, and the cooling system for each reactor, you can take the input from the bundled cable?
  • Reactor 1 = White
  • Reactor 2 = Orange
  • Reactor 3 = Magenta
  • Reactor 4 = Light Blue
  • Reactor 5 = Yellow
  • Reactor 6 = Lime
  • Reactor 7 = Pink
  • Reactor 8 = Gray
Doyle3694 #7
Posted 25 September 2012 - 06:13 PM
I can, but it will give me a binary number, and good luck converting that… can I have one computer for each color? and then they all send rednet messages to a main computer controling the display?
Cranium #8
Posted 25 September 2012 - 06:16 PM
Yeah, but that's probably far from easy to do. It's a little annoying to coordinate more and more computers. Rednet networking is finicky at best.