Quantcast
Channel: ThingSpeak IoT Community - All Forums
Viewing all articles
Browse latest Browse all 1833

mdahlb on Thingspeak and Wemos D1 Mini

$
0
0

Hello Tim

I have managed to read the last value (a temperature) from my private thingspeak channel with a Wemos D1 mini.. just replace the XXXXX in the code below with your personal settings:

 

#include "ThingSpeak.h"
#include <SPI.h>
#include <ESP8266WiFi.h>

char ssid[] = "XXXXXXX"; // your network SSID (name)
char pass[] = "XXXXXX"; // your network password

WiFiClient client;

unsigned long myChannelNumber = XXXXXXX;  // your channel number
const char * myReadAPIKey = "XXXXXX";  // your read api key

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, pass);
ThingSpeak.begin(client);
}

void loop() {
float temperature = ThingSpeak.readFloatField(myChannelNumber, 1, myReadAPIKey);  // reads a float, in this case a temperature
Serial.print("Last temperature: ");
Serial.print(temperature);
Serial.println(" *C");
delay(15000);
}


Viewing all articles
Browse latest Browse all 1833

Trending Articles