Question

In: Computer Science

Build a circuit that contains two push buttons, an LED, and any other basic components you...

Build a circuit that contains two push buttons, an LED, and any other basic components you think you need. The LED should only light when both push buttons are pressed. Use your Arduino for power and ground. Submit your final code, fritzing breadboard diagram and a video on canvas.

Solutions

Expert Solution

Answer

Here is your answer, if you have any doubt i am here to help you. please comment.

Here is your aurduino code, and circute for the above porblem. You can create it's your own Fritzing software. I created this circute and sketch in Tinkercad.

Here is the sketch and digram,

Component Required

Arduino Uno
resistors  :3
LED        :1
Push Button:2

Arduino sketch

/* connect two push button in digital pin, here 2 and 3.
   LED connected to the digital pin 13.*/
//this variable for reading the value in push button
int p1 = 0; 
int p2 = 0;
void setup()
{
  //initilize the all pin.Which used for input and which used for output
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(13, OUTPUT);
}
//this function is used to wait the input from each button.
int buttonWait(int buttonPin){
  int buttonState = 0;
  while(1){
    buttonState = digitalRead(buttonPin);
    if (buttonState == HIGH) {
      return buttonState; //when button press high it will return high, else this will execute this while infinity, similar to loop()
    }
  }
}
void loop()
{
  p1 = buttonWait(2); //wait for the p1 value is high.
  p2 = buttonWait(3); //wait for the p2 value is high
  if(p1 == HIGH && p2==HIGH) //if both high then only blink led
  {
    digitalWrite(13, HIGH);
    delay(500);
  }
  digitalWrite(13,LOW);  //after some second it will unblink
}

Any doubt please comment, i am here to help you.

Thanks in advance


Related Solutions

build in multisim ,circuit using window comparator that works to turn on a green LED and...
build in multisim ,circuit using window comparator that works to turn on a green LED and red LED is off .when the dc input voltage is between 360mv-380mv and when the input is above or below this range red LED is on and green LED is off.
1.. Write a code that LED1 (Red LED- P1.0) turns ON when after you push S1(push...
1.. Write a code that LED1 (Red LED- P1.0) turns ON when after you push S1(push button - P1.1) five times and stays OFF forever after that. 2.. Write a code that LED1 (Red LED- P1.0) turns OFF and LED2 (Red LED- P9.7) Turns ON after you push S1(push button -P1.1) five times and they stay that way forever.
If you wanted an LED to flash more or less in a circuit, how would this...
If you wanted an LED to flash more or less in a circuit, how would this be done?
Question #10: What is the basic character for RC circuit? In other words, how do the...
Question #10: What is the basic character for RC circuit? In other words, how do the current and voltage change with time? What about the discharging? What is the time constant? How to compute it? How to compute the time constant. How does the charge capacitor change with respect to time?
4. Identify any five components of other comprehensive income? (5 marks)
4. Identify any five components of other comprehensive income?
In this experiment you will use an online circuit board to build three circuits: a series...
In this experiment you will use an online circuit board to build three circuits: a series circuit with three resistors, a parallel circuit with three resistors, and a circuit with a combination of parallel and series resistors. You will use an ammeter and a volt meter to measure the current flow and voltage across the resistors in the circuits. After you record the results of your experiment, you will be able to compare the measurements you take with what Ohm’s...
Two ice skaters, Anne and Steve, face each other while at rest,and then push against...
Two ice skaters, Anne and Steve, face each other while at rest, and then push against each other's hands. The mass of Steve is twice that of Anne. How do their speeds compare after they push off?A.Anne's speed is one-fourth of Steve's speed.B.Anne's speed is two times Steve's speed.C.Anne's speed is the same as Steve's speed.D.Anne's speed is one-half of Steve's speed.E.Anne's speed is four times Steve's speed.
Diffusion is a key element of integrated circuit fabrication. Describe the two basic heat treatments that...
Diffusion is a key element of integrated circuit fabrication. Describe the two basic heat treatments that are used to diffuse impurities into silicon during this fabrication process.
The circuit shown in (Figure 1) contains two batteries, each with an emf and an internal resistance, and two resistors.
The circuit shown in (Figure 1) contains two batteries, each with an emf and an internal resistance, and two resistors. Part A Find the magnitude of the current in the circuit. Express your answer with the appropriate units.Part C Find the terminal voltage Vab of the 16.0 V battery. Express your answer with the appropriate units. Part D Find the potential difference Vac of point o with respect to point c. Express your answer with the appropriate units. 
Identify and briefly explain any two factors that have led to the increasing importance of business...
Identify and briefly explain any two factors that have led to the increasing importance of business intelligence.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT