User manual
Example of using two SNAP wireless nodes to replace a RS-232 cable
Edit this script to specify the OTHER node's address, and load it into a node
Node addresses are the last three bytes of the MAC Address
MAC Addresses can be read off of the SNAP Engine sticker
For example, a node with MAC Address 001C2C1E 86001B67 is address 001B67
In SNAPpy format this would be address "\x00\x1B\x67"
"""
from synapse.switchboard import *
otherNodeAddr = "\x4B\x42\x35" # <= put the address of the OTHER node here
@setHook(HOOK_STARTUP)
def startupEvent():
initUart(1, 9600) # <= put your desired baud rate here!
flowControl(1, False) # <= set flow control to True or False as needed
crossConnect(DS_UART1, DS_TRANSPARENT)
ucastSerial(otherNodeAddr)
The script as shipped defaults to 9600 baud and no hardware flow control. Edit these sengs as needed, too.
With these two edited scripts loaded into the correct nodes (remember, you are telling each node who the other
node is; each node already knows its own address), you have just created a wireless serial link.
Option 2 – One Script, Manually Configurable Addressing
Instead of hard-coding the “other node” address within each script, you could have both nodes share a common
script, and use SNAPpy’s Non-Volale Parameter (NV Param for short) support to specify the addressing aer
the script was loaded into the unit.
Look in your snappyImages directory for a script named dataModeNV.py. Since we won’t be making any changes
to this script, there is no need to make a copy of it. Simply load it into both nodes as-is.
With this script loaded into a node, the node’s Node Info pane should look like:
Click on setOtherNode(address) in the Snappy Modules tree, and when prompted by Portal, enter the address of
the other node as a quoted string (standard Python “binary hex” format).
For example, if the other node is at address 12.34.56, you would enter
"\x12\x34\x56" in the Portal dialog box.
Do this for both nodes.
SNAP® Network Operang System 25