Interfacing Slide Switch and Led with Arduino:

interfacing

Instructions

Objective:

Learn how a slide switch works as a digital input to control an LED output based on switch position.

Steps to Perform:

  1. Click "Start Simulation" to power up the Arduino circuit
  2. Click on the slide switch to toggle its position
  3. Observe how the LED turns ON when switch is in HIGH position
  4. Click the switch again to toggle back
  5. The LED will turn OFF when switch is in LOW position

Key Concepts:

  • Slide Switch: Two-position switch that maintains its state (ON/OFF)
  • Digital Input: Switch provides HIGH (5V) or LOW (0V) signal
  • Digital Output: Arduino writes HIGH/LOW to LED pin to control it
  • digitalRead(): Reads switch state from digital pin 10
  • digitalWrite(): Sets LED pin HIGH (ON) or LOW (OFF)
Arduino Code - main.ino