diff options
Diffstat (limited to 'pynxc/tutorial_samples/11_ack_slave.py')
-rw-r--r-- | pynxc/tutorial_samples/11_ack_slave.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pynxc/tutorial_samples/11_ack_slave.py b/pynxc/tutorial_samples/11_ack_slave.py new file mode 100644 index 0000000..9e8c619 --- /dev/null +++ b/pynxc/tutorial_samples/11_ack_slave.py @@ -0,0 +1,26 @@ +#SLAVE + +DEFINE BT_CONN=1 +DEFINE OUTBOX=5 +DEFINE INBOX=1 + +def sub_BTCheck(conn): + if (BluetoothStatus(conn)!=NO_ERR): + TextOut(5,LCD_LINE2,"Error") + Wait(1000) + Stop(True) + + +def main(): + numin=Integer() + + sub_BTCheck(0) + TextOut(5,LCD_LINE1,"Slave receiving") + SendResponseNumber(OUTBOX,0xFF) #unblock master + while True: + if (ReceiveRemoteNumber(INBOX,true,numin) != STAT_MSG_EMPTY_MAILBOX): + TextOut(0,LCD_LINE3," "); + NumOut(5,LCD_LINE3,numin); + SendResponseNumber(OUTBOX,0xFF); + + Wait(10); #take breath (optional) |