Created
January 7, 2018 17:13
-
-
Save iampaulidrobo/785469251c02a37ce01a02d1efb27939 to your computer and use it in GitHub Desktop.
Node MCU things speak code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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