vjezba5

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mvucina
Date:
Fri May 08 17:05:39 2015 +0000
Commit message:
Vje?ba 5: Napravite sustav koji broji koliko puta je digitalni prekida? pritisnut (tj.; promijenjen mu je polo?aj), a nakon ?to izbroji 10 puta, pali se LED dioda.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 08 17:05:39 2015 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+DigitalOut redled(p5);
+DigitalOut greenled(p6);
+DigitalIn sw1(p7);
+int n=0;
+bool b= false;
+int main() {
+    while(1) {     
+              
+               if (sw1!=b){
+                wait(0.1);   
+                if(sw1==1){
+                n++;   } 
+                b = sw1;                    
+                
+                }
+                
+                if (n>=10){
+                    redled = 1;
+                   }                            
+
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 08 17:05:39 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file