Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

basic switch program inarduino

Status
Not open for further replies.

Bhuvanesh Nick

Member level 1
Joined
Aug 22, 2013
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
201
int x=0;
void setup()
{
Serial.begin(14400);
Serial.print("starting");
Serial.println("Program");
pinMode(13,OUTPUT);
pinMode(7,INPUT);
digitalWrite(7,HIGH);//internal pull up
}
void loop()
{
if(digitalRead(7)==0)
{
x=!x;

digitalWrite(13,x);

while(digitalRead(7)==0);
delay(50);//debounce of the spring action of switch
Serial.print(x);

}}



once i press the button its blowing.but next time time when i press its blowing off how is that
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top