Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/tutorial_samples/11_ack_slave.py
blob: 9e8c61918392906230d12d0a3f1e8207ed680d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)