Skip to content

Instantly share code, notes, and snippets.

@IoTPanic
Created August 23, 2019 22:36
Show Gist options
  • Save IoTPanic/7a8266965345a6aebf46a8f4b950e677 to your computer and use it in GitHub Desktop.
Save IoTPanic/7a8266965345a6aebf46a8f4b950e677 to your computer and use it in GitHub Desktop.
Simple ESP Temp Sensor
#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