-
Notifications
You must be signed in to change notification settings - Fork 0
/
Blutetooth_test.cpp
72 lines (36 loc) · 936 Bytes
/
Blutetooth_test.cpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <mbed.h>
Serial bt(p9,p10);
char buf[7];
uint8_t i = 0;
char recv[7];
char txs[6] = {'e','s','e','5','1', '9'};
void flush()
{
while (bt.readable())
bt.getc();
}
int main()
{
bt.baud(115200);
while(1)
{
printf("s \r\n");
flush();
while(!bt.readable());
printf("\r\n");
while(bt.readable())
{
for(i=0;bt.readable();i++){
buf[i] = bt.getc();
printf("%c",buf[i]);
}
}
flush();
for(i=0;i<6;i++){
bt.putc(txs[i]);
}
flush();
printf("\r\n");
/***************************/
}
}