Loading
Loading
IoT Lab content is currently available in Arabic only. We're working on an English version.
عرض بالعربية →How to switch a home light bulb through Arduino safely.
Relay power: VCC, GND, and IN to Arduino. High-voltage side: the cut wire connects to COM (Common) and NO (Normally Open) terminals.
const int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH); // بعض موديلات الريلاي تعمل بـ LOW لتشغيلها
delay(5000);
digitalWrite(relayPin, LOW);
delay(5000);
}Connecting both wires (live and neutral) inside the relay — this will cause a massive short circuit and explosion when the relay triggers. The relay cuts only ONE wire, just like a regular wall light switch.