Arduino with Megnetic/Reed Switch.
Автор: Roshan Geeks
Загружено: 2023-10-04
Просмотров: 404
Описание:
Thanks For Watching :
Arduino with Megnetic/Reed Switch. #Shorts #short #viralshorts #arduino
Welcome to our tutorial on Arduino Uno Reed Switch Door Open/Close Detection! In this
video, we will guide you through
the process of setting up and programming a reed switch
sensor with an Arduino Uno board
==================================
Parts Used: Arduino Uno Board
Small Bread Board
LED Bulb
220 Ohms Resistor
Reed Switch Module
==================================
Arduino Code :
const int reedSwPin = 2; // Define the digital pin connected to the Reed switch
const int ledPin = 13;// Define the digital pin connected to the red LED
void setup() {
pinMode(reedSwPin, INPUT); // Set the Reed switch pin as an input with internal pull-up resistor
pinMode(ledPin, OUTPUT);// Set the LED pin as an output
}
void loop() {
int reedState = digitalRead(reedSwPin); // Read the state of the Reed switch
if (reedState == HIGH) { // If the Reed switch is triggered (magnet nearby)
digitalWrite(ledPin, HIGH); // Turn ON the red LED
} else {
digitalWrite(ledPin, LOW); // Turn OFF the red LED
}
}
=========================================
Don't forget to subscribe to Roshan Geeks for more exciting tech projects!
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: