Skip to the content.

CÁC LINH KIỆN DÀNH RIÊNG CHO DÒNG BOARD WEMOS D1 MINI

Màn hình oled 0.66”

Màn hình oled 0.66"

D1 mini trên board GPIO trên MCU Oled Shield
D1 5 SCL
D2 4 SCA

Relay (Rơ le) đơn kênh AC 250V

Relay (Rơ le) đơn kênh AC 250V

D1 mini trên board GPIO trên MCU Relay Shield
D1 5 Điều khiển relay tắt bật

Relay chính hãng cho phép cấu hình để chuyển từ chân mặc định D1, thành chân pin khác. Tuy nhiên, loại rẻ tiền không thể.

/*
 * Relay Shield - Blink
 * Turns on the relay for two seconds, then off for two seconds, repeatedly.
 *
 * Relay Shield transistor closes relay when D1 is HIGH
 */

const int relayPin = D1;
const long interval = 2000;  // pause for two seconds

void setup() {
  pinMode(relayPin, OUTPUT);
}

void loop() {
  digitalWrite(relayPin, HIGH); // turn on relay with voltage HIGH
  delay(interval);              // pause
  digitalWrite(relayPin, LOW);  // turn off relay with voltage LOW
  delay(interval);              // pause
}