Created
August 23, 2019 22:36
-
-
Save IoTPanic/7a8266965345a6aebf46a8f4b950e677 to your computer and use it in GitHub Desktop.
Simple ESP Temp Sensor
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
#define BLYNK_PRINT Serial | |
#include <WiFi.h> | |
#include <WiFiClient.h> | |
#include <BlynkSimpleEsp32.h> | |
#include "config.h" | |
unsigned long i = 0; | |
float sample(){ | |
uint16_t tt = analogRead(A2); | |
float temp = tt*3.3/4096.0; | |
temp = temp - 0.5; | |
temp = temp / 0.01; | |
return temp*2; | |
} | |
void setup() { | |
pinMode(A2, INPUT); | |
Serial.begin(9600); | |
Blynk.begin(auth, ssid, pass); | |
Serial.println("Connected!"); | |
} | |
void loop() { | |
Blynk.run(); | |
if (millis()-i>=10000){ | |
Blynk.virtualWrite(V0, sample()); | |
i = millis(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment