-
-
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); | |
} |
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(500);
digitalWrite(relay1, LOW);
digitalWrite(relay2, HIGH);
delay(500);
digitalWrite(relay2, LOW);
digitalWrite(relay3, HIGH);
delay(500);
digitalWrite(relay3, LOW);
digitalWrite(relay4, HIGH);
delay(500);
digitalWrite(relay4, LOW);
digitalWrite(relay5, HIGH);
delay(500);
digitalWrite(relay5, LOW);
digitalWrite(relay6, HIGH);
delay(500);
digitalWrite(relay6, LOW);
digitalWrite(relay7, HIGH);
delay(500);
digitalWrite(relay7, LOW);
delay(1000);
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
digitalWrite(relay5, HIGH);
digitalWrite(relay6, HIGH);
digitalWrite(relay7, HIGH);
delay(5000);
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
digitalWrite(relay5, LOW);
digitalWrite(relay6, LOW);
digitalWrite(relay7, LOW);
delay(1000);
}
#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 ");
}
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
// the number of the LED pin
int relay1 = 23;
int relay2 = 19;
int relay3 = 18;
int relay4 = 32;
int relay5 = 25;
int relay6 = 26;
int relay7 = 14;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(relay5, OUTPUT);
pinMode(relay6, OUTPUT);
pinMode(relay7, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
digitalWrite(relay5, HIGH);
digitalWrite(relay6, HIGH);
digitalWrite(relay7, HIGH);
} else {
// turn LED off:
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
digitalWrite(relay5, LOW);
digitalWrite(relay6, LOW);
digitalWrite(relay7, LOW);
}
}