Damien Frost / WiflyInterface

Dependents:   IoT_Ex BatteryModelTester BatteryModelTester

Fork of WiflyInterface by Components

Revision:
15:eaa1ec0e26bf
Parent:
13:8846f12fa277
Child:
16:de16e8b077c1
--- a/Wifly/Wifly.cpp	Sat Feb 20 16:39:09 2016 +0000
+++ b/Wifly/Wifly.cpp	Sat Feb 20 17:20:28 2016 +0000
@@ -65,6 +65,22 @@
     state.cmd_mode = false;
 }
 
+void Wifly::setBaud(int baudrate)
+{
+    char cmd[20];
+    // None of these work, although I am not sure where the issue is
+    // This sets the baud rate 'instantly'
+    sprintf(cmd, "set u i %d\r", baudrate);
+    // This one sets it some other way that does not work
+    //sprintf(cmd, "set u b %d\r", baudrate);
+    // Set baud rate of wifly:
+    sendCommand(cmd, "AOK");
+        
+    // Set baud rate of UART:
+    wifi.baud(baudrate);
+    exit();
+}
+
 bool Wifly::join()
 {
     char cmd[20];