/**
example ESP model used during remote classes
*/
#include <WiFi.h>
#include <ESP32Ping.h>
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
// serial configuration
Serial.begin(9600);
// pins configuration
pinMode(15,INPUT);
pinMode(14,OUTPUT);
analogReadResolution(10);
// wi-fi configuration
Serial.print("Connecting to WiFi");
WiFi.begin("Wokwi-GUEST", "", 6);
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println(" Connected!");
}
void loop() {
// TASK 0
// measure temperature with sentc temperature sensorsor
// https://wokwi.com/arduino/projects/299330254810382858
int analogValue = analogRead(15);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print("Temperature: ");
Serial.print(celsius);
Serial.println(" ℃");
// set the diode
if(celsius>=35)
digitalWrite(14, HIGH);
else
digitalWrite(14, LOW);
// TASK 1
// implement communication with the worl using WI-FI
// use ESP32Ping library https://github.com/marian-craciunescu/ESP32Ping
bool ret = Ping.ping("www.google.com");
delay(1000);
}