Dependencies:   mbed

Revision:
0:faf656333d3d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice2.cpp	Mon May 02 09:07:41 2016 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+Ticker moteur_vitesse;
+void task();
+BusOut moteur(p5,p6,p7,p8);
+
+float vitesse;
+int a=1;
+
+int main()
+{
+
+    while(1) 
+    {
+
+        printf("Saisir la vitesse:\n");
+        scanf("%g",&vitesse);
+        vitesse=vitesse/1000;
+        moteur_vitesse.attach(&task,vitesse);
+
+    }
+}
+
+void task(void)
+{   
+    
+    moteur.write(a);
+    a=a*2;
+    if(a>8)
+    a=1;
+     
+}