Example #1
0
#include "application.h"
#include "Adafruit_Sensor.h"
#include "Adafruit_TSL2591.h"
#include "Adafruit_HTU21DF.h"
#include "SparkFunPhant.h"

bool isDST(int dayOfMonth, int month, int dayOfWeek, String rule);
int postToPhant();
void setlightCycleEnd();
void moveMotor(boolean direction, int time, int speed);

const char server[] = "data.getneoko.com"; // Phant destination server
const char publicKey[] = "publicKey"; // Phant public key
const char privateKey[] = "privateKey"; // Phant private key
Adafruit_HTU21DF tempHumidSensor = Adafruit_HTU21DF();
Adafruit_TSL2591 lightSensor = Adafruit_TSL2591(2591);
Phant phant(server, publicKey, privateKey); // Create a Phant object


const int ONE_DAY_MILLIS = 24 * 60 * 60 * 1000;
const int conditionCheckFrequency = 1 * 1000;
unsigned long lastTimeSync = millis();
unsigned long lastDataSync = millis();
unsigned long lastConditionCheck = millis();
int dataSyncFrequency; //How often to sync data in milliseconds
int DSTJumpHour; //When DST takes effect
float temperature;
float humidity;
float soilMoisture;
unsigned long light;
unsigned short fullLight;
Example #2
0
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include "Adafruit_TSL2591.h"

#include "sensors.h"
#include "publish.h"

#define pmsSerial Serial1
// the SET input is connected to feather pin 5.  high or
// high-Z on this enables the sensor, pull low to disable.
#define pmsEnable 5 

// #define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591); 

struct pms5003data {
  uint16_t framelen;
  uint16_t pm10_standard, pm25_standard, pm100_standard;
  uint16_t pm10_env, pm25_env, pm100_env;
  uint16_t particles_03um, particles_05um, particles_10um, particles_25um, particles_50um, particles_100um;
  uint16_t unused;
  uint16_t checksum;
};

struct pms5003data data;

void configureTLS2591();
void bme280_loop();
void tsl2591_loop(void);