Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/tutorial_samples/11_msg_slave.py
diff options
context:
space:
mode:
Diffstat (limited to 'pynxc/tutorial_samples/11_msg_slave.py')
-rw-r--r--pynxc/tutorial_samples/11_msg_slave.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/pynxc/tutorial_samples/11_msg_slave.py b/pynxc/tutorial_samples/11_msg_slave.py
new file mode 100644
index 0000000..34c6c27
--- /dev/null
+++ b/pynxc/tutorial_samples/11_msg_slave.py
@@ -0,0 +1,31 @@
+DEFINE BT_CONN=1
+DEFINE INBOX=5
+DEFINE OUTBOX=1
+
+
+def sub_BTCheck(conn):
+
+ if (BluetoothStatus(conn)!=NO_ERR):
+ TextOut(5,LCD_LINE2,"Error")
+ Wait(1000)
+ Stop(True)
+
+def main():
+ instr=String('')
+ outstr=String('')
+ iStr=String('')
+
+ i=Integer(0)
+ sub_BTCheck(0) #check master connection
+ while True:
+ iStr = NumToStr(i)
+ outstr = StrCat("S",iStr)
+ TextOut(10,LCD_LINE1,"Slave Test")
+ TextOut(0,LCD_LINE2,"IN:")
+ TextOut(0,LCD_LINE4,"OUT:")
+ ReceiveRemoteString(INBOX, True, instr)
+ SendResponseString(OUTBOX,outstr)
+ TextOut(10,LCD_LINE3,instr)
+ TextOut(10,LCD_LINE5,outstr)
+ Wait(100)
+ i+=1