Hardware Reference
In-Depth Information
}
else
{
Serial.println(F(
"Connection failed"
));
return
;
}
// Reset watchdog
wdt_reset();
// Read answer
Serial.println(F(
"Reading answer..."
));
while
(client.connected()) {
while
(client.available()) {
char
c
=
client.read();
Serial.print(c);
}
}
Serial.println(F(
""
));
// Reset watchdog
wdt_reset();
// Close connection and disconnect
client.close();
Serial.println(F(
"Disconnecting"
));
Serial.println(F(
""
));
cc3000.disconnect();
// Reset watchdog & disable
wdt_reset();
wdt_disable();
// Wait 10 seconds until next update
delay(
10000
);
}
Let's now go into the details of the code. It starts by importing the required libraries:
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include "DHT.h"
#include <avr/wdt.h>
We then define the pins on which the CC3000 module is connected to: