
This circuit uses a directional switch to control two LEDs (one red and one green). Depending on the switch position, either the red or green LED will be illuminated, powered by a 3.7V source from the MAHIR 1.mini component.

A Directional Switch is an electronic component that allows for the control of current flow within a circuit. It can be toggled or actuated to redirect the flow of current to different paths, making it an essential component in various applications such as:

This circuit uses a directional switch to control two LEDs (one red and one green). Depending on the switch position, either the red or green LED will be illuminated, powered by a 3.7V source from the MAHIR 1.mini component.

This circuit consists of four DC motors controlled by three directional switches and powered by a single power supply. The directional switches are configured to selectively connect either the positive or negative supply to the motors, allowing for control of the motors' direction. There is no microcontroller code provided, indicating that the motor direction control is purely hardware-based using the switches.

This circuit uses a directional switch to control two LEDs (one red and one green). Depending on the switch position, either the red or green LED will light up, with each LED connected in series with a 200-ohm resistor to limit the current, powered by a 3.7V source.

This circuit consists of four 12V geared motors and two directional switches, all powered by a single 18650 Li-Ion battery. The directional switches are used to control the polarity of the voltage applied to the motors, allowing for the reversal of motor direction. The battery's negative terminal is connected to one terminal of each motor, while its positive terminal is connected to the input of both directional switches, which then selectively power the other terminals of the motors.
| Pin Number | Description | Notes |
|---|---|---|
| 1 | Common Pole | Connects to the circuit's input |
| 2 | Normally Open (NO) | Connects to the first path |
| 3 | Normally Closed (NC) | Connects to the second path |
Q: Can I use the directional switch with an Arduino UNO? A: Yes, the directional switch can be used with an Arduino UNO to control the flow of current to different parts of a circuit.
Q: How do I know if my directional switch is working correctly? A: You can test the switch using a multimeter to check for continuity or by observing the behavior of the circuit when the switch is actuated.
Q: What should I do if the switch is not switching properly? A: Check for any physical obstructions, ensure the switch is properly mounted, and verify that the electrical connections are secure.
Below is an example code snippet for using a directional switch with an Arduino UNO to control an LED:
// Define the pin numbers
const int switchPin = 2; // The pin where the switch is connected
const int ledPin = 13; // The pin where the LED is connected
void setup() {
pinMode(switchPin, INPUT_PULLUP); // Set the switch pin as an input with an internal pull-up resistor
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}
void loop() {
// Read the state of the switch
bool switchState = digitalRead(switchPin);
// If the switch is closed, turn on the LED
if (switchState == LOW) {
digitalWrite(ledPin, HIGH);
} else {
// If the switch is open, turn off the LED
digitalWrite(ledPin, LOW);
}
}
In this example, the directional switch is connected to pin 2, and the LED to pin 13. When the switch is closed, the LED turns on; when the switch is open, the LED turns off. The INPUT_PULLUP mode is used to enable the internal pull-up resistor, which ensures a default high state when the switch is open.