Created
November 6, 2020 18:00
-
-
Save lennonjesus/408f3c7821953282d2538bba9a4dfa69 to your computer and use it in GitHub Desktop.
test.ino
This file contains hidden or 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
#include "DHT.h" | |
#define DHT22_PIN 2 | |
#define DHT22_TYPE DHT22 | |
DHT dht22(DHT22_PIN, DHT22_TYPE); | |
#define UV_APIN A0 | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("Setup..."); | |
dht22.begin(); | |
pinMode(UV_APIN, INPUT); | |
delay(500); | |
} | |
void loop() { | |
delay(2000); | |
Serial.println("===== DHT22 ====="); | |
float hum22 = dht22.readHumidity(); | |
Serial.print("Humidade: "); | |
Serial.println(hum22); | |
float temp22 = dht22.readTemperature(); | |
Serial.print("Temperatura: "); | |
Serial.println(temp22); | |
delay(2000); | |
Serial.println("===== UV ====="); | |
int valorSensor = analogRead(UV_APIN); | |
Serial.print("Valor analógico UV: "); | |
Serial.println(valorSensor); | |
int tensao = (valorSensor * (5.0 / 1023.0)) * 1000; | |
Serial.print("Tensao UV: "); | |
Serial.println(tensao); | |
delay(2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment