factory resets

Dependencies:   WiflyInterface mbed

Fork of Wifly_UpdateFirmware by Samuel Mokrani

main.cpp

Committer:
samux
Date:
2012-11-24
Revision:
0:da9cea9f791c
Child:
1:15ea8cdb6a39

File content as of revision 0:da9cea9f791c:

// this program updates to the latest firmware a wifly module

#include "mbed.h"
#include "WiflyInterface.h"

WiflyInterface wifly(p9, p10, p30, p29, "8cb19na", "vokeralineaplus", WPA);

int main() {
    wifly.init(); //Use DHCP
    while(!wifly.connect());
    
    // once connected, send command to update firmware
    wifly.sendCommand("set ftp address 0\r", "AOK");
    wifly.sendCommand("set dns name rn.microchip.com\r", "AOK");
    wifly.sendCommand("save\r", "Stor");
    wifly.sendCommand("ftp update\r", "FTP OK", NULL, 30000);
    wifly.sendCommand("factory RESET\r");
    wifly.sendCommand("reboot\r");
    
    while(1);
}