Questions tagged [switch]

In electrical engineering, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another

Filter by
Sorted by
Tagged with
1
vote
3answers
165 views

using a switch case with a 5-position switch and serial output

I'm trying to get started on developing a menu system for my LCD1602. I have a Parallax 5-position switch (up,down,left,right,center) and I would like to interface the two. I've been trying to get ...
0
votes
1answer
46 views

Trying to switch a 5v fan with a LiPo and can't figure our what's wrong at full duty cycle

I have a simple project where I want to turn a 5v fan on/off and both the MCU and fan will powered by a LiPo battery. I'm powering the ESP and fan directly from the battery in the attached circuit. ...
0
votes
0answers
36 views

Slider switch not working as expected [duplicate]

I have a task to make an intelligent traffic light with automatic and manual mode. A slider switch sets which mode is active, but it doen't work for the manual mode. When I slide it to automatic, the ...
0
votes
0answers
39 views

multiple button switch case how to add counter [duplicate]

I want to add counter in multiple-buttons-to-control-relays: int relay1 = 23; int relay2 = 25; int relay3 = 27; int relay4 = 29; int relay5 = 31; int relay6 = 33; int relay7 = 35; int relay8 = 37; ///...
1
vote
3answers
167 views

How to use this 3-pin slide-switch?

I purchased these slide switches recently because I want to use them in my project: But I don't know what to connect up the three pins to and I can't find any information about them online. Nor can ...
0
votes
1answer
41 views

How to use this Toggle Switch?

I purchased this toggle switch recently because I want to use it in my project: But I don't know what to connect up the three pins to and I can't find any information about it online. Nor can I find ...
0
votes
1answer
23 views

Correct position for buttonState in my FSM

I wrote a FSM with the help of some tutorials through out the world wide web and so far it does what I want to do with it. But one thing that is not the way I want to be, is to exit the state ...
0
votes
1answer
32 views

How to code an arduino to execute a particular code using a slide switch

I’m pretty new to arduino. I need help concerning a project I’m making. I’m using a SPDT slide switch to switch between what code(method) should be executed.i.e when I shift the switch to the left, ...
-1
votes
1answer
45 views

How can I make my Arduino Esplora program start on the press of a button and then continue to run without me having to hold the button down? [closed]

I am trying to create a program where the main code starts on the press of a button. I am using an Arduino Esplora, and I want to have the built-in LED be blue when I plug in the power until I press ...
0
votes
0answers
54 views

What is the best way to replace the buttons inside a car remote chip so that it can be controlled via Arduino?

I have a car remote that looks like the following I would like to replace the buttons with some sort of switch or relay that can be programmatically controlled via an arduino unit. Would a simple ...
0
votes
1answer
36 views

Running in loop or once according to a slide switch position

I have a question. I made a system which includes a servo, a stepper and a wiper motor :) All these parts has one job to do and I can code it. But, I want to make 2 modes in this system Single ...
1
vote
0answers
35 views

default in switch doesn't appear to execute

I have a situation where the default case in my switch statement doesn't appear to execute as expected. I wonder if there is some subtlety I'm missing here? Given the following enum: enum ...
0
votes
2answers
97 views

How to toggle LED and motor on button press?

we want to have a LED turn on with the press of a button, and become brigther and brighter as times go by (whithin a defined time frame), and when it reaches maximum brightness to turn off for a ...
0
votes
0answers
23 views

ESP8266 connected to a HIGH pin and DPDT only works sometimes. Works everytime if connected to 3V3 pin

I have a Wemos D1 Mini hooked up to a DS2Y-S-DC3V DPDT switch. When I have the coil ends are hooked up to a pin (D2) and ground, it will click when I set the pin HIGH. It should click again when it ...
-1
votes
1answer
38 views

Control 4 digital outputs with one switch

I want to control 4 digital outputs (d0, d1, d2, d3) with one switch. When the Arduino starts, they should all be in state LOW. Now, after pressing the button once, d0 should get HIGH. Another push ...
0
votes
0answers
130 views

Made a light controller for the holidays

