Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code for Particle Core/Photon to upload readings from SHT11 to
#include "ThingSpeak/ThingSpeak.h"
#include "SHT1x/SHT1x.h"
// configurations:
TCPClient client;
unsigned long myChannelNumber = REPLACE_WITH_YOUR_CHANNEL_NUMBER;
const char * myWriteAPIKey = "REPLACE_WITH_YOUR_API_KEY";
// Channel 1 is Temperature (deg C)
// Channel 2 is Humidity (%)
//SHT11 Configuration:
#define dataPin D0
#define clockPin D1
SHT1x sht1x(dataPin, clockPin);
void setup() {
void loop() {
float temp_c;
float humidity;
temp_c = sht1x.readTemperatureC();
humidity = sht1x.readHumidity();
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(20000); // ThingSpeak will only accept updates every 15 seconds.
You can’t perform that action at this time.