You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
10 years ago
|
#include "ArduinoBoardSketch.h"
|
||
10 years ago
|
#include <Adafruit_CC3000.h>
|
||
|
#include <SPI.h>
|
||
10 years ago
|
#include <avr/wdt.h>
|
||
10 years ago
|
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
|
||
|
SPI_CLOCK_DIVIDER); // you can change this clock speed
|
||
|
|
||
10 years ago
|
Adafruit_CC3000_Client client;
|
||
10 years ago
|
|
||
|
uint32_t sserver;
|
||
|
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
10 years ago
|
Serial.begin(9600);
|
||
|
Serial.println(F("Internal Temperature Sensor"));
|
||
|
pinMode(6, OUTPUT);
|
||
|
connectHttp();
|
||
|
setupResource();
|
||
|
wdt_enable(WDTO_8S);
|
||
10 years ago
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
10 years ago
|
while( !cc3000.checkConnected() ){
|
||
|
connectHttp();
|
||
10 years ago
|
|
||
|
}
|
||
10 years ago
|
cpuTemperature=getBoardTemp();
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
if(millis() - pushTimestamp > PUSH_INTERVAL){
|
||
|
while (!client.connected()) {
|
||
|
setupClient();
|
||
|
}
|
||
|
pushData();
|
||
|
|
||
|
pushTimestamp = millis();
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
//Serial.println("PUSHED");
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
if(millis() - pollTimestamp > POLL_INTERVAL){
|
||
|
while (!client.connected()) {
|
||
|
setupClient();
|
||
|
}
|
||
|
readControls();
|
||
|
|
||
|
pollTimestamp = millis();
|
||
|
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
//Serial.println("LOOPING");
|
||
|
wdt_reset();
|
||
10 years ago
|
}
|