I am a new the world of Arduino. I found on YouTube, how to build a light controller (https://www.youtube.com/watch?v=WvG9c84ApFA&t=39s). I follow every step but it doesn't work. Here are some ...
0
votes
2answers
175 views

LCD screen won't stop printing the same characters twice

I'm hoping that someone might be able to help me figure out how to prevent my LCD from giving me double digits (i.e. 55, 66, 77 - instead of 5,6,7); I have 2 functions that are printing, so I'm ...
0
votes
0answers
254 views

How can I make a fingerprint scanner to work as a toggle for a servo motor using Arduino Uno?

Arduino Fingerprint Project Help Please!! I am a beginner and using Arduino Uno, a fingerprint sensor and a servo motor to build a door lock (school science project). I followed many videos and ...
0
votes
2answers
51 views

Cycling through switch states

I'm making a desk lamp out of 2x WS2811 strips (attached to the triple ports at top right of board below). The brightness of the strips is controlled by a potentiometer, and the colour by a switch. ...
1
vote
0answers
52 views

Turning on controller with button and turning off with a timeout

I am making a device controlled by an ESP 8266 and am wanting to save power by having it power down when not in use. The desired behavior is for a momentary button press or vibration sensor activation ...
-1
votes
1answer
622 views

Using an NPN transistor as a switch to turn on/off a DC Motor

I am trying to control a 3V DC motor (FA-130) with my Arduino Uno, and am trying to do that using an NPN transistor (2N3904) as a switch, as shown in this diagram. I used the Blink example and ...
0
votes
1answer
78 views

New to arduino, help wiring relay

I am new to arduino and need some help. I just baught light bars for my jeep and wiring harnesses with them, the harnesses come with buttons and I wanted to replace the button and have them controlled ...
4
votes
1answer
118 views

Can I use an AC signal to make an LED light up with arduino?

I want to use a 220VAC load as a signal and act as a switch to my arduino so Labview could interpret it as an LED ON state. I used a 4n33 octocoupler but it seems that the LED Simulation on labview ...
0
votes
2answers
25 views

Encoder coupled with motor shaft.Encoder is giving larger redings than expected

I am a rookie and i dont have much experience on arduino. please help me. I intend to build a robot that will drive on a straight path even on nonuniform surfaces like the ones we see in agricultural ...
1
vote
1answer
61 views

My Code turns on my LED even when my switch is not pressed

I am trying to create a circuit that will turn my motor when I clap. When the first limit switch is low, and there is only one clap, a solenoid pin is supposed to be engaged (currently an LED), but ...
1
vote
2answers
552 views

LED on same Pin as Toggle Switch, not illuminating

I am trying to do something I think should be relatively simple. I would like to read an input from a toggle switch, and have a red 5mm LED indicate the state of the switch. Rather, however, than have ...
0
votes
0answers
37 views

How to measure multiple voltages (Thermocoupes)

How would one measure many (20-100) small voltages in the 0-80mV range with an Arduino? I will need to amplify them and put them into the ADC. But i also need to switch between them. I want to ...
0
votes
1answer
187 views

Switch Statement stuck in loop

I am writing a code for a user to enter a 4 digit pin, then use this pin later to unlock a box. The loop is stuck between the "ready to unlock box" and "enter pin" it just keeps flipping between ...
1
vote
0answers
43 views

How can I get the count of pulses of two encoders on the serial monitor?

I have two encoders; I connected them to pin 2 and 3 and I want to count the pulses of them to make two DC motors to work until it reaches a specified number of pulses, than stop working. I have ...
0
votes
1answer
176 views

Replace 6 pin on/off switch on Power Bank with 3pin or 2pin?

I'm looking to finish up my project in a box and i'm using a battery bank to power the Leonardo micro pro and other components. The bank has a little on/off which on it which has 6 pins underneath. ...
2
votes
1answer
411 views

Is this a good way to filter noise due to vibration in limit switch?

I have a circuit connected as follows my limit switches which are attached to my structure sometimes gets falsely triggered, so I wrote this code to address it. My motor is supposed to go down skip ...
0
votes
1answer
142 views

Replace mechanical switch with electrical switch or relay

I have a remote controller for a portable heater, and working on a small project to be able to control the fan on/off from an arduino with Bluetooh HM-10 module. I thought a solenoid might work by ...
0
votes
0answers
672 views

Nested “switch” statements menu

I know that menus were discussed perhaps a thousand times here and everywhere. But using a ready solution is not something that I'm looking for because I know I won't learn the concept if I use them. ...
0
votes
2answers
639 views

Using a toggle switch to run part of a sketch

First, I am a beginner for this. I just ordered my first book on coding Arduino and I'm working through some simple applications using a DS3231 (that has a temperature reading), LCD, MicroSD card ...
2
votes
1answer
110 views

Digital Input using a button doesn't work properly when using it to control a relay

I'm trying to control a relay both via Bluetooth and using a switch. The problem is that, when the LED is off, I can turn it on with the switch but then if I turn off the switch the relay will stay on....
-1
votes
1answer
78 views

Sketch starts and keeps counting on external power supply but not usb

Thank you for the add, total newbie here (electronics and arduino) on his first project. Trying to make a counter for a hay baler with two HAL effect sensors, (pin 5 & 6) and outputting to an I2C ...
0
votes
3answers
572 views

Defining array in switch case

I’m completely new to arduino, so be polite. I’m trying to program my esp32 to drive neopixels as seven segment display. So I take a digit and pass it to switch case and in switch case I mention which ...
-1
votes
1answer
74 views

Adding a switch to control log interval [closed]

HI this is a code for a set of logging scales. What I want to do is to add a switch that changes the logging from the set time of 1000 mills to either 5000 mills or 10000 mils depending on the switch ...
1
vote
4answers
446 views

How to boil down analog input to just three cases?

I am investigating the use of a 3-position-switch for one of my projects to switch between different settings using just one analog input pin. For the three positions I am using ground/0V, ~2.5V (via ...
-1
votes
2answers
287 views

Is there a key switch for Arduino? [closed]

I am trying to make a launch controller, which will turn on with a key. Like the one in this photo below:
0
votes
1answer
1k views

Arduino DC motor with 2 buttons

I have a problem with my Arduino project and I tried everything to fix it but nothing helps. I am trying to rotate my DC motor with two buttons: one button is to stop/start rotating on left side, ...
0
votes
1answer
760 views

TinkerCAD switch seems to be not working (always closed)

I am using TinkerCAD to simulate the functionality of a slide switch. Please comment if you think this question is off-topic. /* LiquidCrystal Library - Hello World Demonstrates the use a 16x2 ...
2
votes
2answers
693 views

Calculate sensor unique address with a 8 position DIP Switch

I have a large amount of sensor boards that I need to be able to configure setting unique addresses. Each sensor is attached to it's own arduino, I'm using a 8 position DIP switch for setting the ...
0
votes
3answers
686 views

Need help with a program for a button to change the display on an OLED display

So I am programming an OLED display from my Arduino Uno. I am trying to have a button that switches the different words on the display. (The words are just placeholders for programs as of now.) My ...
2
votes
1answer
152 views

How can I make a power button for my project powered by a USB powerbank? [closed]

I've solved the battery power supply issue for my Arduino project by simply connecting a USB powerbank. However, I just realised that I can't come up with a good way to add an on/off button! There ...
0
votes
1answer
99 views

Which transistor I should use to switch 12V 0.8A? [closed]

I am have circuit with Arduino NANO and I need to control air valve, which is powered with 12 Volts and 0.8 Amper. Problem is that Arduino NANO is powered with 5 volts. I want to use transistor to ...
-1
votes
2answers
92 views

Button Switch arduino

I'm trying to use my button as a switch (the led goes on after I push the button and the led goes off when I push the button again). I know I have the right circuit, because I also used a code from ...
0
votes
1answer
359 views

Transistor as switch for signal and high current buzzer [closed]

I'm a newbie in transistor switching. I have PIR sensors with C and NC onboard. NC is 12 V signal that I need to switch transistor (bipolar?) to emit 3.3 V (collector connected to 3.3 ...
0
votes
1answer
827 views

Arduino Uno Motor control using 2 Relays, 2 Limit switches and Bluetooth. Forward Reverse Stop

Modified existing project from this link: Problem : Trigger limit switch to stop DC motor I modified this code to control two relays which are wired to motor poles for Forward or Reverse movements ...
0
votes
2answers
936 views

Can i use a range in a switchcase like in pascal?

in pascal's case statement i can use this: Var i : integer; ... Case i of 1..5 : DoSomething; end; i was wondering if there is a way in can do this with c/c++ in the arduino compiler using:...