Difference between revisions of "Wireless Modem"

From ComputerCraft Wiki
Jump to: navigation, search
(Include distance limits)
Line 1: Line 1:
 
[[File:QJrCF.png|frame|right|The recipe for a modem.]]
 
[[File:QJrCF.png|frame|right|The recipe for a modem.]]
 
 
== Description ==
 
== Description ==
 +
'''Modems''' are blocks which can be used to wirelessly transfer data between [[Console|consoles]] and [[Turtle|turtles]], using "rednet" commands.
 +
To place a modem on a side of your console, click on the console with the right mouse button while sneaking (with standard settings: holding the left shift button).
  
'''Modems''' are blocks, which can be used to wirelessly transfer data between computers and turtle, using "rednet" commands.
+
It is also possible to turn the modem on and off by typing "rednet.open ( side )" to open and "rednet.close ( side )" to close.
To place a modem on a side of your computer, sneak and then click right (sneak usually = left Shift key)!
+
  
you can turn the modem on and off by typing in lua: "rednet.open ( side )" - turn on, "rednet.close ( side )" - turn off
+
Modems can send messages to other modems located up to 64 metres away, or 17 metres during a thunderstorm.[http://www.computercraft.info/forums2/index.php?/topic/464-wireless-distance/page__hl__distance__fromsearch__1]
  
Modems can send messages to other modems located up to 64 metres away, or 17 metres during a thunderstorm.[http://www.computercraft.info/forums2/index.php?/topic/464-wireless-distance/page__hl__distance__fromsearch__1]
+
== Example ==
 +
* Place 2 consoles and add modems to them by clicking the right mouse button while sneaking.
 +
* Access them, and start Lua.
 +
* Once Lua has started, type "rednet.open (<relative location to modem, e.g. left, right>)" on both consoles.
 +
* Check if there exists a connection: a dim, red light should be found on the modem.
 +
* Type on one console "rednet.receive (60)". This will make the console freeze for 60 seconds, or until it has received a signal from the other console.
 +
* Now, type "rednet.broadcast ('<your message>')" on the other console. This should send your message to all consoles connected.
 +
* Opening the first console should show the message written on the second console.
  
== example details ==
 
* place 2 computers (or turtles) and add to them the Modem (by placing on the side while being in sneaking mode - LShift)
 
* type "lua" on both
 
* then type "rednet.open (" side where's the modem ")" on both
 
* check that the modems are redlighted a bit = turned on
 
* on the first one type "rednet.receive (60)" - 60 = time to listen in seconds, the computer will be frozen until receiving any message or runing out of time
 
* on the second one type "rednet.broadcast ("hi all")" - "hi all" = message, returns "true"
 
* and now you will see that "hi all" on the first one (the number is computerID, then the message)
 
  
for more help type "help rednet" or get it here: http://computercraft.info/wiki/index.php?title=REDNET
+
[[Rednet (API)|More help on Rednet]]

Revision as of 20:40, 14 March 2012

File:QJrCF.png
The recipe for a modem.

Description

Modems are blocks which can be used to wirelessly transfer data between consoles and turtles, using "rednet" commands. To place a modem on a side of your console, click on the console with the right mouse button while sneaking (with standard settings: holding the left shift button).

It is also possible to turn the modem on and off by typing "rednet.open ( side )" to open and "rednet.close ( side )" to close.

Modems can send messages to other modems located up to 64 metres away, or 17 metres during a thunderstorm.[1]

Example

  • Place 2 consoles and add modems to them by clicking the right mouse button while sneaking.
  • Access them, and start Lua.
  • Once Lua has started, type "rednet.open (<relative location to modem, e.g. left, right>)" on both consoles.
  • Check if there exists a connection: a dim, red light should be found on the modem.
  • Type on one console "rednet.receive (60)". This will make the console freeze for 60 seconds, or until it has received a signal from the other console.
  • Now, type "rednet.broadcast ('<your message>')" on the other console. This should send your message to all consoles connected.
  • Opening the first console should show the message written on the second console.


More help on Rednet