Sale!

4-Way Lever Switch 2.54mm – 2 Pieces

Original price was: 2,24 €.Current price is: 1,72 €. Excluding VAT

The 4-way toggle switch is ideal for controlling multi-directional devices in Arduino projects. Great for precise control of various functions.

Available on back-order

Domande su questo prodotto? Scrivi a Lana su WhatsApp

Category:

🎬 The product on video

Description

What it is

The 4-way toggle switch 2.54mm is an electronic component that allows you to select among four different options. It can be used to control multi-directional devices in Arduino or similar projects.

Features

  • 4-way
  • 2.54mm pitch
  • 2 pieces per pack

What it is for

The 4-way toggle switch is ideal for controlling multi-directional devices in Arduino projects. It can be used for example to:

  • Select different settings of a device
  • Control the flow of current to different sections of a circuit

For Arduino compatibility, check the datasheet.

Tutorial: How to use 4-way Toggle Switch 2.54mm

The 4-way toggle switch 2.54mm is a fundamental component for electronic projects that require selection between multiple options. Perfect for beginners and intermediate makers, it allows for simple and reliable management of electrical flow.

What you need

  • Arduino
  • Connection wire
  • Test pin

Steps

  1. Install the switch on a breadboard.
  2. Connect the switch pins to the Arduino digital pins using connection wires.
  3. Write and upload the Arduino sketch to test the switch.
  4. Verify that the switch works correctly by changing the lever positions.
  5. If necessary, adjust the connections to ensure a stable connection.

Example code

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
}

void loop() {
  int val = digitalRead(2);
  if (val == HIGH) {
    Serial.println("Posizione 1");
  }
  val = digitalRead(3);
  if (val == HIGH) {
    Serial.println("Posizione 2");
  }
  val = digitalRead(4);
  if (val == HIGH) {
    Serial.println("Posizione 3");
  }
  val = digitalRead(5);
  if (val == HIGH) {
    Serial.println("Posizione 4");
  }
}

Mini project

Create a small prototype that changes the LED brightness based on the switch position. Use the Arduino digital pins to control the LED PWM output value.

Common mistakes

  • Unstable or intermittent connections.
  • Default switch positions incorrect.
  • Pins not configured correctly in Arduino.
  • Error reading the logical value of the switch.

Recommended accessories

  • Breadboard
  • Arduino Uno
  • Connecting cables
  • LED

Frequently asked questions

Which pins should I use?
Use the digital pins on the Arduino to connect the switch.

How can I test the switch?
Load the test sketch and check the Serial console to see the switch positions.

Can I use this switch with other microcontrollers?
Yes, but make sure the input/output pins are compatible.

Reviews

There are no reviews yet.

Be the first to review “4-Way Lever Switch 2.54mm – 2 Pieces”

Your email address will not be published. Required fields are marked *