| This page needs some serious TLC, stat!|
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: The behaviour of Rednet has changed as of 1.5 - please consider updating this page with information. (Please don't add prerelease info!))
- This page is for the Modem blocks. For the modem API, see Modem (API)
|Peripheral?||Yes- Modem (API)|
Modems are blocks which can be used to wirelessly transfer data between Computers and Turtles, using the Rednet API or the Modem API. To place a modem on a side of a computer, right-click while sneaking.
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.
As of the 1.5 update for ComputerCraft, Wireless Modems can send messages on specific channels.
Example (Modem API)
- 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, wrap your modem using peripheral.wrap() (something like "modem = peripheral.wrap("<side of modem>")
- Type "modem.open (<A modem port number, anything from 1 to 65535>)" on one computer.
- Check if there exists a connection: a dim, red light should be found on the modem.
- Now, type "modem.transmit (<Same number as above>, <Also the same number>, '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.
Modem as a Peripheral
To use a Modem as a peripheral, you need to either call a method directly using peripheral.call(), or, wrap the modem using the Peripheral API. Wrapped modems provide all functions listed in the Modem API.
For this example, we have a Modem connected to the top of our Computer, we are going to open channel 5:
-- Immediately invoke a method without wrapping peripheral.call( "top", "open", 5 )
-- You can also "wrap" the peripheral side to a variable: local modem = peripheral.wrap( "top" ) modem.open( 5 )
|1.3||Added Wireless Modems.|
|1.4||The send and receive range of wireless modems now increases with altitude, allowing long range networking from high-altitude Computers.|
|1.5||Redesigned Wireless Modems; they can now send and receive on multiple channels, independent of the computer ID.|
|1.51||Changed crafting recipe.|
|ComputerCraft Blocks and Items|
|Computer||Advanced Computer||Command Computer||Disk Drive|
|Wireless Modem||Ender Modem||Wired Modem||Networking Cable|
|Pocket Computer||Advanced Pocket Computer||Floppy Disk||Printed Page|
|Printed Pages||Printed Book|