2.21 Relay Module

Overview

In this lesson, you will learn about Relay Module.

Fritzing Circuit

In this example, we use Power Supply Module to power the load,use LED as an example.

../_images/image187.png

Schematic Diagram

../_images/image188.png

Code

Note

  • You can open the file 2.21_relayModule.ino under the path of sunfounder_vincent_kit_for_arduino\code\2.21_relayModule directly.

  • Or copy this code into Arduino IDE 1/2.

  • Or click Open Code to open it in Web Editor.

  • Then Upload the Code to the board.

Once the codes are uploaded to the Mega2560 board, you can see that the Relay Module controls the closing and breaking of the external circuit, which will change its working state a second. For detailed code explanation, refer to 1.2 Digital Write.

Phenomenon Picture

../_images/image189.jpeg