Slave Bluetooth - UnbDroid/sekksi2016 GitHub Wiki
//SLAVE
#define BT_CONN 1
#define INBOX 5
#define OUTBOX 1
sub BTCheck(int conn){
if (!BluetoothStatus(conn)==NO_ERR){
TextOut(5,LCD_LINE2,"Error");
Wait(1000);
Stop(true);
}
}
task main(){
string in, out, iStr;
int i = 0;
BTCheck(0); //check master connection
while(i<20){
iStr = NumToStr(i);
out = StrCat("S",iStr);
TextOut(10,LCD_LINE1,"Slave Test");
TextOut(0,LCD_LINE2,"IN:");
TextOut(0,LCD_LINE4,"OUT:");
ReceiveRemoteString(INBOX, true, in);
SendResponseString(OUTBOX,out);
TextOut(10,LCD_LINE3,in);
TextOut(10,LCD_LINE5,out);
Wait(500);
i++;
}
while(true);
}