Pushbutton Question Answered

I have been taking apart Gameboys and keyboards. These devices have buttons or keys that you push to play a note. When I take it apart, I dont see pushbotton switches like id expect. Instead I see a rubber form with a little black dot on it, and when you press it, the black dot touches a black surface on a PCB. Anyone know how this works?

Question by crocboy 8 years ago  |  last reply 8 years ago


Arduino Pushbutton interrupt?

So I've hooked up my Christmas lights to some solid state relays and hooked those to my Arduino and I have some interesting patterns of lights that I can make. But I would like to be able to turn the lights on and then press a push button and have one light pattern start and then press that same button again and get a second pattern and so on. I've gotten that to work, the only problem is, the patters are quite lengthy (5-10 seconds) and I don't want to have to hold the button until the pattern is over. So how do I use the interrupt function (or one like it) to stop the function and start a new one as soon as the button is pressed?

Question by jeffrey_stjean 5 years ago  |  last reply 5 years ago


How to get a arduino to use 3push buttons as inputs, and output a different signal on a speaker

Hey all,  I am new to the whole arduino using world.  I have a project that uses 3push buttons, a  breadboard, arduino, lcd display, and speaker. The goal is to write program to play a certain freq. signal through the speaker, (each pushbutton has it's own frequency for the signal) when each of the buttons is pushed, and also display each signal on  the LCD display while doing it.

Question by dsm5286 6 years ago  |  last reply 6 years ago


Pushbutton Servo Control with a 555

I've found numerous write-ups on getting a servo working with a 555 IC but it's not quite the functionality that I'm looking for. What I'm trying to do is have two buttons go to a predetermined position but the write-ups have two buttons that just go clockwise or counterclockwise. I know this can be done with an Arduino but I'm trying to avoid that route so I can keep the footprint as small as possible. I've attached a picture of the schematic I was working from.

Topic by XAlliedYouthX 5 years ago  |  last reply 5 years ago


were can you buy additional Arduino pushbuttons? Answered

Question by Pat the taco 10 years ago  |  last reply 10 years ago


Can I wire a momentary contact pushbutton to do multiple things?

So I am wiring an arcade, I want a momentary contact pushbutton to activate a 110 vac device whenever I press it, thats fine, but I also want to activate a button on my keyboard encoder when that pushbutton is pressed...... Can I do this without frying the keyboard encoder? they share a difference ground the encoder and the electrical device

Topic by Negativecreep0 9 years ago  |  last reply 9 years ago


Arduino Game

Hi everybody, I'am a newbie with my first Arduino project. I want to make a 2 player game, where the player who fastest can activate a pushbutton 30 times is the Winner. There should also be 6 LED's to indicate the Progress for each player. The Winner will be saluted with a blinking LED effect,  Any suggestion on how to do this.. Best regards

Topic by Arthur1699 4 years ago  |  last reply 4 years ago


How to wire a switch

Hi I would like to know how this switch should be wired up. I am using it on a drill press. It has 2 relays 1/ nc zb2-be102 2/ no zb2-be101. Any help would be much appreciated. Thanks ratjack

Topic by ratjack 2 years ago  |  last reply 2 years ago


truth table to boolean expression or schematics Answered

Need help converting the truth table to boolean expression or even better, schematics 1. i don't know electronics too much 2. i am not a student nor is this an assignment simply looking for help in converting this truth table

Question by 32teeth 9 years ago  |  last reply 9 years ago


How to connect a physical pushbutton to a display to trigger an animation.

I'm trying to figure out how I would set up a physical pushbutton so as to trigger an animation once pushed.  The programming language I'm using is processing, and the content would be played on a 32" screen.  So I'm trying to figure out what type of hardware I would need (circuit boards, pushbuttons..etc) in order for this to work.  Thank you in advance to anyone that offers some advice.  P.S. I also have little knowledge in programming this is a project so I can become more familiar with it. Thanks!! 

Topic by SarahinaB 3 years ago  |  last reply 3 years ago


is there a pushbutton ir remote using arduino?

Ive been trying to make a 3 button IR remote using arduino to work with my tv (or anything with a remote) and have a decoder already, if theres a pushbutton ir remote code out there even for just 1 button, i can always ajust my decoder to work with any code i just need a code to work with

Question by dudesurge 7 years ago  |  last reply 7 years ago


How do I switch a Push button Switch to a toggle switch?

I bought EL wire and the power is a push button switch and would like to know how i could change it to a toggle switch also if anyone knows how to change it from battery powered to powered by the car ild greatly appreciate it for that I was thinking of using a fuse tap though

Question by alphashark45 6 years ago  |  last reply 6 years ago


adding a push-button

Howdy! I'd appreciate any advice regarding this potential project.  I would like to take a regular old basic laser pointer and hack it so that I can turn it on and off with a push button, at a short distance, and connected by wire.  The original device may have a rubber button on the side or back, or maybe it's turned on with a twist, or maybe something else. That would have to be left 'on' -- or, better yet, bypassed.  Because I want to be able to activate it by pressing and holding down a button, just like a doorbell. (I suppose flashlights and any number of other devices would work similarly.) For the project I have in mind, having the switch hard-wired to the device would be fine, but naturally I'd love to hear about anyone's wireless ideas! Thanks so much!!!!!

Topic by Purple Chez 4 years ago  |  last reply 4 years ago


Need help with changing arduino code for more servos Answered

This code makes a continuous rotation servo motor turn on and run until you let go of the button. I need to change this sketch so that there are 3 buttons, instead of 1, and if I press 1, a continuous rotation servo would turn for each button until I let go of the button. #include Servo myServo; int servoPin = 2; int buttonPin = 7; int buttonState = 0; void setup() {   // put your setup code here, to run once: pinMode(buttonPin, INPUT); myServo.attach(servoPin); } void loop() {   // put your main code here, to run repeatedly: buttonState = digitalRead(buttonPin); if (buttonState == HIGH) {   myServo.write(0); }else{   myServo.write(90); } delay(15); }

Question by Orange robot 2 years ago  |  last reply 2 years ago


Arduino coding to allow separate push buttons to turn led on and off? Answered

I am new to the Arduino and have yet to use one. I understand a little about how to program the Arduino and would like to know more specifically about push buttons. I know that I will most likely have to use "edge detection" to determine when the push button is pressed. I don't want to have a push button turn an led on if pressed and if pressed again turn it off. I want to separate the on and off into two different buttons. When i push the first button it will always turn the LED circuit on even if i press it twice. When i push the second button it will always turn the LED circuit off no matter how many times it gets pressed. Is this possible, and if so how do i code it?

Question by mcguyverzboss 7 years ago  |  last reply 3 years ago


Problem with LCD backlight

Hello everybody,  I'm here to ask a question I'm not able to solve on my own. I'm not good at programming, so it may be a silly question, but I can't find a solution. I'm building an Arduino based humidity and temperature monitoring system, with three DHT-11 sensors and a display to show readings from them. I'd like to be able to toggle LCD's backlight on with a pushbutton and have the code switch it off after a while. I can't  figure out how to make Arduino do it. All I could make till now is Arduino switching backlight ON at the beginning of the code regardless of the buton being pressed or not.  Here is the code I wrote, I bolded the part relative to the pushbutton. Can anyone help me, please? #include "DHT.h"                    // include DHT sensor library code #include           // include lcd display library code LiquidCrystal lcd(12, 11, 5, 4, 3, 2);     // Initialize lcd on these pins #define DHTPIN A0          // sensor1 1 #define DHTPIN2 A1         // sensor 2 #define DHTPIN3 A2         // sensor 3 // Uncomment whatever sensor type you're using! #define DHTTYPE DHT11   // DHT 11 //#define DHTTYPE DHT22   // DHT 22  (AM2302) //#define DHTTYPE DHT21   // DHT 21 (AM2301) // Initialize DHT sensor for normal 16mhz Arduino DHT dht(DHTPIN, DHTTYPE); DHT dht2(DHTPIN2, DHTTYPE); DHT dht3(DHTPIN3, DHTTYPE); #define light_button 8 #define backlight_pin 13 int val; int state; void setup() {   Serial.begin(9600);   lcd.begin(16, 2); // set up the LCD's number of columns and rows:   dht.begin(); // enable DHT sensors   pinMode(light_button, INPUT);   pinMode(backlight_pin, OUTPUT);   state = 0; } void loop() {   val = digitalRead(light_button);     Serial.println(val);        if(light_button != state){       digitalWrite (backlight_pin, HIGH);     }     else {       digitalWrite (backlight_pin, LOW);     }         // READING SENSOR 1   // Reading temperature or humidity takes about 250 milliseconds!   // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)   float h1 = dht.readHumidity();   float t1 = dht.readTemperature(); // Read temperature as Celsius   float hi = dht.computeHeatIndex(t1, h1); // Compute heat index lcd.setCursor(5, 0);           // Print values from sensor 1 on lcd   lcd.print("Teca 1"); lcd.setCursor(0,1);   lcd.print("Umidita': ");   lcd.print(h1);   lcd.print("%"); delay(3000);                 // Show humidity value for 3 seconds lcd.setCursor(0,1);          // Switch to temperature visualization   lcd.print("Temperat: ");   lcd.print(t1);   lcd.print("C"); delay(3000);                // Show temperature value for 3 seconds // READING SENSOR 2   float h2 = dht2.readHumidity();      // Read humidity   float t2 = dht2.readTemperature();   // Read temperature as Celsius     float hi2 = dht.computeHeatIndex(t2, h2);  // Compute heat index   lcd.setCursor(5, 0);            // Print values from sensor 2 on lcd   lcd.print("Teca 2");   lcd.setCursor(0,1);   lcd.print("Umidita': ");   lcd.print(h2);   lcd.print("%"); delay(3000);                      // Show humidity value for 3 seconds lcd.setCursor(0,1);              // Switch to temperature visualization   lcd.print("Temperat: ");   lcd.print(t2);   lcd.print("C"); delay(3000);                    // Show temperature value for 3 seconds // READING SENSOR 3     float h3 = dht3.readHumidity();   float t3 = dht3.readTemperature();      // Read temperature as Celsius     float hi3 = dht.computeHeatIndex(t3, h3);    // Compute heat index     lcd.setCursor(5, 0);                      // Print values from sensor 3 on lcd   lcd.print("Teca 3");   lcd.setCursor(0,1);   lcd.print("Umidita': ");   lcd.print(h3);   lcd.print("%"); delay(3000);                      // Show humidity value for 3 seconds lcd.setCursor(0,1);                // Switch to temperature visualization   lcd.print("Temperat: ");   lcd.print(t3);   lcd.print("C"); delay(3000);                      // Show temperature value for 3 seconds }

Question by ade angelis 4 years ago  |  last reply 4 years ago


Radioshack Submini Pushbutton Switch (275-1571) - Bulk?

I am looking to buy Radioshack's Submini Pushbutton Switch in bulk. I really can't seem to find it online anywhere.The package says that it is custom manufactured in China. I need to buy about 50, and possibly even more in the future, and with Radioshack's prices, it will be a pain to blow $75 for 50 switches.Thanks for your help.

Topic by Brennn10 10 years ago  |  last reply 9 years ago


Pololu pushbutton power switch module control issue

Hello all: I'm using the low-voltage version of the Pololu pushbutton power switch module to power up/down an Arduino Mini project.  You can see it here: http://www.pololu.com/catalog/product/751/resources It works great, with an exception; if someone presses the single Pololu power switch while the Arduino is ON, it powers it off again. This may be normally what you want, but it isn't in my case.  I'd like the circuit to act like this: 1- wait for button press 2- push button 3- Pololu applies power to Arduino 4- Arduino boots up, loops until 30 seconds has passed.  After 30 seconds, send POWER OFF signal to Pololu. 5- Pololu powers Arduino down. 6- goto 1 It works like that, BUT if someone presses the button again during that 30 seconds, the Pololu powers the unit off right away.  I'd like to somehow disallow that, electronically. Anyone have any ideas? Thanks, Jim

Topic by jimlips 7 years ago


How to connect physical pushbuttons to a computer for use in a soundboard program?

I plan to do a project that will use 28 arcade style pushbuttons to activate 28 different sounds on a computer. Any ideas on products out there I can use to connect all 28 buttons to a computer, preferably with a USB cable, so it can be used in a programming language such as C++? One idea I had was to take apart a QWERTY keyboard, but I still want to be able to use my regular keyboard to use my computer. Alternatively, is there a way for two keyboards to be connected to same computer, but one of them only activates a specific program? i.e. trying to type in notepad with it wouldn't work?

Topic by Swordmasterb 5 years ago  |  last reply 5 years ago


How to reset arduino after pressing the pushbutton 16 times?

Good afternoon, I'm trying to reset my Arduino after pressing the pushbutton 16 times. What I'm currently experiencing is that it is not resetting. I'm trying to achieve this using the StateChangeDetection example. Could anyone give me tips on how to achieve this? I'm working on this using an Multi Function Shield or MFS. My code is: // this constant won't change: const int  buttonPin = A1;    // the pin that the pushbutton is attached to const int ledPin = 13;       // the pin that the LED is attached to // Variables will change: int buttonPushCounter = 0;   // counter for the number of button presses int buttonState = 0;         // current state of the button int lastButtonState = 0;     // previous state of the button int count = 0; void setup() {   // initialize the button pin as a input:   pinMode(buttonPin, INPUT);   // initialize the LED as an output:   pinMode(ledPin, OUTPUT);   // initialize serial communication:   Serial.begin(9600); } void loop() {   // read the pushbutton input pin:   buttonState = !digitalRead(buttonPin);   // compare the buttonState to its previous state   if (buttonState != lastButtonState) {     // if the state has changed, increment the counter     if (buttonState == LOW) {       // if the current state is HIGH then the button went from off to on:       buttonPushCounter++;       Serial.println("on");       Serial.print("number of button pushes: ");       Serial.println(buttonPushCounter);     } else {       // if the current state is LOW then the button went from on to off:       Serial.println("off");     }     // Delay a little bit to avoid bouncing     delay(50);   }   // save the current state as the last state, for next time through the loop   lastButtonState = buttonState;   // read the state of the pushbutton value:   buttonState = digitalRead(buttonPin); //Source: https://www.instructables.com/answers/Is-there-a-way-to-count-button-pushes-on-an-arduin/ if (buttonState == HIGH) {        // turn LED on:       digitalWrite(ledPin, HIGH);     count++;               // add 1 to the count     if (count >= 8) {       count = 0;     }   }   else {     // turn LED off:     digitalWrite(ledPin, LOW);   } }

Question by DanielB804 1 year ago  |  last reply 1 year ago


Need help with arduino code for running motor with potentiometer and pushbutton.

I am running a motor in one direction for agricultural purposes. I am currently using some code I found to change the sporadic nature of the motor with a potentiometer and PWM. I found code which will use the potentiometer and this is successful and currently in use (built the whole 12v switch circuit using the Tip122). Now I want to be able to use a push button to retain the sporadic nature of the potentiometer when the push button is pushed once and have the motor be constant when the push button is pushed a second time.  I am stumped about how to do this, I am a beginner to the arduino code and trying to get better. I was wondering if someone might have an answer to how to program this. I've included the current code below. int potPin = 2;    // select the input pin for the potentiometer int ledPin = 13;   // select the pin for the LED int val = 0;       // variable to store the value coming from the sensor void setup() {   pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT } void loop() {   val = analogRead(potPin);    // read the value from the sensor   digitalWrite(ledPin, HIGH);  // turn the ledPin on   delay(val);                  // stop the program for some time   digitalWrite(ledPin, LOW);   // turn the ledPin off   delay(val);                  // stop the program for some time }

Question by daleruisky 7 years ago  |  last reply 7 years ago


Arduino Script Issue?

Hey world, I am making device that will automatically water my xmas tree: I am using the basic "button" script from the Arduino IDE examples. the only change I have made so far is instead of using an actual push button I am sticking 2 bare copper wires(the ground has a 10k resistor) into a jar.  When water is added to the jar the connection is made and the LED goes on. The problem is that it only stays on for like 7 seconds. I need it so as long as there is water in the cup the light stays on. any ideas? Below is a copy of the script. Thanks! const int buttonPin = 2;     // the number of the pushbutton pin const int ledPin =  13;      // the number of the LED pin // variables will change: int buttonState = 0;         // variable for reading the pushbutton status void setup() {   // initialize the LED pin as an output:   pinMode(ledPin, OUTPUT);   // initialize the pushbutton pin as an input:   pinMode(buttonPin, INPUT); } void loop() {   // read the state of the pushbutton value:   buttonState = digitalRead(buttonPin);   // check if the pushbutton is pressed. If it is, the buttonState is HIGH:   if (buttonState == HIGH) {     // turn LED on:     digitalWrite(ledPin, HIGH);   } else {     // turn LED off:     digitalWrite(ledPin, LOW);

Question by Mpc1055 1 year ago  |  last reply 1 year ago


What's the simplest way to trigger a pushbutton or common grounded circuits from a computer, except from LPT1? Answered

Hi every one, I have did a lot of searching on internet, and found lots of ways for control leds and eletric devices from computers. By LTP1, COM ports, and others most expensive ways, like using a usb->lpt1 true emulator to work ok on win7. I'm asking if anyone know how can I control pushbuttons and eletrical devices, from the computer using a easy and cheap way, it can be anything, microcontrollers, usb port. I prefer the cheapest one of course. But any advice will be great. If anyone need more details please just leave a message. Thank you.

Question by Raziel_LOK 7 years ago  |  last reply 7 years ago


Using a Push Solenoid as a finger press to start video game console...Help please

Ok guys so Basically I have a plastation 2 console in my arcade machine, I want to be able to turn it on via a arcade pushbutton on the outside of my machine. The idea I have is to use a linear push solenoid to act as a finger to press the power button on the front of the ps2 everytime i press that pushbutton........ Is this possible? what type of push solenoid do I need....eg. 12v? size etc.... and can I use a momentary contact pushbutton to power on the solenoid momentarily to do a single press of the playstation 2 power button? Thanks for any help... P.S. I have very little knowledge of robotics or servos and solenoid usage....but I can solder, wire, etc....

Topic by Negativecreep0 9 years ago  |  last reply 9 years ago


How to connect higher voltage to PIC chip input reliably ?

The PICAXE 08M2+ IC is just an 8-pin flash PIC with nanowatt... I have been working on my 3000mW handheld laser monitoring system for ages. It is a picaxe 08M2 connected to an LED, a buzzer through a transistor, a thermistor, and an 8.4V input. It is almost perfect, the problem I have isn't really serious, but I want to make it perfect. Now read carefully what happens: The picaxe comes on when the laser's "armed" keyswitch is turned. An on/off pushbutton then controls turning the laser on/off, all the while the picaxe is still on. The PICAXE runs off a 78L05 connected to 8.4V. If I turn on the PICAXE, it works all fine as usual. When I turn on the laser (1.5A load), it is still perfectly fine due to the 0.22uF capacitor I put on the PICAXE 5V rail! BUT, if the laser pushbutton had been left on, and you turn the armed switch on, the laser comes on as usual, but the PICAXE doesn't boot. If I turn the laser pushbutton off then on, even for a millisecond, the PICAXE boots and works fine from then on. Now here is how it is wired up, I want the PICAXE to know when the laser is on, so I connected the pushbutton to INPUT3 on the PICAXE so INPUT3 gets power along with the laser when the pushbutton is pressed. I realise that the 8.4V input is too high for the PICAXE, so I experimented with resistors and discovered that a 47K resistor between the 8.4V and the INPUT3 worked fine (with a 10K pulldown). I have checked and it is not a software problem. What I don't get is why the PICAXE stays working fine when the laser load is turned on, but not if they are both turned on at the same time. The attached drawing is to help explain my set up. See how the PICAXE only fails to boot if the laser on/off switch was already on when the main keyswitch is turned on. If I turn the laser pushbutton off then on, even for a millisecond, the PICAXE boots and works fine from then on. I hope it wasn't too hard to understand...

Question by jdorne 6 years ago  |  last reply 6 years ago


Can a normally open on/off pushbutton switch close without the button being pushed?

Hi all,I'm not an electrician, now it's said.I'm building a device containing a small on/off (latching) switch. When the switch is pushed, the device is activated and remains active until the batteries run out. The device will only be activated once, and afterward it's discarded. This means that the switch will only be pressed once in its lifetime.The use of the switch is to press the button to make the spring drive the contact point to rotate and close the circuit.The device must not be unintededly activated as it could have severe consequences. The button is protected to prevent from this, but I need to know the probability that the switch itself closes, due to a failure.The manufacturer (Chinese) just tells me "don't worry" so I need a second opinion. Is there a way to estimate the probability over a 3 year period? Because if there is a risk at all, I might need to add an extra switch to create a "double commando".Thanks for your help./Karolina

Question by karolina81 10 months ago  |  last reply 10 months ago


How would I set up a trigger on one relay with multiple pushbutton inputs?

I'm looking to set up a 12 volt system that has approximately 12 buttons that will each trigger an individual relay and a shared relay.  So I will have 13 relays (numbered 1-13) and 12 buttons (1 -12) - Button 1 will trigger relay #1 and #13, Button 2 will trigger relay #2 and #13, etc.  Wiring up a single relay circuit is easy enough, and I think I can set it up with an arduino or similar IC, but I'm looking for a discrete circuit design.  Would a simple diode on each circuit leg be enough?  If not, what would I need?

Question by chrispaccord 1 year ago  |  last reply 1 year ago


LT Spice Switches?

I have a simple question... If anyone here knows about the program LTSpice, is it possible to create switches that are manual, like pushbutton switches, spdt/dpst/etc., not automatic switches?

Question by 101yummYYummy101 9 years ago  |  last reply 3 years ago


arduino program led to light up on pin 13 if i press a pushbutton 3 times?

I need to know the function to use and an example would be very helpful thanks and any help is appreciated

Question by sarju7 5 years ago  |  last reply 5 years ago


How do you make a remote bluetooth command pushbutton that integrates with Raspberry Pi and smartphones?

I'm looking to create a simple, small remote control with a single command pushbutton that transmits over bluetooth. I want to be able to integrate this function with a smartphone or a Raspberry Pi Zero W, similar to a remote camera shutter button that could fit into a rubber/silicon type ring/sleeve attachment to fit around a water bottle, for example. I've got very limited experience in this so any help would be greatly appreciated! I've found some similar tutorials but nothing specifically for what I'm looking for in a small envelope. Thanks!

Question by sam r wilson 1 year ago


What can I make with this?

So, I have a few random components and I'm bored. What project could I make with this stuff? - 2 7ft sections of 18 gauge magnet wire - Unwound ferrite core transformer - 2 Rocker switches - VCR Lcd screen (PT6955) - 3 photoflash capacitors - 50v 2200 uf electrolytic cap. - 2 1.5A 120v Pushbutton switches, 1 red, 1 black - 4 lead pushbutton switch - 6v button cell pack - 1 white led, 6mm - 2 small speakers - 6 small pushbutton switches - 2 fuses, 125v1.6vA, and 25v315A - Tiny microphone - 3 lead IR sensor - 2 2lead IR sensors - Ring electromagnet, bunch of coils - small motor - large motor - large vibrating motor - 4 9v battery clips - 1 "C" battery holder - Encoder from VCR, only the bearing, no electronics - Halogen table lamp transformer, 110v to 12v - AC Motor Rotor - Heavy duty transformer - RF Modulator If it needs anything else I can buy it, just that it uses parts from this list. Thanks.

Question by LiquidLightning 8 years ago  |  last reply 8 years ago


pinouts of an mp3 player module? Answered

I have an mp3 player module whch i took out from a home theatre main unit. I want to know the use of some features or the pins which are given in it because i am a beginner to electronics and stuff. I am using it as a player using headphones because it needs amplifier to play in speakers, but headphones work with medium sound. It has usb and sd card port for input. Also have 3 pushbuttons , play pause, next , previous. It has the following pinouts. Basic ones which I know: +5v  GND L_OUT R_OUT These must be for pushbuttons: P4.1 GND P4.2 P1.2 P4.4 (but there are only 3 buttons)??? IR (this could be infrared remote control) These I want to know what are for??? +5v GND SDA     SCL P5.7 RST

Question by akki5230 4 years ago  |  last reply 4 years ago


Schematics for a one way RF Relay/Switch?

So my plan is to have a small remote with a single pushbutton that when pressed will close a relay on the reciver, I would like it to have a pretty good range of at least 1000 Meters. I thought of using XBees and Arduinos but i only need the signal one way and only a single channel. Any ideas?

Topic by tomtortoise 7 years ago  |  last reply 7 years ago


I want to build a temperature sensor, any idea?

I'm having problems connecting the wires together and my code is not compiling please help? #include #include SevSeg sevseg; LEDDisplay *led; int ledPin = 9; int inputPin = 13; int core = 0; int val; int tempPin = 0; int buttonState = 0; float celsius; int tempUnits = celsius; int refreshTime = 5000; unsigned long timer; float kelvin = 0; const int buttonPin[] = {2,3};     // the number of the pushbutton pins const int ledPin =  13;      // the number of the LED pin void setup(){   pinMode(ledPin, OUTPUT); pinMode(inputPin, INPUT); Serial.begin(9600); sevseg.Begin(1,2,3,4,5,6,7,8,9,10,11,12,13); // initialize the LED pin as an output:   pinMode(ledPin, OUTPUT);     for(int x=0; x<2; x++)   {     pinMode(buttonPin[x], INPUT);   }  int digitFlagPins[] = {10, 11}; int segmentPins[] = {1, 3, 4, 5 ,6 ,7 ,8, 9, 10}; led = new LEDDisplay(2, digitFlagPins[2], segmentPins[9]); } void loop(){   // read the state of the pushbutton value:   for(int x=0; x<2; x++)   {     buttonState = digitalRead(buttonPin[x]);     // check if the pushbutton is pressed.     // if it is, the buttonState is HIGH:     if (buttonState == HIGH && buttonPin[x] == 2) {          // turn LED on:         digitalWrite(ledPin, HIGH);     }     if (buttonState == HIGH && buttonPin[x] == 3) {       // turn LED off:       digitalWrite(ledPin, LOW);       }   } val = analogRead(tempPin); float mv = ( val/1024.0)*5000; float cel = mv/10; sevseg.PrintOutput(); kelvin = analogRead(0) * 0.004882812 * 100; celsius = kelvin - 2.5 - 273.15; unsigned long mils=millis();   if (mils-timer>=refreshTime) {     timer=mils;     //Print teperature to the displays   sevseg.NewNum(tempUnits,(byte) 2);   } delay(1000); }

Question by Houtarou- 3 years ago  |  last reply 3 years ago


Single LED, single battery module for inserting in a small wood sculpture?

I'd like to find a source for a self-contained LED unit with battery and switch for inserting into a carved (turned, actually) mushroom. An AAA battery would almost be too large but would be ok for lack of anything else. Something cheap, with a pushbutton switch on the bottom, that would fit in the stem of the mushroom. Any leads would be appreciated, thanks!

Topic by kenearlg 3 years ago  |  last reply 3 years ago


Growduino Help?

Hello Everyone, I built a growduino for my dwarf citrus tree. I have an serial LCD display, a pushbutton switch to turn the screen on and off. I also have a couple of relays and LED's. I wanted to see if someone would take a look at my code, and help me figure out why the screen doesn't display my float variables? I've been banging my head against the wall trying to figure it out. Any help is appreciated. Some of the math formulas I have below were customily made to display the format in degree's F, and a moisture value of 0-10. Feel free to ask questions. I will upload a few photos of it later today. Also if it is easier, I can send you my code in .ino format as well. Thank you for your help in advance. Chris #include #include const int TxPin = 2;          //the lcd const int pushButton = 5;     // the number of the pushbutton pin const int redLed =  13; const int blueLed =  12; int val = 0;                    // variable for reading the pin status SoftwareSerial mySerial = SoftwareSerial(255, TxPin);  //initialize LCD and bring in library //Analog Input int moistureSensor1 = 0; int moistureSensor2 = 1;                                                                                     int moistureSensor3 = 2; int moistureSensor4 = 3; int tempSensor = 5; //Digital Input... int waterPump = 8; int heater = 7; //Initialize int variable to store values int moisture_value1; int moisture_value2; int moisture_value3; int moisture_value4; int temp_val; int buttonState = 0;  void setup() { //Open serial port   mySerial.begin(9600);      //intialize LCD     pinMode(TxPin, OUTPUT);     digitalWrite(TxPin, HIGH);         //initialize button depress       pinMode(pushButton, INPUT);     // declare pushButton as input         //initialize and start it turned off..     pinMode (blueLed, OUTPUT);                                                                   pinMode (waterPump, OUTPUT);     pinMode (heater, OUTPUT);     pinMode (redLed, OUTPUT);                                                                                                                      //Not sure if I needed to make these inputs, since I want a reading from them? pinMode(moistureSensor1, INPUT); pinMode(moistureSensor2, INPUT); pinMode(moistureSensor3, INPUT); pinMode(moistureSensor4, INPUT); pinMode(tempSensor, INPUT);        digitalWrite (blueLed, LOW);     digitalWrite (waterPump, LOW);     digitalWrite (heater, LOW);     digitalWrite (redLed, LOW); } void loop() { for(int n=0; n < 3; n++);   {                   // nested loop.. checks for 3 days for(int i=0; i<= 86400; i++);{                 //checks for 1 day. 86400 is how many seconds in a day   delay(1000);       buttonState = digitalRead(pushButton);        // read the state of the pushbutton value:   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState == HIGH) {                                                                           //tells it to do something when pushed moisture_value1 = analogRead(moistureSensor1);                                                     // read the value from the moisture-sensing probes moisture_value2 = analogRead(moistureSensor2);                                                     //figure out if you should put it there, or in if/else? moisture_value3 = analogRead(moistureSensor3); moisture_value4 = analogRead(moistureSensor4); temp_val = analogRead(tempSensor);  //read temp..   mySerial.write(17);                 // Turn backlight on   mySerial.write(12);                 // Clear   mySerial.print("Sensor 1 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value1);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 2 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value2);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 3 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value3);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 4 is:    ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value4);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay float avg_moisture = (moisture_value1 + moisture_value2 + moisture_value3 + moisture_value4)/4; float true_moisture = avg_moisture/ 112.2064;   mySerial.print("Moisture average: ");   mySerial.write(13);                 // Form feed   mySerial.print(true_moisture);   // Second line                                                                mySerial.write(12);                 // Clear   delay(3000);                           // Required delay  temp_val = analogRead(tempSensor); // read the value from the thermistor                                          temp_val /= 6.64; mySerial.print("Current Temp in F:"); mySerial.write(13); mySerial.print(temp_val); mySerial.write(12); mySerial.write(18);                 // turn off backlight mySerial.write(21);                 // turn off display    delay(3000);     }   else {     temp_val = analogRead(tempSensor);  //read temp..                                                                                //not sure if I needed another temp value? but wanted to be safe..     temp_val /= 6.64;        while (temp_val < 75.0){                                                                                                       //initialize tempSensor again?     temp_val = analogRead(tempSensor);  //read temp..                                                                                //not sure if I needed another temp value? but wanted to be safe..     temp_val /= 6.64;         digitalWrite (heater, HIGH);     digitalWrite (redLed, HIGH);          mySerial.write(12);                 // Clear                    mySerial.write(17);                 // Turn backlight on        delay(5);                           // Required delay       mySerial.print("Heating Plant");  // First line       mySerial.write(220);                           //play at tone   for(int f; f<600; f++);{                                                                                                              //delay 10min while heating .. check for pushButton     delay(1000); buttonState = digitalRead(pushButton);        // read the state of the pushbutton value:   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState == HIGH) {                                                                           //tells it to do something when pushed moisture_value1 = analogRead(moistureSensor1);                                                     // read the value from the moisture-sensing probes moisture_value2 = analogRead(moistureSensor2);                                                     //figure out if you should put it there, or in if/else? moisture_value3 = analogRead(moistureSensor3); moisture_value4 = analogRead(moistureSensor4); temp_val = analogRead(tempSensor);  //read temp..   mySerial.write(12);                 // Clear   mySerial.print("Sensor 1 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value1);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 2 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value2);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 3 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value3);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 4 is:    ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value4);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay                                                                                                                                         float avg_moisture = (moisture_value1 + moisture_value2 + moisture_value3 + moisture_value4)/4; float true_moisture = avg_moisture/ 112.2064;   mySerial.print("Moisture average: ");   mySerial.write(13);                 // Form feed   mySerial.print(true_moisture);   // Second line                                                                mySerial.write(12);                 // Clear   delay(3000);                           // Required delay  temp_val = analogRead(tempSensor); // read the value from the thermistor                                          temp_val /= 6.64; mySerial.print("Current Temp in F:"); mySerial.write(13); mySerial.print(temp_val); mySerial.write(12); mySerial.write(18);                 // turn off backlight mySerial.write(21);                 // turn off display                                                                                   delay(3000);     digitalWrite (heater, LOW);     digitalWrite (redLed, LOW);            mySerial.write(18);                 // turn off backlight        mySerial.write(21);                 // turn off display                     }          }       }     }    } }   //3 days go by.. Now the plant needs water..     moisture_value1 = analogRead(moistureSensor1);                                                     // read the value from the moisture-sensing probes     moisture_value2 = analogRead(moistureSensor2);                                                     //figure out if you should put it there, or in if/else?     moisture_value3 = analogRead(moistureSensor3);     moisture_value4 = analogRead(moistureSensor4); float avg_moisture = (moisture_value1 + moisture_value2 + moisture_value3 + moisture_value4)/4; float true_moisture = avg_moisture/ 112.2064;   int w = 0;    while (true_moisture < 5.0 && w < 4);{                //stop after watering 4 times..     w++;     digitalWrite(waterPump, HIGH);     digitalWrite(blueLed, HIGH);        mySerial.write(12);                 // Clear                    mySerial.write(17);                 // Turn backlight on        delay(5);                           // Required delay       mySerial.print("Watering Plant");  // First line       mySerial.write(220);                           //play at tone       delay(8000);                          //tested.. waterpump pumps 1 cup of water per 8 seconds       digitalWrite(waterPump, LOW);  //turns off pump       digitalWrite(blueLed, LOW); // LED off           for(int k=0; k<180; k++);{                                                                                                                      //wait 3 minutes         delay(1000);                  buttonState = digitalRead(pushButton);        // read the state of the pushbutton value:   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState == HIGH) {                                                                           //tells it to do something when pushed moisture_value1 = analogRead(moistureSensor1);                                                     // read the value from the moisture-sensing probes moisture_value2 = analogRead(moistureSensor2);                                                     //figure out if you should put it there, or in if/else? moisture_value3 = analogRead(moistureSensor3); moisture_value4 = analogRead(moistureSensor4); temp_val = analogRead(tempSensor);  //read temp..   mySerial.write(12);                 // Clear   mySerial.print("Sensor 1 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value1);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 2 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value2);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 3 is:   ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value3);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay   mySerial.print("Sensor 4 is:    ");   mySerial.write(13);                 // Form feed   mySerial.print(moisture_value4);   // Second line   mySerial.write(12);                 // Clear   delay(3000);                           // Required delay                                                                                                                                           float avg_moisture = (moisture_value1 + moisture_value2 + moisture_value3 + moisture_value4)/4; float true_moisture = avg_moisture/ 112.2064;   mySerial.print("Moisture average: ");   mySerial.write(13);                 // Form feed   mySerial.print(true_moisture);   // Second line                                                                mySerial.write(12);                 // Clear   delay(3000);                           // Required delay  temp_val = analogRead(tempSensor); // read the value from the thermistor                                          temp_val /= 6.64; mySerial.print("Current Temp in F:"); mySerial.write(13); mySerial.print(temp_val); mySerial.write(12); mySerial.write(18);                 // turn off backlight mySerial.write(21);                 // turn off display                                                                                   delay(3000); }       }           moisture_value1 = analogRead(moistureSensor1);                                                     // read the value from the moisture-sensing probes     moisture_value2 = analogRead(moistureSensor2);                                                     //figure out if you should put it there, or in if/else?     moisture_value3 = analogRead(moistureSensor3);     moisture_value4 = analogRead(moistureSensor4); float avg_moisture = (moisture_value1 + moisture_value2 + moisture_value3 + moisture_value4)/4; float true_moisture = avg_moisture/ 112.2064;          mySerial.write(12);                 // Clear                    mySerial.write(17);                 // Turn backlight on        delay(5);                           // Required delay        mySerial.print("Finished Watering");  // First line        mySerial.write(12);                 // Clear               mySerial.write(220);                           //play at tone              mySerial.write(220);                           //play at tone        mySerial.write(18);                 // turn off backlight        mySerial.write(21);                 // turn off display                                 } }

Question by cburns02135 6 years ago  |  last reply 4 years ago


Arduino multiple if statements

Hi, Thank you in advance for any feedback for my question. I made a XY plotter machine that I want to control with a joystick. The joystick has 4 momentary pushbuttons. One for up, down, left, right. I want the up and down to control one motor (or x axis), forward and backwards, and the left and right to control the second motor (y axis), forwards and backwards. I am using an Arduino UNO with Motor shield. I have all of the wiring part sorted out, but I am having trouble with my code. The problem is when I push forwards, the motor keeps going forward even when I stop pushing the button. I would like it to stop when I stop pushing the button. I am not too familiar with programming. Here is the code I am using: //Channel A or X Axis int upPinX = 2; int downPinX = 4; int forwardX = 0; int reverseX = 0; //Channel B or Y Axis int upPinY = 5; int downPinY = 6; int forwardY = 0; int reverseY = 0; void setup() {     //Setup Channel A or X Axis pinMode(12, OUTPUT); //Initiates Motor Channel A pin pinMode(9, OUTPUT); //Initiates Brake Channel A pin pinMode(upPinX, INPUT); //Motor A forward pushbutton pinMode(downPinX, INPUT); //Motor A backward pushbutton //Setup Channel B or Y Axis pinMode(13, OUTPUT); //Initiates Motor Channel A pin pinMode(8, OUTPUT); //Initiates Brake Channel A pin pinMode(upPinY, INPUT); //Motor A forward pushbutton pinMode(downPinY, INPUT); //Motor A backward pushbutton } void loop(){ forwardX = digitalRead(upPinX); reverseX = digitalRead(downPinX); forwardY = digitalRead(upPinY); reverseY = digitalRead(downPinY); if (forwardX == LOW) { digitalWrite(12, HIGH); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A analogWrite(3, 1023); //Spins the motor on Channel A at full speed } if (reverseX == LOW) {   digitalWrite(12, LOW); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A analogWrite(3, 1023); //Spins the motor on Channel A at full speed } if (forwardY == LOW) { digitalWrite(13, HIGH); //Establishes forward direction of Channel A digitalWrite(8, LOW); //Disengage the Brake for Channel A analogWrite(11, 1023); //Spins the motor on Channel A at full speed } if (reverseY == LOW) {   digitalWrite(13, LOW); //Establishes forward direction of Channel A digitalWrite(8, LOW); //Disengage the Brake for Channel A analogWrite(11, 1023); //Spins the motor on Channel A at full speed } else {   digitalWrite(9, HIGH); //Eengage the Brake for Channel A digitalWrite(8, HIGH); //Engage the break for Channel B } } - Also perhaps someone could let me know how I can insert code in one of those code boxes? Thanks,

Topic by toedip 5 years ago  |  last reply 3 years ago


Arduino Coding help? Answered

I need some guidance on how to write some Arduino code. The physical side is an Arduino mega ADK connected to some buttons and leds. On the code side, I modified the button sketch. I am stuck on how to add multiple buttons. in the void loop. I just need someont to show me how to add 1 after that i can figure out how to add the rest. Thanks,  Kaden const int button1 = 24;     // the number of the pushbutton pin const int button2 = 25; const int button3 = 26; const int button4 = 27; const int button5 = 28; const int Bucket1 = 2; const int Bucket2 = 3; const int Bucket3 = 4; const int Bucket4 = 5; const int Bucket5 = 6; const int Bucket6 = 7; const int Bucket7 = 8; const int Bucket8 = 9; const int Bucket9 = 10; const int Bucket10 = 11; const int Bucket11 = 12; const int Bucket12 = 13; int buttonState1 = 0;         // variable for reading the pushbutton status int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0; void setup() {   // initialize the LED pin as an output:   pinMode(Bucket1, OUTPUT);   // declare LED strip pin as output   pinMode(Bucket2, OUTPUT);   pinMode(Bucket3, OUTPUT);   pinMode(Bucket4, OUTPUT);   pinMode(Bucket5, OUTPUT);   pinMode(Bucket6, OUTPUT);   pinMode(Bucket7, OUTPUT);   pinMode(Bucket8, OUTPUT);   pinMode(Bucket9, OUTPUT);   pinMode(Bucket10, OUTPUT);   pinMode(Bucket11, OUTPUT);   pinMode(Bucket12, OUTPUT);   // initialize the pushbutton pin as an input:   pinMode(button1, INPUT);   pinMode(button2, INPUT);   pinMode(button3, INPUT);   pinMode(button4, INPUT);   pinMode(button5, INPUT); } void loop() {     buttonState1 = digitalRead(button1);   buttonState2 = digitalRead(button2);   buttonState3 = digitalRead(button3);   buttonState4 = digitalRead(button4);   buttonState5 = digitalRead(button5);   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState1 == HIGH) {     // turn LED on:   digitalWrite(Bucket1, HIGH);  // turn LED strip on when button is pressed   digitalWrite(Bucket2, HIGH);   digitalWrite(Bucket3, HIGH);   digitalWrite(Bucket4, HIGH);   digitalWrite(Bucket5, HIGH);   digitalWrite(Bucket6, HIGH);   digitalWrite(Bucket7, HIGH);   digitalWrite(Bucket8, HIGH);   digitalWrite(Bucket9, HIGH);   digitalWrite(Bucket10, HIGH);   digitalWrite(Bucket11, HIGH);   digitalWrite(Bucket12, HIGH);   }   else {     // turn LED off:   digitalWrite(Bucket1, LOW);  // turn LED strip on when button is pressed   digitalWrite(Bucket2, LOW);   digitalWrite(Bucket3, LOW);   digitalWrite(Bucket4, LOW);   digitalWrite(Bucket5, LOW);   digitalWrite(Bucket6, LOW);   digitalWrite(Bucket7, LOW);   digitalWrite(Bucket8, LOW);   digitalWrite(Bucket9, LOW);   digitalWrite(Bucket10, LOW);   digitalWrite(Bucket11, LOW);   digitalWrite(Bucket12, LOW);   } }

Question by FarmerKJS 3 years ago  |  last reply 3 years ago


Arduino code help

To the Instructables members,       I'm trying to write a program that uses a pushbutton (momentary) to turn on and off LEDs.  I have two LEDs and one button.  Basically, I want to be able to push the button to switch LEDs.  One push - one LED turns on - another push - the second LED turns on - another push - the first LED turns on - and so on.  Anyone know how to do that?  I'm sure there's a simple solution that I've missed.  Any aid would be awesome.

Topic by dudes 4 years ago  |  last reply 4 years ago


Arduino programming loop help?

I am making a tic tac toe game. I have two sets of 9 leds. one set for player one and another for player 2. I have 4 pushbuttons 2 for each player. when i push 1 of the buttons i want the first led to light up then when i press it again the second led would light up ant the first would stop then if i would press the second button then it would keep the second led on and then i could choose another led while the first led i chose is still on. this is my code so far but ineed help on my loop any help is appreciated also in my code pbcp1 means pushbutton cursor player 1 and pbsp1 means pushbutton select player1. if it ends in 2 instead of one then it is just for player 2. Thanks in advance. Code: int pbcp1 = 13; int pbsp1 = 12; int pbcp2 = 11; int pbsp2 = 10; int greenled1 = 22; int greenled2 = 24; int greenled3 = 26; int greenled4 = 28; int greenled5 = 30; int greenled6 = 32; int greenled7 = 34; int greenled8 = 36; int greenled9 = 38; int redled1 = 23; int redled2 = 25; int redled3 = 27; int redled4 = 29; int redled5 = 31; int redled6 = 33; int redled7 = 35; int redled8 = 37; int redled9 = 39; void setup() {                  pinMode(greenled1, OUTPUT);   pinMode(greenled2, OUTPUT);   pinMode(greenled3, OUTPUT);   pinMode(greenled4, OUTPUT);    pinMode(greenled5, OUTPUT);   pinMode(greenled6, OUTPUT);    pinMode(greenled7, OUTPUT);   pinMode(greenled8, OUTPUT);   pinMode(greenled9, OUTPUT);   pinMode(redled1, OUTPUT);   pinMode(redled2, OUTPUT);   pinMode(redled3, OUTPUT);   pinMode(redled4, OUTPUT);    pinMode(redled5, OUTPUT);   pinMode(redled6, OUTPUT);   pinMode(redled7, OUTPUT);   pinMode(redled8, OUTPUT);   pinMode(redled9, OUTPUT);   pinMode(pbcp1, INPUT);   pinMode(pbsp1, INPUT);   pinMode(pbsp2, INPUT);   pinMode(pbcp2, INPUT);  } void loop() { }

Question by sarju7 5 years ago  |  last reply 5 years ago


powered pocket door/sliding door using automobile power window motor?

Hi, looking to make something along the lines of this youtube video, using a car power window motor, but would like to be able to use 2 switches or pushbuttons, one for each side of the door. It's not for our house or anything so it doesn't need to look pretty and I probably won't even be using an actual door, but a piece of plywood instead. Any ideas on how to make it happen? Thanks for the help. I'm sure there are better ways, but I'm looking to do it cheap.

Question by payne.kj 7 years ago  |  last reply 7 years ago


Need help, what`s that thing for?

Hey! So what could it be?it got little peeping speaker, on/off switch and a "Tactile Switch" AA battery is too big and tall, AAA fits but its tall too, but i runned it on AAA(put something between the battery and contact) Then its making peep peep untill i switch the pushbutton. On the board is writed "UNILARM" www.upload.ee/image/987371/15122010575.jpg http://www.upload.ee/image/988449/16122010578.jpg http://www.upload.ee/image/988448/16122010577.jpg http://www.upload.ee/image/988447/16122010579.jpg Thanks for any help:)

Topic by blackrock112 8 years ago  |  last reply 8 years ago


Charge level indicator?

I need a nice, simple charge indicator. I have a battery pack that holds 4 AA NiMH batteries. Normally they charge up to 1.3V per cell or 4X1.3=5.2V total. I have a solar trickle charger on there too and I'd like to have a little charge indicator.   Requirements are: -low part count -under $10 -small (it's on my bike helmet) I was thinking something with a pushbutton an LED or two and a zener diode. Something that turns on the LED at  greater than 5.2 volts. But I don't have experience with zener diodes. Has anyone seen a system like this around? Can you think one up? -Cheers

Question by snotty 8 years ago  |  last reply 2 years ago


How to pick correct push button switch?

Hi, the pushbutton switch in my coleman lamp is broken and I need a replacement. It's a push button with 2 leads. I don't know how to tell if its spdt, spst, or the other ones. How do I pick the right switch? Its rating says it is 5A/40A 250V. It stays in the on position until it its pushed again. I linked some pics on imageshack (couldn't get the uploader here to work.). Maybe that will help. Thanks http://img692.imageshack.us/i/img0705d.jpg/ http://img683.imageshack.us/i/img0706b.jpg/ http://img683.imageshack.us/i/img0707n.jpg/

Question by phillyj 9 years ago  |  last reply 9 years ago


Wireless Igniter?

I just recently made a pushbutton igniter system for lighting fireworks. ( a 9v battery goes through a momentary switch then to alligator clips which connect to the two wires coming off a Christmas light with the tip broken off. The end of the fuse goes in there and when the switch is pushed, the fuse lights) It works consistently without fault and I was wondering how I could make this remotly ignited. I understand that there is a way to just "replace" the momentary switch with some sort of receiver but I don't know where to go from there. If someone has knowledge of how you can do this or can redirect me to a sight with the parts I would need to accomplish this it would be greatly appreciated. thanks for the help   -flamethrower  

Topic by flamethrower1010 8 years ago  |  last reply 8 years ago


How do you make a bluetooth remote shutter device?

Hey everyone, I’m new here so go easy and forgive any ignorance on my part! I want to create a simple Bluetooth command button that can connect to a Raspberry Pi Zero W. I’m looking at 2 options: 1. Adapting an off-the-shelf Bluetooth smartphone selfie button – but how can this be integrated to capture images from a Raspberry Pi and attached Pi camera? 2. Create from scratch a small remote control with a single command pushbutton that transmits over Bluetooth – which components could this work with this to connect to a Raspberry Pi? Can anyone help at all please? Thanks!

Question by sam r wilson 1 year ago  |  last reply 1 year ago


Mini/Micro Game System

Hi guys, I've been thinking. Really thinking. I recently found my Digispark (if you dont know what those are, google digistump, click on the first link and go to products, Digispark. They're really cool.) and decided to put it to use. I have always wanted to have/build something like a micro gaming system (sort of like the ben nanonote (if you don't what that is, google it, its really cool)) and decided that as a challenge, I could try implementing the Digispark as the Processor. I know that I wouldn't be able to run any games more advanced than pong, breakout or snake, but even those kinds of games would be enough to keep me interested while in boring situations. My basic thinking is this: There would a small lithium-ion rechargeable battery on the bottom to be a base (but still removable), the Digispark without any headers above the batteries, and a small LCD screen (1.8, 2 or 1.3 inch screen size) that would have either two pushbuttons (one on either side of the screen) or four pushbuttons configured in a D-pad style on the right side of the screen (how many buttons it would have depends on how many pins the Digispark would have open (if any), which also leads to my question, does anybody know any place to get video LCD screens (don't care if its color or not) that only take up 4 or less pins? I know that probably seems absurd, but if anybody knows any places to get them, please let me know. And just one last thing, is it possible to program games in the arduino IDE? Are there libraries for them? ANd if you can program games, just how advanced can you go?

Topic by MrDubstepWarMachine 4 years ago  |  last reply 4 years ago


overheating transistor on DC motor control circuit

I am trying to control a DC motor using 4 transistors, i am using 547 transistors connected to a motor with two on each axis, the opposite corners are wired together with two pushbuttons, the transistors change the polarity of the motor so that if one button i pressed the motor spins one way, the other button vice versa, but the motor is running very slowly in this setup and the last two transistor that go from the motor to ground heat up very quickly. the circuit works fine with only one transistor but i want to be able to change the direction of spin, does anyone know why the transistors are acting like this or a better circuit to control a DC motor? thanks very much!

Topic by sholtob 7 years ago  |  last reply 7 years ago


Arduino score board code question

Hi all. Ive been trying to work this out for a week and I'm guessing its a simple answer. Im building a score board, just LED modules (lights) instead of a 7 segment display There are two buttons, one for when each player scores a point. The led will work similar to a chaser but manually, each time the button is pressed the light advances one space and when the opposite players button is pushed the light goes towards the other player.  I tried using a button counter code, but because its counting the tines it touched it works in multiples. and just messes things up. can anyone help? thanks The schematic doesn't show the full thing, nor does the code. Im only working with one player at the moment to simply things a bit. // this constant won't change: const int  buttonPin1 = 6;    // the pin that pushbutton 1 is attached to const int  buttonPin2 = 7;    // the pin that pushbutton 2 is attached to const int ledPin1 = 2;       // the pin that the LED 1 is attached to const int ledPin2 = 3;       // the pin that the LED 2 is attached to const int ledPin3 = 4;       // the pin that the LED 3 is attached to const int ledPin4 = 5;       // the pin that the LED 4 is attached to const int ledPin4 = 8;       // the pin that the LED 5 is attached to // Variables will change: int buttonPushCounter = 0;   // counter for the number of button presses int buttonState = 0;         // current state of the button int lastButtonState = 0;     // previous state of the button void setup() {   // initialize the button pin as a input:   pinMode(buttonPin1, INPUT);   pinMode(buttonPin2, INPUT);   // initialize the LED as an output:   pinMode(ledPin1, OUTPUT);   pinMode(ledPin2, OUTPUT);   pinMode(ledPin3, OUTPUT);   pinMode(ledPin4, OUTPUT);   // initialize serial communication:   Serial.begin(9600); } void loop() {   // read the pushbutton input pin:   buttonState = digitalRead(buttonPin1);   // compare the buttonState to its previous state   if (buttonState != lastButtonState) {     // if the state has changed, increment the counter     if (buttonState == HIGH) {       // if the current state is HIGH then the button       // wend from off to on:       buttonPushCounter++;       Serial.println("on");       Serial.print("number of button pushes:  ");       Serial.println(buttonPushCounter);     } else {       // if the current state is LOW then the button       // wend from on to off:       Serial.println("off");     }     // Delay a little bit to avoid bouncing     delay(50);   }   // save the current state as the last state,   //for next time through the loop   lastButtonState = buttonState;   // turns on the LED every four button pushes by   // checking the modulo of the button push counter.   // the modulo function gives you the remainder of   // the division of two numbers:   if (buttonPushCounter % 1 == 0) {     digitalWrite(ledPin1, HIGH);     digitalWrite(ledPin2, LOW);     digitalWrite(ledPin3, LOW);     digitalWrite(ledPin4, LOW);   } else {     digitalWrite(ledPin1, LOW);   }   if (buttonPushCounter % 2 == 0) {     digitalWrite(ledPin2, HIGH);     digitalWrite(ledPin1, LOW);     digitalWrite(ledPin4, LOW);     digitalWrite(ledPin3, LOW);}           {if (buttonPushCounter % 3 == 0) {     digitalWrite(ledPin3, HIGH);     digitalWrite(ledPin4, LOW);     digitalWrite(ledPin2, LOW);     digitalWrite(ledPin1, LOW);}           if (buttonPushCounter % 4 == 0) {     digitalWrite(ledPin4, HIGH);     digitalWrite(ledPin1, LOW);     digitalWrite(ledPin2, LOW);     digitalWrite(ledPin3, LOW); }       } }

Question by spikepickstock 2 years ago  |  last reply 2 years ago


Trying to make a arduino based photo booth, and need help with my code for the countdown to be triggered by a button?

I am new to Arduino and am trying to make an Arduino based Photo Booth which will have a button that is pressed and triggers a countdown on an 8x8 SPI matrix and at the end of the countdown it triggers a SLR Camera (Nikon D5500) (i still need to work out how to trigger the camera and write the camera trigger code). at the moment i have managed to create code that starts the countdown when a button is pressed however it seems to only want to listen to the button randomly and triggers whenever it seems to feel like it. Here is the code i have so far...Have i written it correctly? #include "LedControl.h" const int buttonPin = 2;     // the number of the pushbutton pin int buttonState = 0;         // variable for reading the pushbutton status LedControl lc=LedControl(12,11,10,1);  // Pins: DIN,CLK,CS, # of Display connected unsigned long delayTime=1000;  // Delay between Frames // Put values in arrays byte invader1a[] = {   B01111110, // #9   B11111111,   B11100111,   B11111111,   B01111111,   B00000111,   B11111111,   B01111110 }; byte invader1b[] = {   B01111110, // #8   B11111111,   B11100111,   B01111110,   B01111110,   B11100111,   B11111111,   B01111110 }; byte invader1c[] = {   B11111111, // #7   B11111111,   B00000111,   B00001110,   B00011100,   B00111000,   B00111000,   B00111000 }; byte invader1d[] = {   B01111110, // #6   B11111111,   B11100000,   B11111110,   B11111111,   B11100111,   B11111111,   B01111110 }; byte invader1e[] = {   B11111111, // #5   B11111111,   B11100000,   B11111110,   B11111111,   B00000111,   B11111111,   B01111110 }; byte invader1f[] = {   B11101110, // #4   B11101110,   B11101110,   B11111111,   B11111111,   B00001110,   B00001110,   B00001110 }; byte invader1g[] = {   B11111110, // #3   B11111111,   B00000111,   B11111110,   B11111110,   B00000111,   B11111111,   B11111110 }; byte invader1h[] = {   B01111110, // #2   B11111111,   B11100111,   B00001110,   B00111000,   B11100000,   B11111111,   B11111111 }; byte invader1i[] = {   B00011100, // #1   B00111100,   B01111100,   B00011100,   B00011100,   B00011100,   B00011100,   B00011100 }; byte invader1j[] = {   B00000000, // #smile   B00000000,   B00100100,   B00000000,   B10000001,   B01000010,   B00111100,   B00000000 }; byte invader1k[] = {   B00000000, // #blank   B00000000,   B00000000,   B00000000,   B00000000,   B00000000,   B00000000,   B00000000 }; void setup() {   lc.shutdown(0,false);  // Wake up displays   lc.shutdown(1,false);   lc.setIntensity(0,5);  // Set intensity levels   lc.setIntensity(1,5);   lc.clearDisplay(0);  // Clear Displays   lc.clearDisplay(1);   pinMode(buttonPin, INPUT); } //  Take values in Arrays and Display them void sinvader1a() {   for (int i = 0; i < 8; i++)    {     lc.setRow(0,i,invader1a[i]);   } } void sinvader1b() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1b[i]);   } } void sinvader1c() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1c[i]);   } } void sinvader1d() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1d[i]);   } } void sinvader1e() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1e[i]);   } } void sinvader1f() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1f[i]);   } } void sinvader1g() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1g[i]);   } } void sinvader1h() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1h[i]);   } } void sinvader1i() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1i[i]);   } } void sinvader1j() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1j[i]);   } } void sinvader1k() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1k[i]);   } } void loop() {// read the state of the pushbutton value:   buttonState = digitalRead(buttonPin);   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState == HIGH) {     sinvader1a();     delay(delayTime);     sinvader1b();     delay(delayTime);     sinvader1c();     delay(delayTime);     sinvader1d();     delay(delayTime);     sinvader1e();     delay(delayTime);     sinvader1f();     delay(delayTime);     sinvader1g();     delay(delayTime);     sinvader1h();     delay(delayTime);     sinvader1i();     delay(delayTime);     sinvader1j();     delay(delayTime);     sinvader1k();   } if (buttonState == LOW) {    buttonState = digitalRead(buttonPin);   }   }

Question by DanielB118 3 years ago  |  last reply 3 years ago