#include <DHT.h>
#define Type DHT11
int sensePin=8;
DHT HT (sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
int ButtC=9;
int ButtF=10;
int ButtL=11;
int LightVal;
int LightP=A0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
HT.begin();
delay(setTime);
pinMode(LightP,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
humidity=HT.readHumidity();
tempC=HT.readTemperature();
tempF=HT.readTemperature(true);
LightVal=analogRead(LightP);
if (ButtC==HIGH) {
Serial.print("C");
Serial.println(tempC);
}
if (ButtF==HIGH) {
Serial.print("F");
Serial.println(tempF);
}
if (ButtL==HIGH) {
Serial.print("Light= ");
Serial.println(LightVal);
}
}
#include <DHT.h>
#define Type DHT11
int sensePin=8;
DHT HT (sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
int ButtC=9;
int ButtF=10;
int ButtL=11;
int LightVal;
int LightP=A0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
HT.begin();
delay(setTime);
pinMode(LightP,INPUT);
pinMode(ButtC,INPUT_PULLUP);
pinMode(ButtF,INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
humidity=HT.readHumidity();
tempC=HT.readTemperature();
tempF=HT.readTemperature(true);
LightVal=analogRead(LightP);
if (digitalRead(ButtC)==HIGH) {
Serial.print("C");
Serial.println(tempC);
}
if (digitalRead(ButtF)==HIGH) {
Serial.print("F");
Serial.println(tempF);
}
if (digtalRead(ButtL==HIGH)) {
Serial.print("Light= ");
Serial.println(LightVal);
}
}
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.