Testing Pushbutton states

Dependencies:   mbed

Fork of VJEZBA5Pavlek by Applied engineering Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 DigitalIn sw1(p5);
00003 DigitalOut out1(p10);
00004 int i;
00005 int main() {
00006     
00007       sw1.mode(PullUp);
00008       out1=0;
00009       while(1){
00010         if(sw1==0){ 
00011                   
00012             if(sw1==1){                
00013                 i=i++;
00014                 
00015                     if(i==3){
00016                         out1=1;           
00017                 }
00018             }
00019         }
00020     }
00021  }           
00022         
00023