Todd Dale
/
BluetoothSlave
Basic Slave connection code. (Bluetooth)
main.cpp@2:55173624f9a0, 2018-05-25 (annotated)
- Committer:
- el15tcd
- Date:
- Fri May 25 18:16:16 2018 +0000
- Revision:
- 2:55173624f9a0
- Parent:
- 1:c573caf40864
Basic Slave connection code. (Bluetooth)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el15tcd | 0:8a61e3541a5e | 1 | #include "mbed.h" |
el15tcd | 2:55173624f9a0 | 2 | Serial rn42(p13,p14); //TX, RX |
el15tcd | 2:55173624f9a0 | 3 | Serial pc(USBTX, USBRX); |
el15tcd | 0:8a61e3541a5e | 4 | |
el15tcd | 2:55173624f9a0 | 5 | char x; |
el15tcd | 0:8a61e3541a5e | 6 | |
el15tcd | 0:8a61e3541a5e | 7 | int main() |
el15tcd | 0:8a61e3541a5e | 8 | { |
el15tcd | 0:8a61e3541a5e | 9 | |
el15tcd | 2:55173624f9a0 | 10 | rn42.baud(460800); |
el15tcd | 2:55173624f9a0 | 11 | wait(0.5); |
el15tcd | 0:8a61e3541a5e | 12 | |
el15tcd | 2:55173624f9a0 | 13 | rn42.putc('$'); |
el15tcd | 2:55173624f9a0 | 14 | rn42.putc('$'); |
el15tcd | 2:55173624f9a0 | 15 | rn42.putc('$'); |
el15tcd | 2:55173624f9a0 | 16 | //command mode entered |
el15tcd | 2:55173624f9a0 | 17 | wait(0.3); |
el15tcd | 2:55173624f9a0 | 18 | rn42.putc('W'); |
el15tcd | 2:55173624f9a0 | 19 | rn42.putc('\n'); |
el15tcd | 2:55173624f9a0 | 20 | //slave device 'woken' |
el15tcd | 2:55173624f9a0 | 21 | wait(0.3); |
el15tcd | 0:8a61e3541a5e | 22 | |
el15tcd | 0:8a61e3541a5e | 23 | while(1) { |
el15tcd | 0:8a61e3541a5e | 24 | |
el15tcd | 0:8a61e3541a5e | 25 | |
el15tcd | 0:8a61e3541a5e | 26 | } |
el15tcd | 2:55173624f9a0 | 27 | } |