.

Dependencies:   mbed

Revision:
0:5daff114eb4a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 18 19:28:48 2016 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+DigitalIn bottone(p23);
+DigitalOut ledR(p25);
+DigitalOut ledG(p24);
+DigitalOut ledB(p26);
+PwmOut piezo(p22);
+bool flag=0;
+int c=0;
+int main()
+{
+    while(1) {
+
+        if(bottone==1&& c>0 && c<=10000) {
+            ledR=0;
+            flag=0;
+            c=0;
+            piezo.period(1.0 / 200.0);
+            piezo.write(0.5);
+            wait(2);
+            piezo.write(0);
+            wait(0.05);
+        } else if(bottone==1) {
+            ledR=1;
+            flag=1;
+        } else if (c>10000) {
+            piezo.period(1.0 / 600.0);
+            piezo.write(0.5);
+            wait(1.0 / 2);
+            piezo.write(0);
+            wait(0.05);
+        }
+
+        if(flag==1) {
+            c++;
+        }
+
+        wait_ms(1);
+
+    }
+}