When I upload the code below any electron i have goes red flashing. It should NOT because its on manual mode.
// For testing code
SYSTEM_MODE(MANUAL);
//Sensor Code
/*
#if defined(PARTICLE)
SYSTEM_THREAD(ENABLED)
#endif
*/
#include "Adafruit_CCS811.h"
Adafruit_CCS811 ccs;
void setup() {
Serial.begin(9600);
// These two control the LED
pinMode(A3, OUTPUT);
pinMode(A1, OUTPUT);
// These two complete a pullup resistor
pinMode(B5, INPUT_PULLUP);
pinMode(B3, OUTPUT);
//Part of the pullup network
digitalWrite(B3, LOW);
pinMode(D2, OUTPUT);
digitalWrite(D2, LOW);
float temp = ccs.calculateTemperature();
ccs.setTempOffset(temp - 25.0);
}
void loop() {
// Code for rocker switch to shutoff
if (analogRead(A7) < 100 ) {
System.sleep(SLEEP_MODE_SOFTPOWEROFF);
}
// Seeming non-invertered logic
if (digitalRead(B5)) {
buttonOn();
} else {
buttonOff();
}
if (ccs.available()) {
float temp = ccs.calculateTemperature();
if (!ccs.readData()) {
Serial.print("CO2: ");
Serial.print(ccs.geteCO2());
Serial.print("ppm, TVOC: ");
Serial.print(ccs.getTVOC());
Serial.print("ppb Temp:");
Serial.println(temp);
}
else {
Serial.println("ERROR!");
while (1);
}
}
delay(500);
}
void buttonOn() {
digitalWrite(A3, LOW);
digitalWrite(A1, HIGH);
}
void buttonOff() {
digitalWrite(A3, LOW);
digitalWrite(A1, LOW);
}