none

Dependencies:   mbed Threads

Fork of HelloWorld by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
JacquesEd
Date:
Mon Jan 26 22:29:40 2015 +0000
Parent:
3:58803195db3f
Commit message:
v1

Changed in this revision

Threads.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 58803195db3f -r 2857c116c1e1 Threads.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Threads.lib	Mon Jan 26 22:29:40 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/lemniskata/code/Threads/#d370bed31f45
diff -r 58803195db3f -r 2857c116c1e1 main.cpp
--- a/main.cpp	Mon Jan 26 22:16:46 2015 +0000
+++ b/main.cpp	Mon Jan 26 22:29:40 2015 +0000
@@ -6,10 +6,10 @@
 AnalogIn ea_2(p20);
 Serial pc (USBTX, USBRX);
 
-int test[100] = {1,0,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,,1,1,0,1,0,0,0,1,1,0,1,0
+int test[] = {1,0,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,0,0,0,1,1,0,1,0
                 ,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1
-                ,01,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,};
-int index = 0;
+                ,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,};
+int indext = 0;
 
 //RtosTimer time ;
 
@@ -29,6 +29,7 @@
     for (i = 0; i <6; i ++) {
         //sample[i][0] = args.read_u16();
         sample[i][0] = test[indext];
+        indext++;
         // sample[i][1] = date;
     }
     i = 0;
@@ -42,7 +43,8 @@
 // lecture de l'étampe temporelle
         //date = time.read_ms();
 // lecture des échantillons analogiques
-        sample[i][0] = args.read_u16();
+        sample[i][0] = test[indext];
+        indext++;
         i++;
 
 
@@ -63,9 +65,11 @@
     flag[1] = 1;
     while (flag[0] == 1)
         thread.yield();
+        
     int value[2][2];
     int i = 0;
-    value[i][0] = args.read();
+    value[i][0] = test[indext];
+        indext++;
     //value[i][1] = date;
     while (true) {
 // synchronisation sur la période d'échantillonnage
@@ -75,15 +79,16 @@
 // lecture des échantillons numériques
         wait_ms(100);
         i++;
-        value[i][0] =  args.read();
+        value[i][0] =  test[indext];
+        indext++;
         //value[i][1] = date;
 // prise en charge du phénomène de rebond
         if (value[0][0] != value[1][0]) {
             wait_ms(50);
-            int *temp = new int;
-            temp = args.read();
+            int temp =  test[indext];
+            indext++;
             // génération éventuelle d'un événement
-            if (temp == value[i]) {
+            if (temp == value[i][0]) {
                 tableau[compteur][0] = 0;   //0 pr numérique
                 // tableau[compteur][1] = value[i][1];
                 compteur++;