Hi all,
This morning I got around to troubleshooting a particle project that’s been on the fritz for a while now. I opened my code, commented out a portion involving resetFunc(), and compiled it with no other changes.
It prompted me with a single error: my Adafruit_DHT library was missing. I re-downloaded it and recompiled.
However, upon compiling, my photon no longer enters the void loop() portion of my code. I can see this by the fact that it never reaches my Particle.publish statements, resulting in no webhook calls, as well as by the fact that nothing is coming through the serial monitor (even a simple “hello world” upon booting).
Also worth noting is that it seems to be randomly turning the digital pins off and on for random durations in random orders.
My setup code is below- I can post the rest if anyone deems useful, but it’s long messy code, and seeing as how my photon never gets there I thought it would be irrelevant. If I’m wrong, I’ll happily post the rest (1000+ lines) upon request.
//<editor-fold> HARDWARE- sensor setup and variables
SYSTEM_THREAD(ENABLED);
//Initialize humidity sensor
#include "Adafruit_DHT.h"; //Include Adafruit humidity code
#define DHTPIN A4
#define DHTTYPE DHT11
DHT dht(DHTPIN,DHTTYPE); //Begin humidity sensor code (?)
//Initialize pressure sensor
#include "Adafruit_BMP085.h"; //Include Adafruit pressure code
#include "Wire.h";
Adafruit_BMP085 bmp; //Begin pressure sensor code (?)
//Pins for interface with Arduinos
int board1_100 = 2;
int board1_10 = 3;
int board1_1 = 4;
int board2_100 = 5;
int board2_10 = 6;
int board2_1 = 7;
int condPin = A2;
int signaller = A3;
const int BUTTONPIN = A0;
const int RESETPIN = A1;
int condCounter(String string, String term);
void(*resetFunc) (void) = 0;
//<editor-fold> Variables
int i = 360; //Starts i at 360, causing data
//publication at startup
int sinceReset = 0;
double humidRaw; double tempC; double tempF; double pressureRaw;
double pressurekPa; double elevation; double pressureOffset;
double pressureSeakPa; double buttonInput; double buttonReset;
uint32_t freemem; uint32_t usedmem;
//<editor-fold> Webhook parser variables
int weathercall = 1; int forecastcall = 1;
//Variables for dataset 1 parser
float tempF1 = 0; float Pressure1 = 0; int Pcheck1 = 0; float Humidity1 = 0;
float temp1int; float Pressure1intin; float Humidity1int; int simplecast = 0;
//Variables for forecast parsers
double tempForecast1 = -100; String condForecast1 = "empty";
double tempForecast2 = -100; String condForecast2 = "empty";
double tempForecast3 = -100; String condForecast3 = "empty";
double tempForecast4 = -100; String condForecast4 = "empty";
double tempForecast5 = -100; String condForecast5 = "empty";
int condMaxIdx = 0;
//Variables for dataset 2 parser
float tempF2; float Pressure2; int Pcheck2 = 0; float Humidity2;
//Variables for dataset/forecast 3 parser
int tempBuffer = 0; float tempF3 = 0; int pressureBuffer3 = 0;
float Pressure3 = 0; int Pcheck3 = 0; float Humidity3 = 0;
int conditionBuffer3 = 0;
//Variables for dataset 4 parser
float tempF4 = 0; float Pressure4 = 0; float Humidity4 = 0;
int Pcheck4 = 0;
//Variables for dataset/forecast 5 parser
float tempF5 = 0; float Pressure5 = 0; float Humidity5 = 0;
int conditionBuffer5 = 0;
//Conditions
String conditionString = "empty";
//</editor-fold>
//<editor-fold> Display variables
double weightresid1; double weightresid2; double weightresid3;
double weightresid4; double weightresid5;
int currentDisp_100 = 0; int currentDisp_10 = 0; int currentDisp_1 = 0;
int forecastDisp_100 = 0; int forecastDisp_10 = 0; int forecastDisp_1 = 0;
int conditionDisp = 0;
//</editor-fold>
//</editor-fold>
//</editor-fold> END HARDWARE
//<editor-fold> SETUP- mapping, start sensors, serial and I2C outputs
void setup()
{
Particle.subscribe("hook-response/getWeather",gotWeather,MY_DEVICES);
Particle.subscribe("hook-response/getForecast",gotForecast,MY_DEVICES);
//Subscribe to webhook responses
//<editor-fold> Expose Variables
Particle.variable("%RH", humidRaw); //Expose humidRaw as variable
//that can be requested via Wifi
Particle.variable("Celcius", tempC); //Expose temps as variables that
Particle.variable("Fahrenheit", tempF); //can be requested via Wifi
Particle.variable("RawkPa", pressurekPa); //Expose pressures as variables
Particle.variable("SeakPa", pressureSeakPa);//that can be requested via Wifi
Particle.variable("Current100s", currentDisp_100);
Particle.variable("Current10s", currentDisp_10);
Particle.variable("Current1s", currentDisp_1);
Particle.variable("Forecast100s", forecastDisp_100);
Particle.variable("Forecast10s", forecastDisp_10);
Particle.variable("Forecast1s", forecastDisp_1);
Particle.variable("Condition", conditionDisp);
Particle.variable("Iteration", i);
Particle.variable("Usedmemory", usedmem);
Particle.variable("CondString", conditionString);
Particle.variable("weight1", weightresid1);
Particle.variable("weight2", weightresid2);
Particle.variable("weight3", weightresid3);
Particle.variable("weight4", weightresid4);
Particle.variable("weight5", weightresid5);
//</editor-fold>
//<editor-fold> Pins
pinMode(DHTPIN,INPUT); //Mapping pins to hardware
pinMode(BUTTONPIN,INPUT);
pinMode(RESETPIN,INPUT);
pinMode(board1_100,OUTPUT);
pinMode(board1_10,OUTPUT);
pinMode(board1_1,OUTPUT);
pinMode(board2_100,OUTPUT);
pinMode(board2_10,OUTPUT);
pinMode(board2_1,OUTPUT);
pinMode(condPin,OUTPUT);
pinMode(signaller,OUTPUT);
digitalWrite(board1_100,LOW); //Make sure all pins are off
digitalWrite(board1_10,LOW); //at startup
digitalWrite(board1_1,LOW);
digitalWrite(board2_100,LOW);
digitalWrite(board2_10,LOW);
digitalWrite(board2_1,LOW);
digitalWrite(condPin,LOW);
digitalWrite(signaller,HIGH);
//</editor-fold>
dht.begin(); //Begin sensor interfaces and
bmp.begin(); //serial interface
Serial.begin(9600);
waitUntil(Particle.connected);
}