Difference between revisions of "Wireless Modem"

From ComputerCraft Wiki
Jump to: navigation, search
m (Updated references to Modem)
m (Console -> Computer)
Line 1: Line 1:
 
== Description ==
 
== Description ==
'''Modems''' are blocks which can be used to wirelessly transfer data between [[Console|consoles]] and [[Turtle|turtles]], using "rednet" commands.
+
'''Modems''' are blocks which can be used to wirelessly transfer data between [[Computer|computers]] 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).
+
To place a modem on a side of your computer, click on the computer 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.
 
It is also possible to turn the modem on and off by typing "rednet.open ( side )" to open and "rednet.close ( side )" to close.
Line 18: Line 18:
 
  }}
 
  }}
 
== Example ==
 
== Example ==
* Place 2 consoles and add modems to them by clicking the right mouse button while sneaking.
+
* Place 2 computers and add modems to them by clicking the right mouse button while sneaking.
 
* Access them, and start Lua.
 
* Access them, and start Lua.
* Once Lua has started, type "[[rednet_(API)|rednet]].[[rednet.open|open]] ("<relative location to modem, e.g. left, right>")" on both consoles.
+
* Once Lua has started, type "[[rednet_(API)|rednet]].[[rednet.open|open]] ("<relative location to modem, e.g. left, right>")" on both computers.
 
* Check if there exists a connection: a dim, red light should be found on the modem.
 
* Check if there exists a connection: a dim, red light should be found on the modem.
* Type on one console "[[rednet_(API)|rednet]].[[rednet.receive|receive]] (60)". This will make the console freeze for 60 seconds, or until it has received a signal from the other console.
+
* Type on one computer "[[rednet_(API)|rednet]].[[rednet.receive|receive]] (60)". This will make the computer freeze for 60 seconds, or until it has received a signal from the other computers.
* Now, type "[[rednet_(API)|rednet]].[[rednet.broadcast|broadcast]] ('<your message>')" on the other console. This should send your message to all consoles connected.
+
* Now, type "[[rednet_(API)|rednet]].[[rednet.broadcast|broadcast]] ('<your message>')" on the other computer. This should send your message to all computers connected.
* Opening the first console should show the message written on the second console.
+
* Opening the first computer should show the message written on the second computer.
  
  

Revision as of 18:39, 30 November 2012

Description

Modems are blocks which can be used to wirelessly transfer data between computers and turtles, using "rednet" commands. To place a modem on a side of your computer, click on the computer 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 meters away, or 16 meters during a thunderstorm. As of 1.4 Modem range is increased with higher altitudes. If there is no thunderstorm, the range will always be higher than 64, and at max altitude you would have a range of 384 meters.

In 1.4 and 1.41 there is a miscalculation that causes the range to only be 381 meters at max altitude.

Recipe

stone

stone

stone

stone

redstone_torch

stone

stone

stone

stone

Modem



Example

  • Place 2 computers 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 computers.
  • Check if there exists a connection: a dim, red light should be found on the modem.
  • Type on one computer "rednet.receive (60)". This will make the computer freeze for 60 seconds, or until it has received a signal from the other computers.
  • Now, type "rednet.broadcast ('<your message>')" on the other computer. This should send your message to all computers connected.
  • Opening the first computer should show the message written on the second computer.


More help on Rednet