Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iampaulidrobo/785469251c02a37ce01a02d1efb27939 to your computer and use it in GitHub Desktop.
Save iampaulidrobo/785469251c02a37ce01a02d1efb27939 to your computer and use it in GitHub Desktop.
Node MCU things speak code
//Code by Piyush Tailor
#include <ESP8266WiFi.h>;
#include <WiFiClient.h>;
#include <ThingSpeak.h>;
const char* ssid = "Baaa";
const char* password = "naaaaaaa";
int val;
int tempPin = A0;
WiFiClient client;
unsigned long myChannelNumber = !!!!;
const char * myWriteAPIKey = "!!!!!!";
void setup() {
Serial.begin(115200);
delay(10);
WiFi.begin(ssid, password);
// Connect to WiFi network
ThingSpeak.begin(client);
}
void loop() {
val = analogRead(tempPin);
float mv = ( val/1024.0)*500;
Serial.print("TEMPRATURE = ");
Serial.print(mv);
Serial.print("*C");
Serial.println();
delay(1000);
ThingSpeak.writeField(myChannelNumber, 2,mv, myWriteAPIKey);
delay(100); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment