Lawrence Lee
/
Bluetooth_HC-05_ATmode_DEMO
hc-05 atmode set
Prerequisite
HC-05 Bluetooth ATmode setting
BlueTooth Configuration
Serial Command
at at+name= at+pswd= at+reset
Hardware Configuration
WIZwiki-W7500 Pin map
Software
none
Caution
main.cpp@1:0122c3d1e431, 2017-04-18 (annotated)
- Committer:
- joon874
- Date:
- Tue Apr 18 02:36:06 2017 +0000
- Revision:
- 1:0122c3d1e431
- Parent:
- 0:55488a36f1c4
code update;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joon874 | 0:55488a36f1c4 | 1 | /************ |
joon874 | 0:55488a36f1c4 | 2 | AT MODE |
joon874 | 0:55488a36f1c4 | 3 | **************/ |
joon874 | 0:55488a36f1c4 | 4 | /************** |
joon874 | 0:55488a36f1c4 | 5 | |
joon874 | 0:55488a36f1c4 | 6 | Module : HC-05 |
joon874 | 0:55488a36f1c4 | 7 | |
joon874 | 0:55488a36f1c4 | 8 | ***********/ |
joon874 | 0:55488a36f1c4 | 9 | |
joon874 | 0:55488a36f1c4 | 10 | #include "mbed.h" |
joon874 | 0:55488a36f1c4 | 11 | |
joon874 | 0:55488a36f1c4 | 12 | Serial pc(USBTX, USBRX); |
joon874 | 0:55488a36f1c4 | 13 | Serial bt(D1,D0); |
joon874 | 0:55488a36f1c4 | 14 | |
joon874 | 0:55488a36f1c4 | 15 | int main(void) |
joon874 | 0:55488a36f1c4 | 16 | { |
joon874 | 0:55488a36f1c4 | 17 | pc.baud(9600); |
joon874 | 0:55488a36f1c4 | 18 | bt.baud(38400); |
joon874 | 0:55488a36f1c4 | 19 | |
joon874 | 1:0122c3d1e431 | 20 | pc.printf("WIZwiki-W7500\n\r"); |
joon874 | 1:0122c3d1e431 | 21 | pc.printf("HC-05 SET\n\r"); |
joon874 | 0:55488a36f1c4 | 22 | |
joon874 | 0:55488a36f1c4 | 23 | char ch; |
joon874 | 0:55488a36f1c4 | 24 | |
joon874 | 0:55488a36f1c4 | 25 | while(1) |
joon874 | 0:55488a36f1c4 | 26 | { |
joon874 | 0:55488a36f1c4 | 27 | if(pc.readable()) |
joon874 | 0:55488a36f1c4 | 28 | { |
joon874 | 0:55488a36f1c4 | 29 | ch = pc.getc(); |
joon874 | 0:55488a36f1c4 | 30 | bt.putc(ch); |
joon874 | 0:55488a36f1c4 | 31 | } |
joon874 | 0:55488a36f1c4 | 32 | |
joon874 | 0:55488a36f1c4 | 33 | if(bt.readable()) |
joon874 | 0:55488a36f1c4 | 34 | { |
joon874 | 0:55488a36f1c4 | 35 | ch = bt.getc(); |
joon874 | 0:55488a36f1c4 | 36 | pc.putc(ch); |
joon874 | 0:55488a36f1c4 | 37 | } |
joon874 | 0:55488a36f1c4 | 38 | } |
joon874 | 0:55488a36f1c4 | 39 | } |