Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
0
votes
1answer
228 views

Play .Wav sound only once on switch change [closed]

I have a project where if you change the value of the spdt switch the colour of the LEDs change. As well as this a .wav file plays. The problem is I only want the .wav to play once. At the moment it ...
-1
votes
2answers
52 views

Why the program keeps applying what is in loop in first case and stops in the second one? [closed]

In the first program after removing hand from the button it keeps on, means it keeps applying what is in the loop: int led = 13; int button = 12; void setup() { pinMode(led, OUTPUT); pinMode(...
1
vote
2answers
686 views

Use of array in case statement

I want to know how I can use case statement for each array. Below is my code: int incomingByte = 0; void setup() { Serial.begin(115200); for (int thisPin = 2; thisPin < 6; thisPin++) { ...
0
votes
1answer
233 views

What is wrong with my state machines?

My goal is to make an automatic gate and garage door, and it has a servo as the lock mechanism on the gate, and alarm systems that notify when the gate or garage door is open too long, more than the ...
0
votes
2answers
400 views

Alternative of relay

I am carrying out a physics experiment using an Arduino. This experiment requires accurate time measurements of upto a millisecond. However I am using a relay to turn on/off an electromagnet and there ...
0
votes
1answer
2k views

Problem : Trigger limit switch to stop DC motor

I want to make a project about automatic gate and garage door via Android app and connected by HC-05 bluetooth module. Each of the gate and garage door have two limit switches(located at each end of ...
-1
votes
1answer
29 views

How do I write a program that turns on both on board LEDS ONLY when BOTH switches are ON [closed]

int btn1=0; int btn2=0; void setup() { // put your setup code here, to run once: pinMode(GREEN_LED,OUTPUT); digitalWrite(GREEN_LED,HIGH); pinMode(RED_LED,OUTPUT); digitalWrite(RED_LED,HIGH)...
1
vote
1answer
433 views

Help: Using if-else on two switch state

Problem I'm stuck on triggering different switch. I'll explain what each of my switch should do. Output of this setup : No output from relayPin mainPin Main power of the switch to control relayPin ...
0
votes
2answers
312 views

Loop one specific case inside of a switch

I want to loop one specific case inside of my switch, until the button gets pressed a second time. How can i make this work? Code: const int ledrood = 9; const int ledgroen = 10; const int ledblauw =...
2
votes
1answer
5k views

Button with switch timer and reset time function + LED feedback. What am I doing wrong?

Beginner here. I´ve been trying to implement a button function timer working with millis() instead of delay as I want the button to be responsive while the timer is running. So far I´ve managed to ...
0
votes
2answers
205 views

Why it's not possible to manipulate the TWSR directly? [closed]

I think I forgot the reason for this SFR manipulation in microcontrollers; like, checking the TWSR in twi. The technique for checking the values of the TWSR is by masking it with another variable or ...
1
vote
0answers
665 views

Switch on/off LED 24V using a MOSFET

I try to switch on/off IKEA Ledberg LEDs which are powered with 24 V using the setup from this tutorial video: https://www.youtube.com/watch?v=sVyi7yWuXxs I use a IRLB8721PBF MOSFET. When I switch ...
1
vote
1answer
149 views

How to reset an arduino while being able to know which button has been pressed?

Context I keep the board in sleep mode and want to wake it with different buttons. I need to know which button has been pushed on boot. In the following schematic, SW-R is actually used to reset the ...
0
votes
1answer
280 views

Modify On board 4 pin switch to work with Arduino

I have a HDMI Switch module which switches Input signals. It has a 4 pin push button to switch inputs. ( - ) I want to modify the button in order to control it with an Arduino. (push via Arduino ...
0
votes
2answers
99 views

Door sensors on every cabinet in the kitchen

At this point, I have yet to actually touch an Arduino. I'm toying with the RPi3 along with Home Assistant, but I'm always thinking of ways to do useless things that are fun. Let's say I had a ...
-1
votes
2answers
789 views

Using Arduino or ESP8266 as a switch to turn on a 12V DC Fan

I am new to the community and this is my first question. Hope it turns out to be a nice question :) Me and my friend are preparing a senior design project on home automation. I have several things in ...
0
votes
1answer
108 views

Code runs, then doesn't run after I add some routine code

I am programming an ESP8266-01. I have this code which I am using to operate an on-off switch, which is being used as an override switch for when the relay is turned on and off over the internet: ...
0
votes
1answer
2k views

digitalRead not reading input pin of ESP8266-01

I am trying to use a on-off switch with the ESP8266 to change whether GPI02 is HIGH or LOW. I am using GPIO3 as input. My circuit looks like this: The red area to the right is a relay, I wasn't sure ...
-1
votes
3answers
91 views

How to switch on or off up to seven devices individually? [closed]

Is there a way to turn on or off the power supply of up to seven hard drives with the help of an Arduino? Or maybe there is another way to ultimately - but restorable - prevent read/write access to ...
2
votes
3answers
180 views

Controlling 10+x 5m led strips with 10+ individual analog floor switches

I am looking to control around 10 (exact number TBD) non-addressable 5m led strips with an Arduino. Each led strip will be activated when a corresponding DIY analog floor switch. The idea is to have ...
1
vote
0answers
461 views

Difficulty connecting arduino ethernet with PC using a switch

Facing difficulty connecting arduino ethernet(w5100) with PC using a switch (Dlink). When both are connected directly(p2p) using ethernet cable, arduino device can be pinged. However, when connected ...
0
votes
1answer
21 views

Arduino: Digitally Muti-Switch - What is the proper term for hardware?

I have recently purchased a RoboMower. Like most of the automated mowers these use electric-fence wiring to mark the borders of the property and keep a small charge on those wires so that the mower ...
1
vote
2answers
2k views

Menu with switch case not behaving correctly

I hope this the right place to post this question :) I'm trying to display a menu on a SSD1351 OLED display, to which I communicate with U8glib. I'm trying to obtain an Init screen, then, with a long ...
1
vote
3answers
416 views

Photoresistor and another switch

I am using the circuit diagram below to turn ON/OFF the lights using Photo-resistor. How can I use the Arduino to bypass the Photoresistor effect? Let say I want to turn ON the lights even though ...
1
vote
2answers
395 views

ATtiny85 soft-latching, and sensor-waking: Are multiple switches differentiable by pin change interrupt?

I am using a vibration switch with a pin change interrupt on an ATTiny85 to wake the processor and run some code when the vibration switch grounds an input pin. The circuit is battery-powered, so ...
0
votes
1answer
160 views

How to control RC power switch with Arduino-/Adafruit-Board?

I want to control (switch on/off) a solenoid valve via an RC power switch and an Adafruit M0 Feather Bluefruit LE. The RC power switch is this one, and this is the Adafruit Board Pinout. My ...
2
votes
3answers
2k views

Button and switch to turn on and off LED and changing after time

I have system connected to an Arduino Uno where I want to read whether the switch is open or closed. Based on if the switch is open/closed, I want an LED light to turn on/off. When the switch is ...
0
votes
1answer
248 views

Switch setting 'running' state boolean doesn't hold

I have a rotary encoder and I want to use the switch to stop the rest of my code running, essentially switching off what I have going on. I have this boolean running = true; void setup() { ...
3
votes
1answer
513 views

Choosing the right mosfet to switch on-off a neopixel strip

I,m trying to find the right mosfet or transistor to switch on-off a neopixel strip to safe battery power on a Lipo 3.7v using a pro mini 3.3v. My Animation-Setup and Power Comsumption with 35 ...
1
vote
1answer
61 views

Switching low current AC [closed]

What is the simplest way to switch ON/OFF a 60v and 5 mA of current ? I don't want the common relays for arduinos as they make click noise.
1
vote
1answer
763 views

Smooth out digital signal from SW-420 vibration sensor in order to record duration?

I'm attempting to make a sensor that will record the duration and frequency of a pump going off. It always fires for at least 4 seconds, but the duration can be up to 7 days. The vibration sensor I ...
0
votes
1answer
112 views

Switch to drive Arduino and optocoupler

At the moment I have a switch that connects to a digital pin on an Arduino as per the schematic below. (Obviously there is an pull-up resistor on the pin). simulate this circuit – Schematic ...
1
vote
2answers
528 views

Attiny85: Watchdog does not initialize properly when using switch(case)

I have a project in which I am putting my ATtiny85 to sleep. Here is the watchdog configuration (in the setup) that works just fine: void setup() { /* Setup the LCD */ lcd.init(); ...
4
votes
2answers
321 views

Why digital pin not reading ON from push button switches connected to 5V and pull-down 10K resistor?

Here's my circuit: And the code: //pins const int control1 = 2; const int control2 = 3; const int enable = 9; const int pinDirection = 4; const int pinOnOff = 5; const int pot = A0; //states ...
1
vote
0answers
251 views

How to recreate this basic ALPS switch board in Arduino?

I want to recreate this existing ALPS switch board (the board on the left) in Arduino, so I can control the switches (and 3 memory + 1 menu buttons) from my laptop. The ALPS switch board connects to a ...
-1
votes
1answer
48 views

How to use to two different programs into one stkech

I am currently using relay module, but I am facing a problem that, when Arduino pins are LOW then all relay are going HIGH, so I want to use this code so that when arduino starts all pins are getting ...
0
votes
0answers
77 views

Term for Two-Channel Analog Switch Module/Digital MUX

I'm looking for this 16-channel item: ...But just 2 channels. Basically one lead tells if the singal lead should travel down path A or path B. The advantage it has over the 16-channel is that it only ...
0
votes
2answers
742 views

I need a simple, low power, low cost wireless switch to transmit to Arduino

I'm looking for a very simple wireless, low-power, low-cost switch that can transmit a signal to an Arduino. Ideally, each transmitter would have a signature. For instance, let's say I had 4 different ...
1
vote
4answers
1k views

Pulldown resistors and multiple switches

Maybe this is a question for Electronics SE but I’m not a member there yet so hopefully someone will have an answer here. I did an experiment with having some push-to-make buttons connected to my Uno....
0
votes
2answers
495 views

How can I make this button toggle the position of a servo?

I am trying to make something so when I press the button it sets the position of the servo to 50 and then when I press it again, it sets it to 150. The button is momentary not a toggle switch. This is ...
0
votes
1answer
315 views

Intermittent LOW reading from input pin set to INPUT_PULLUP

i have an output pin connected to a magnetic reed switch. The pin mode is INPUT_PULLUP. When the switch is closed, it connects the pin to GND and drags the pin to a LOW reading. I check the state of ...
-1
votes
1answer
72 views

const int re-declaration - memory leakage

I am re-declaring a const int variable a few times in a switch-case statement of a function as shown following: void functionB(type param1, type param2, ..., const int paramConstInt = 100); void ...
0
votes
2answers
553 views

Switch a 12V 3.3A component from an Arduino

I need turn off and turn on component from an Arduino UNO. How can I do that? I am thinking about some transistor (IRF 530N) but I am not sure about it. Please give me a beginner advice how to ...
1
vote
2answers
992 views

Need Help in circuit diagram of 8*8 reed switch matrix

I am designing 8*8 reed switch matrix which will be connected to Arduino. I am using Arduino Duemilanove. I have completed the matrix portion but don't know how to connect and where to connect the ...
0
votes
1answer
67 views

Problem with executing a function in the middle of a 'nested for loop'

New to Arduino here. I was wondering if there was anything wrong about my utilization of the nested 'for loop'. What i wanted is the execution of the 'looper4' and 'looper6' function if any of my ...
1
vote
1answer
1k views

Switch case problem in Arduino code

I am trying to develop an IR remote for appliances. I have written Arduino code for this purpose. I have used switch case to determine an action from the corresponding IR decode result (HEX), but I am ...
0
votes
2answers
931 views

Why is my switch not working?

I'm trying to have a common light switch turn a LED on and off. When I connect the light switch directly to a LED, it works like it should - the LED turns on and off with the switch. When I connect ...
1
vote
0answers
223 views

Adding a kill switch for servos with states - blink without delay code

I have many LEDs and two servos connected to one Arduino Uno, and the servos are programmed to move randomly indefinitely. However, I would like to install a kill switch for the servos by reading a ...
2
votes
3answers
612 views

Is there a cheap relay that can control voltage from stuff like bulb lights with a 5 V control output?

I need to power a light bulb or something like 110 V or 220 V at normal amperage for TV or something at that range like a fan... My micro-controller is an Arduino with 5 V out and 12 V max out trough ...
1
vote
1answer
43 views

LED and Switch Compolation Error Arduino 101

I'm getting an error on line 9 for some reason, (digitalWrite(Sender, HIGH);), and I just cant figure out why. My goal is to have two sets of flashing patterns, one for each switch state. I don't know ...