Red flashing electron

I am not able to load a program OTA using the thingspeak library. While doing this I get a series of red, blue and white flashes. here is no discernible pattern. Here is a copy of the code.

I would like to upload a short video but not available

Have any suggestions?


// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

unsigned long  myChannelNumber= !!9247;
const char * myWriteAPIKey = "!!QE6YDDSA2EIML4";

#include "Adafruit_DHT.h"

// Example teting sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#define DHTPIN 2     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11		// DHT 11 
#define DHTTYPE DHT22		// DHT 22 (AM2302)
//#define DHTTYPE DHT21		// DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

void setup() {
	Serial.begin(9600); 
	Serial.println("DHTxx test!");

	dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
	delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a 
// very slow sensor)
	float h = dht.getHumidity();
// Read temperature as Celsius
	float t = dht.getTempCelcius();
// Read temperature as Farenheit
	float f = dht.getTempFarenheit();
  
// Check if any reads failed and exit early (to try again).
	if (isnan(h) || isnan(t) || isnan(f)) {
		Serial.println("Failed to read from DHT sensor!");
		return;
	}

// Compute heat index
// Must send in temp in Fahrenheit!
	float hi = dht.getHeatIndex();
	float dp = dht.getDewPoint();
	float k = dht.getTempKelvin();

	Serial.print("Humid: "); 
	Serial.print(h);
	Serial.print("% - ");
	Serial.print("Temp: "); 
	Serial.print(t);
	Serial.print("*C ");
	Serial.print(f);
	Serial.print("*F ");
	Serial.print(k);
	Serial.print("*K - ");
	Serial.print("DewP: ");
	Serial.print(dp);
	Serial.print("*C - ");
	Serial.print("HeatI: ");
	Serial.print(hi);
	Serial.println("*C");
	Serial.println(Time.timeStr());
	
	///  ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
	
  ThingSpeak.writeField(349247, 1, f, "!!!!UB2QE6YDDSA2EIML4");	
//thingspeak.writefield(myChannelNumber,1,f,myWriteAPIKey);
	
//thingspeak.writefield(myChannelNumber,2,h,myWriteAPIKey);
		
delay (30000);		
	
}

You can upload a video to any video platform (e.g. YouTube or vimeo) and post the link.

1 Like

Thanks - will do

Here is a video of the blinking problem. Any idea on how to fix?

This is a distinct pattern.
It’s the normal startup till breathing cyan and then after a few moments the SOS panic pattern follws, but then when it starts to get interesting the video stops.
The blink count after the SOS would be the important info.

A video is below

Thanks for the great response. I count

3 short red
3 long red
3 short red
1 red
9 red
1 red

then
white
green
flash light blue

Here is the video

I made progress. I flashed Tinker back on my electron and then removed extra code from DHT example. The Electron is now in a light blue mode. I can flash a simple code like this and it is working int led = D7;

void setup() {
pinMode(led, OUTPUT);
}

void loop() {
digitalWrite(led, HIGH);
delay(4000);
digitalWrite(led, LOW);
delay(500);
}

When I run the Thingspeak code I get the same error.

Reading further I see that 9 flashes is SPI overrun.

When I strip out the thingspeak libraries, it gets uploaded.

I bet it is something in the thingspeak library

These 9 flashes are a second SOS pattern. The single blink between the two SOSs iscwhat counts (hard fault).
Probably caused by the ThingSpeak library.

What system version are you targeting?
And what ThingSpeak version?

2 Likes

I am using version 6.2 and thingspeak1.3.0

I know this is an old thread, but in case anyone else comes here because they have this problem, there is a line of code missing in Setup() that causes this failure.

ThingSpeak.begin(client);  // Connect to ThingSpeak

In the ThingSpeak examples they also have this which I do not see in this program either:

TCPClient client;  /* Thingspeak */