EASIEST ARDUINO CODE TO CONTROL LIGHT,FAN, SOCKETS e.t.c using node MCU and relay(part 1)
Автор: Mohztec
Загружено: 2021-03-01
Просмотров: 130
This video shows the simplest and most understandable code to control any AC circuit (fan, socket, light etc) using node MCU and relay.
Normally Closed configuration (NC):
HIGH signal – current is flowing
LOW signal – current is not flowing
Normally Open configuration (NO):
HIGH signal – current is not flowing
LOW signal – current in flowing
You should use a normally closed configuration when the current should be flowing most of the times, and you only want to stop it occasionally.
Use a normally open configuration when you want the current to flow occasionally (for example, turn on a lamp occasionally).
#.....................................…..#
check the codes below...
/**
MOHZTEC AUTOMATION TRAINING (SESSION 1)
**/
const int relay = 26;
void setup() {
Serial.begin(115200);
pinMode(relay, OUTPUT);
}
void loop() {
// Normally Open configuration, send LOW signal to let current flow
// (if you're using Normally Closed configuration send HIGH signal)
digitalWrite(relay, LOW);
Serial.println("Current Flowing");
delay(5000);
// Normally Open configuration, send HIGH signal stop current flow
// (if you're using Normally Closed configuration send LOW signal)
digitalWrite(relay, HIGH);
Serial.println("Current not Flowing");
delay(5000);
}
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: