Library to use a wifly module: RN 131 C/G
Dependents: RN-XV_simple_server
Diff: Wifly.cpp
- Revision:
- 4:06ca04e2e279
- Parent:
- 0:2f38aaabc810
- Child:
- 5:9890eb81f730
diff -r e6f1c618da66 -r 06ca04e2e279 Wifly.cpp --- a/Wifly.cpp Fri Aug 12 14:09:54 2011 +0000 +++ b/Wifly.cpp Fri Aug 12 14:46:42 2011 +0000 @@ -309,7 +309,33 @@ return(wifi.readable()); } - +bool Wifly::changeBaudrate(int baudrate) +{ + char cmd[20]; + exit(); + if(!CmdMode()) + { + printf("Wifly::changeBaudrate: cannot enter in cmd mode\r\n"); + return false; + } + + sprintf(cmd, "set u b %d\r\n", baudrate); + if(!Send(cmd, "AOK")) + { + printf("Wifly::changeBaudrate: cannot set new baudrate\r\n"); + exit(); + return false; + } + + if(!Send("save\r\n", "Stor")) + { + printf("Wifly::changeBaudrate: cannot save\r\n"); + exit(); + return false; + } + + return true; +} char Wifly::getc()