factory resets
Dependencies: WiflyInterface mbed
Fork of Wifly_UpdateFirmware by
main.cpp@0:da9cea9f791c, 2012-11-24 (annotated)
- Committer:
- samux
- Date:
- Sat Nov 24 17:04:27 2012 +0000
- Revision:
- 0:da9cea9f791c
- Child:
- 1:15ea8cdb6a39
program to update the firmware of a wifly module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 0:da9cea9f791c | 1 | // this program updates to the latest firmware a wifly module |
samux | 0:da9cea9f791c | 2 | |
samux | 0:da9cea9f791c | 3 | #include "mbed.h" |
samux | 0:da9cea9f791c | 4 | #include "WiflyInterface.h" |
samux | 0:da9cea9f791c | 5 | |
samux | 0:da9cea9f791c | 6 | WiflyInterface wifly(p9, p10, p30, p29, "8cb19na", "vokeralineaplus", WPA); |
samux | 0:da9cea9f791c | 7 | |
samux | 0:da9cea9f791c | 8 | int main() { |
samux | 0:da9cea9f791c | 9 | wifly.init(); //Use DHCP |
samux | 0:da9cea9f791c | 10 | while(!wifly.connect()); |
samux | 0:da9cea9f791c | 11 | |
samux | 0:da9cea9f791c | 12 | // once connected, send command to update firmware |
samux | 0:da9cea9f791c | 13 | wifly.sendCommand("set ftp address 0\r", "AOK"); |
samux | 0:da9cea9f791c | 14 | wifly.sendCommand("set dns name rn.microchip.com\r", "AOK"); |
samux | 0:da9cea9f791c | 15 | wifly.sendCommand("save\r", "Stor"); |
samux | 0:da9cea9f791c | 16 | wifly.sendCommand("ftp update\r", "FTP OK", NULL, 30000); |
samux | 0:da9cea9f791c | 17 | wifly.sendCommand("factory RESET\r"); |
samux | 0:da9cea9f791c | 18 | wifly.sendCommand("reboot\r"); |
samux | 0:da9cea9f791c | 19 | |
samux | 0:da9cea9f791c | 20 | while(1); |
samux | 0:da9cea9f791c | 21 | } |