In: Electrical Engineering
What would be the wiring setup and coding using an Arduino for a display of the temperature of the room it is in?
Coding using an Arduino for the display of the temperature of the room it is in is given below
#include <SPI.h>
#define BLYNK_PRINT Serial
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <dht11.h>
dht11 DHT11;
SimpleTimer timer;
char auth[] = ""; // write your auth code here
void setup()
{
DHT11.attach(2); // connect pin 2 to the sensor
Serial.begin(9600);
Blynk.begin(auth); // start blynk server and connect to the cloud
while (Blynk.connect() == false) {
// Wait until connected
}
void loop()
{
int chk = DHT11.read();
Blynk.virtualWrite(1, DHT11.temperature); // Write values to the app
Blynk.virtualWrite(2, DHT11.humidity);
Serial.println(DHT11.temperature);
Blynk.run();
timer.run();
}
