Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write program basic stamp (BASIC STAMP) and show where to wire circuit with a dr

ID: 2267929 • Letter: W

Question

Write program basic stamp (BASIC STAMP) and show where to wire circuit with a drawing

Exercise 3: Add a second pushbutton to your circuit wired to P6. Then add two more LED's wired to P13 and P15. Write code that: V Flashes one light when one button is pressed, Flashes a second light when the second button is pressed and VFlashes all three lights when both buttons are simultaneously pressed. Use an IF... ELSEI F... ELSE statement and for the third condition use an AND conditional logical operator. When no buttons are pushed all lights should be dark. Use the Help menu and look under IF...THEN... ELSE if needed.

Explanation / Answer

C code=>

#include<stdio.h>

main()

{

int button1, //input1

button2, // input2

led1 = 0, //output1

led2 = 0; //output2

//input if pushbutton 1 is pressed or not

printf("enter push button1 status 1 or 0=> ");

scanf("%d",&button1);

//input if pushbutton 2 is pressed or not

printf("enter push button2 status 1 or 0=> ");

scanf("%d",&button2);

if((button1==1)&&(button2 == 1)) //it is checked if both buttons are pressed first

{

led1 = 1;

led2 = 1;

}

else if(button1 == 1) //if both buttons are not pressed check if single button is pressed

{

led1 = 1;

}

else if(button2 == 1)

{

led2 = 1;

}

else

{

led1 = 0;

led2 = 0;

}

printf(" led1 => %d",led1);

printf(" led2 => %d",led2);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote