Im trying to transmit a UART data to other node in wireless, for that as a starting point. I have tried to test the the working of UART. The code which i used for it is shown below.
used componets:
2 RF 200 modules
1 SN171 board
1 FTDI chip
In RF200: Im giving input to UART1's RX(Pin 10 in SN171 board) via an FTDI chip which is basically an USB to UART converter.
Im using the coolterm terminal to load the data into FTDI chip. But i cant see LED blinking or lighting up.
NodeA:
It is used as portal to send the code over the air.
Node B code:
IT has the SN171 board, FTDI chip and LED connected
from synapse.switchboard import *
from synapse.evalBase import *
UARTtestPin = GPIO_9
toggle = 0
yourPortalAddr = "\x5F\xCE\x81"
@setHook(HOOK_STARTUP)
def startupEvent():
setPinDir(UARTtestPin,True) # configure the pin as output
writePin(UARTtestPin, False) # Set the pin high to power the device
initUart(1, 9600)
flowControl(1, False) # disable CTS/RTS
stdinMode(1, False)
#crossConnect(DS_UART1, DS_STDIO)
uniConnect(DS_STDIO,DS_UART1) # From UART0 to STDIN
uniConnect(DS_TRANSPARENT, DS_STDIO) #From STDOUT to Datamode/Portal
ucastSerial(yourPortalAddr) #<= Add your address here
@setHook(HOOK_STDIN)
def stdinEvent(data):
print data
print "data"
global toggle
if(toggle ==1):
writePin(UARTtestPin, False)
toggle=0
else:
writePin(UARTtestPin, True)
toggle=1
@setHook(HOOK_1S)
def eventlogger():
print " test: The working of intercepter"
Doubts:
1. why the print command under HOOK_STDIN doesnot work.
2. why "data" is not printed in intercepter( the second print code under HOOK_STDIN)
3. why the LED did not light up
4. If the the data is printed properly under HOOK_STDIN, is it possible to pass the same data through RPC call or do we have any other easy way?
TESTS:
1. Tried using both the UARTS
Kindly help me in this regard
used componets:
2 RF 200 modules
1 SN171 board
1 FTDI chip
In RF200: Im giving input to UART1's RX(Pin 10 in SN171 board) via an FTDI chip which is basically an USB to UART converter.
Im using the coolterm terminal to load the data into FTDI chip. But i cant see LED blinking or lighting up.
NodeA:
It is used as portal to send the code over the air.
Node B code:
IT has the SN171 board, FTDI chip and LED connected
from synapse.switchboard import *
from synapse.evalBase import *
UARTtestPin = GPIO_9
toggle = 0
yourPortalAddr = "\x5F\xCE\x81"
@setHook(HOOK_STARTUP)
def startupEvent():
setPinDir(UARTtestPin,True) # configure the pin as output
writePin(UARTtestPin, False) # Set the pin high to power the device
initUart(1, 9600)
flowControl(1, False) # disable CTS/RTS
stdinMode(1, False)
#crossConnect(DS_UART1, DS_STDIO)
uniConnect(DS_STDIO,DS_UART1) # From UART0 to STDIN
uniConnect(DS_TRANSPARENT, DS_STDIO) #From STDOUT to Datamode/Portal
ucastSerial(yourPortalAddr) #<= Add your address here
@setHook(HOOK_STDIN)
def stdinEvent(data):
print data
print "data"
global toggle
if(toggle ==1):
writePin(UARTtestPin, False)
toggle=0
else:
writePin(UARTtestPin, True)
toggle=1
@setHook(HOOK_1S)
def eventlogger():
print " test: The working of intercepter"
Doubts:
1. why the print command under HOOK_STDIN doesnot work.
2. why "data" is not printed in intercepter( the second print code under HOOK_STDIN)
3. why the LED did not light up
4. If the the data is printed properly under HOOK_STDIN, is it possible to pass the same data through RPC call or do we have any other easy way?
TESTS:
1. Tried using both the UARTS
Kindly help me in this regard
Comment