Hardware Reference
In-Depth Information
// WLAN parameters
#define WLAN_SSID "yourWiFiNetwork"
#define WLAN_PASS "yourPassword"
#define WLAN_SECURITY WLAN_SEC_WPA2
// Xively parameters
#define thing_name "yourThingName"
// Variables to be sent
int temperature;
int humidity;
int light;
// IP variable
int32_t ip;
void setup ( void )
{
// Initialize
Serial.begin( 115200 );
// Start CC3000 chip
Serial.println(F( " \n Initializing..." ));
if ( ! cc3000.begin())
{
Serial.println(F( "Couldn't begin()! Check your wiring?" ));
while ( 1 );
}
}
void loop ( void )
{
// Connect to WiFi network
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
Serial.println(F( "Connected!" ));
// Start watchdog
wdt_enable(WDTO_8S);
// Wait for DHCP to complete
Serial.println(F( "Request DHCP" ));
while ( ! cc3000.checkDHCP())
{
delay( 100 );
}
// Reset watchdog
wdt_reset();
Search WWH ::




Custom Search