Codey OnlineArduino- & ESP32-Komponentenbibliothek › Relay Module 5V
Relay Module 5V
Ausgabe

Relay Module 5V

5V-Relaismodul mit High-Trigger

Breite: 38.1 mm

Pinbelegung — Relay Module 5V

Pin Signal Beschreibung
- ground GND pin 5V
+ power 5V VCC pin 5v
S digital Signal 3V - 5V
NO Normally open
COM Common
NC Normally Closed

Beispielschaltplan — Relay Module 5V

Von Nach Kabel
board:GND x1:- black
board:5V x1:+ red
board:D7 x1:S green

Arduino-Beispielcode — Relay Module 5V

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

// Relay Module 5V - Canonical Beginner Example
// This sketch switches the relay ON and OFF every 2 seconds.
// Wiring:
// Arduino GND -> relay -
// Arduino 5V  -> relay +
// Arduino D7  -> relay S

const int RELAY_PIN = 7;

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("Relay module demo starting...");
}

void loop() {
  digitalWrite(RELAY_PIN, HIGH); // Many 5V relay modules are active HIGH
  Serial.println("Relay ON");
  delay(2000);

  digitalWrite(RELAY_PIN, LOW);
  Serial.println("Relay OFF");
  delay(2000);
}

Ähnliche Komponenten

3W amplifier MAX98357A I2S DAC

3W amplifier MAX98357A I2S DAC

Active Buzzer Module

Active Buzzer Module

⚙️

LED

LED Matrix Module MAX7219

LED Matrix Module MAX7219

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten