[SOLVED] Can't add libraries

Hi, i followed this project: From 0 to IoT in 15 minutes and when i add a library it appeears that error:

src/from0toiot.cpp:2:24: fatal error: ThingSpeak.h: No such file or directory
#line 1
compilation terminated.
make[1]: *** […/build/target/user/platform-10src/from0toiot.o] Error 1
make: *** [user] Error 2

here is the code:

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

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

// Sensor type
#define DHTTYPE DHT22    	// DHT 22 (AM2302)

// DHT22 sensor pinout:
// Pin 1 (on the left): +3.3V
// Pin 2: output
// Pin 4 (on the right): GROUND
#define DHT_5V_PIN D1


/* Thingspeak */
TCPClient client;
unsigned long myChannelNumber = 89155;
const char * myWriteAPIKey = "3D23PQHQIJ3OZXMM";

void setup() {
// Connect to ThingSpeak

// Give power to the sensor
pinMode(DHT_5V_PIN, OUTPUT);
digitalWrite(DHT_5V_PIN, HIGH);
digitalWrite(DHT_GROUND_PIN, LOW);

// Wait for the sensor to stabilize

// Initialize sensor

// Read Sensor
double temperature = dht.getTempCelcius();
double humidity = dht.getHumidity();

// Update the 2 ThingSpeak fields with the new data
ThingSpeak.setField(1, (float)temperature);
ThingSpeak.setField(2, (float)humidity);

// Write the fields that you've set all at once.
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

// Give time for the message to reach ThingSpeak

// Sleep for 15 minutes to save battery
System.sleep(SLEEP_MODE_DEEP, 15 * 60);

void loop() {
// This will run because the system is sleeping

I tried #include “ThingSpeak/ThingSpeak.h” and a lot of things

How i can fix it?


You need to target a system version >= 0.5.3 - your device states 0.4.8

oh, thank you so much, I’m going to do it now and i tell you if all it’s ok!

You know how to select another build target?

Just in case, or for future drivers by


all perfect!! I did it via CLI
Thank you for all!!!

Thanks for the help @ScruffR!

I know this is a bit old but I am having the same issue…
System firmware target "default (0.7.0)"
On the device (0.6.0)

Is there something glaring I’m missing…?

Probably, but how would we know without some more background of your actual issue?

Apologies for lack of detail.

Here is screenshot with error.

What is interesting is this is identical code to what was compiling without issue about 6 months ago.
This is why I am assuming it is some update to the complier/firmware I am missing.

Double check for what system version you are building the project.

If you post a SHARE THIS REVISION project snapshot assisting you with such issues is easier.

Thank you again for your help and support.


The problem is in the ThingSpeak library.
In the most recent version the actual implementation got muddled up.

Unless the original contributor migrates his library to Libraries v2.0 format the easiest way from here would be to use this

I see what you mean…

I couldn’t get your link to bring anything up for me.

I went and looked at the actual code on github fro ThingSpeak and was able to get it to work by copy and pasting as my own .cpp and .h

Thanks for your help.

1 Like