Вернуться на страницу библиотеки модулей
const int RELAY_PIN = 10;
void setup() {
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW); // relay off at startup
}
void loop() {
// KY-019 is active-HIGH: HIGH energises the coil
digitalWrite(RELAY_PIN, HIGH); // relay ON — COM connects to NO
delay(1000);
digitalWrite(RELAY_PIN, LOW); // relay OFF — COM connects to NC
delay(1000);
}
Рекомендованные ссылки:
Arduino 5V Relay Module KY-019 (CW-019) — Pinout, Wiring & Code
KY-019 5V Relais – SensorKit
Sensor Wiki: KY-019 Relay Module – The Geek Pub
Using the 5V Single Relay Module KY-019 with Arduino – Phipps Electronics
5V Relay Module KY-019 (for arduino)