To jest moduł przekaźnika 5V z jednym kanałem, przeznaczony do przełączania obciążeń o wyższym napięciu lub większym prądzie za pomocą sygnału sterującego niskiego napięcia. Strona obciążenia jest znamionowana do AC250V 10A lub DC30V 10A, dzięki czemu nadaje się do podstawowych projektów automatyki domowej i sterowania.
| Pin | Sygnał | Opis |
|---|---|---|
NC |
Normally-closed relay contact, connected to COM when relay is not energized | |
COM |
Common relay contact for the switched load circuit | |
NO |
Normally-open relay contact, connected to COM when relay is energized | |
GND |
ground | 0V ground reference for the 5V control input side |
VCC |
power | 5V supply input for the relay module coil and control circuitry |
IN |
digital | Active-low logic control input; drive low to energize the relay |
| Z | Do | Przewód |
|---|---|---|
board:5V |
x1:VCC |
red |
board:GND |
x1:GND |
black |
board:D7 |
x1:IN |
green |
Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.
// Canonical example for a 5V 1-channel relay module
// The relay input is active-low:
// LOW = relay ON
// HIGH = relay OFF
const int RELAY_PIN = 7;
void setup() {
pinMode(RELAY_PIN, OUTPUT);
Serial.begin(9600);
while (!Serial) {
;
}
// Start with the relay turned off.
digitalWrite(RELAY_PIN, HIGH);
Serial.println("Relay module example started.");
Serial.println("Sending LOW turns the relay ON, HIGH turns it OFF.");
}
void loop() {
Serial.println("Relay ON");
digitalWrite(RELAY_PIN, LOW);
delay(1000);
Serial.println("Relay OFF");
digitalWrite(RELAY_PIN, HIGH);
delay(1000);
}
Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.
Zacznij za darmo