0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

リレーモジュールを使ってみた

Last updated at Posted at 2023-02-18

amazonで購入したこちらのリレーモジュールをArduino Nanoから制御してみました.

Screenshot from 2023-02-18 14-00-39.png

配線

Screenshot from 2023-02-18 14-01-53.png

[DCプラスに接続] --- Arduino 5V
[DCマイナスに接続] --- Arduino GND
[信号トリガーターミナル] --- Arduino D2

プログラム

relay_on_off.cpp
#include <Arduino.h>
#define RELAY_PIN 2
void setup() {
    pinMode(RELAY_PIN, OUTPUT);
    Serial.begin(9600);
}
void loop() {
    Serial.println("Hello Arduino");
    digitalWrite(RELAY_PIN, HIGH); delay(1000);
    digitalWrite(RELAY_PIN, LOW);  delay(1000);
}

結果

IMG_7392_AdobeExpress.gif

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?