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

[Question]How do I turn rednet messages into redstone signals?

Started by amtra5, 03 March 2013 - 11:19 PM
amtra5 #1
Posted 04 March 2013 - 12:19 AM
I am trying to turn rednet messages into fast pulsing redstone signals and back, so I can send long range messages using Wireless Redstone. If anyone has an idea on how to do so, or has some example code, it would be much appreciated.
Senmori #2
Posted 04 March 2013 - 12:49 AM
You might want to check out the Rednet, Os.pullEvent(), and Redstone API pages.

As for how to do it, well if I gave you the code then you wouldn't learn anything.

I would suggest waiting for an event(os.pullEvent() or rednet.receive()) until a certain message is received and if that message is what you want then do a certain action(redstone signals).

If you don't want to learn then click the spoiler for an idea of how to do it :
Spoiler

while true do
	local senderID, message, distance = os.pullEvent(rednet_message)
	   --You could also use rednet.receive() instead of os.pullEvent()
	if (senderID == "12") and (message == "Hello") then
		  --do stuff
	else
		 --do other stuff
	end --ends if statement
end -- ends while loop
amtra5 #3
Posted 04 March 2013 - 01:13 AM
If anyone has any ideas for turning redstone to rednet it would be great!
Senmori #4
Posted 04 March 2013 - 01:14 AM
It's exactly the opposite of this…

When you receive a redstone signal then send a rednet message..
amtra5 #5
Posted 04 March 2013 - 01:37 AM
Oh right…
remiX #6
Posted 04 March 2013 - 03:59 AM
You might want to check out the Rednet, Os.pullEvent(), and Redstone API pages.

As for how to do it, well if I gave you the code then you wouldn't learn anything.

I would suggest waiting for an event(os.pullEvent() or rednet.receive()) until a certain message is received and if that message is what you want then do a certain action(redstone signals).

If you don't want to learn then click the spoiler for an idea of how to do it :
Spoiler

while true do
	local senderID, message, distance = os.pullEvent(rednet_message)
	   --You could also use rednet.receive() instead of os.pullEvent()
	if (senderID == "12") and (message == "Hello") then
		  --do stuff
	else
		 --do other stuff
	end --ends if statement
end -- ends while loop

senderID is a number, not a string