The CC3000 Shield is working flawlessly with the Uno. I am able to connect to the Carriot server and transfer data as in the tutorial.
Is there a way that I can keep connected to my wifi router all the time and only transmit to the Carriot server when needed.
I have not been able to figure this out. Any help will be greatly appreciated.
CC3000 Shield: Works but need a little help
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- narendrab
- Posts: 11
- Joined: Thu Dec 19, 2013 4:12 pm
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: CC3000 Shield: Works but need a little help
Try this:
Move the access-point connection code to setup():
Then, at the end of loop(), comment out the disconnect:
Move the access-point connection code to setup():
Code: Select all
void setup(void)
{
// Initialize
Serial.begin(115200);
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
// Connect to WiFi network
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
Serial.println(F("Connected!"));
/* Wait for DHCP to complete */
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100);
}
// Get the website IP & print it
ip = 0;
Serial.print(WEBSITE); Serial.print(F(" -> "));
while (ip == 0) {
if (! cc3000.getHostByName(WEBSITE, &ip)) {
Serial.println(F("Couldn't resolve!"));
}
delay(500);
}
cc3000.printIPdotsRev(ip);
}
void loop(void)
{
// Get data & transform to integers
soilSensor.measure(&t, &h, &dewpoint);
// Convert data to String
String temperature = doubleToString(t,2);
String humidity = doubleToString(h,2);
. . . etc . . .
Code: Select all
. . . etc . . .
Serial.println(F("-------------------------------------"));
while (client.connected()) {
while (client.available()) {
char c = client.read();
Serial.print(c);
}
}
client.close();
Serial.println(F("-------------------------------------"));
// Serial.println(F("\n\nDisconnecting"));
// cc3000.disconnect();
// Wait 10 seconds until next update
delay(10000);
}
- narendrab
- Posts: 11
- Joined: Thu Dec 19, 2013 4:12 pm
Re: CC3000 Shield: Works but need a little help
I tried this but it has not worked.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: CC3000 Shield: Works but need a little help
What do you mean by that? I was telling you how to stop continuously disconnecting and re-connecting. That should do that. What doesn't work?narendrab wrote:I tried this but it has not worked.
Please be positive and constructive with your questions and comments.