1. Load the SmartConfigCreate code to the Arduino and use the phone app to set the SSID I want.
2. Reload the Petdish code - modified to use the reconnect code (from the sample) instead of the existing code.
3. Then use the app to change the SSID as needed whilst the pet dish is on
If that order is correct - can I confirm I should replace this code from the Petfood dish :
To this code from the SmartConfigReconnect script :// Set up the serial port connection.
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
// Set up the CC3000, connect to the access point, and get an IP address.
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100);
}
I assume I also need to double check variables etc match and also somehow add the disconnect rule ?void setup(void)
{
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
/* Try to reconnect using the details from SmartConfig */
/* This basically just resets the CC3000, and the auto connect */
/* tries to do it's magic if connections details are found */
Serial.println(F("Trying to reconnect using SmartConfig values ..."));
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* !!! Note the additional arguments in .begin that tell the !!! */
/* !!! app NOT to deleted previously stored connection details !!! */
/* !!! and reconnected using the connection details in memory! !!! */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
if (!cc3000.begin(false, true))
{
Serial.println(F("Unable to re-connect!? Did you run the SmartConfigCreate"));
Serial.println(F("sketch to store your connection details?"));
while(1);
}
/* Round of applause! */
Serial.println(F("Reconnected!"));
/* Wait for DHCP to complete */
Serial.println(F("\nRequesting DHCP"));
while (!cc3000.checkDHCP()) {
delay(100); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
Please let me know if this is the right approach - or better still if you have a version of this code that uses the SmartConfig approach I'd love a copy !
thanks
Rowena