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

Please help! Rednet output if redstone input?

Started by Thesuperdjmorgan, 10 April 2013 - 05:20 AM
Thesuperdjmorgan #1
Posted 10 April 2013 - 07:20 AM
I am trying to make a coffee shop in tekkit classic and I am using the computercraft computer to make a system where you push a button of a desired coffee ect, iced coffee, dark coffee. And then a wireless transmitter under the button activates sending a redstone signal over the frequency 1 to a wireless receiver which then inputs a signal to the computer telling it to start the process of coffee making, I use the computer to start it off because I want to have a moniter show the step by step creation of the coffee ect, Gathering ingredients, mixing, heating. Then I need the computer to send a rednet signal to another computer telling it which coffee and then it can start the sequence because the coffee making facility is not in the room where it is all made. But how do I make the wireless receiver give an input to the computer starting off the sequence? I have looked around many places but can't seem to find what I am looking for, please if anyone knows the answer then post a reply.
SadKingBilly #2
Posted 10 April 2013 - 07:31 AM
Something like this would wait until the redstone input on the bottom of the computer changes and then execute the coffee-brewing code.

while true do
    os.pullEvent("redstone")
    if rs.getInput("bottom") == true then
	    -- brew coffee code goes here
    end
end
theoriginalbit #3
Posted 10 April 2013 - 07:36 AM

if rs.getInput("bottom") == true then
there is no need for the "== true" … rs.getInput returns a boolean, if statements require a boolean. no need to make sure it is a boolean. also instead of
rs.getInput('bottom') == false
you can just say
not rs.getInput('bottom')
Thesuperdjmorgan #4
Posted 10 April 2013 - 08:09 AM
Thanks guys, I never imagined I would get a response so quickly, so I would write in my computer code :- Can you check if that would be right?


while true do
os.pullEvent("redstone")
if rs.getInput("bottom")
rednet.broadcast("IcedCoffee")
end
end
SadKingBilly #5
Posted 10 April 2013 - 08:23 AM
No, that's not quite right. You forget to include "then":

while true do
	os.pullEvent("redstone")
	if rs.getInput("bottom") then
		 rednet.broadcast("IcedCoffee")
	end
end
But I'm confused. I thought you were using wireless redstone to transmit the signal to the computer. Why do you want to broadcast a message after the computer receives the wireless signal?
Thesuperdjmorgan #6
Posted 10 April 2013 - 08:31 AM
I use 2 computers, one to show the step by step making of the coffee and one to actually make the coffee itself, since the 2 computers are in different places it's harder. I don't know if that made sense, yea I just thought it is a bit time consuming making multiple broadcasts back and forth the computer with the moniter and the computer with the facility, could you suggest an easier solution, I am quite inexperienced at this stuff and that is probably why I take the long route, but thats because I don't know the short route, do you know?