Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@imiconsystem
Last active May 18, 2021 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imiconsystem/46b924a918ef2203bc4fa43ed4b7d689 to your computer and use it in GitHub Desktop.
Save imiconsystem/46b924a918ef2203bc4fa43ed4b7d689 to your computer and use it in GitHub Desktop.
int relay1 = 23;
int relay2 = 19;
int relay3 = 18;
int relay4 = 32;
int relay5 = 25;
int relay6 = 26;
int relay7 = 14;
void setup() {
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(relay5, OUTPUT);
pinMode(relay6, OUTPUT);
pinMode(relay7, OUTPUT);
}
void loop() {
digitalWrite(relay1, HIGH);
delay(200);
digitalWrite(relay1, LOW);
digitalWrite(relay2, HIGH);
delay(200);
digitalWrite(relay2, LOW);
digitalWrite(relay3, HIGH);
delay(200);
digitalWrite(relay3, LOW);
digitalWrite(relay4, HIGH);
delay(200);
digitalWrite(relay4, LOW);
delay(200);
digitalWrite(relay5, HIGH);
delay(200);
digitalWrite(relay5, LOW);
digitalWrite(relay6, HIGH);
delay(200);
digitalWrite(relay6, LOW);
digitalWrite(relay7, HIGH);
delay(200);
digitalWrite(relay7, LOW);
delay(500);
}
@imiconsystem
Copy link
Author

#include "DHT.h"

#define DHTPIN 4 // D5,D4,D15

#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
dht.begin();
}

void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed");
return;
}
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment