progamme experience

Dependencies:   mbed RGB_matrix_Panel_modif

Revision:
1:159b56e19e44
Parent:
0:8458926c8bd8
Child:
2:7e46a870ebd1
diff -r 8458926c8bd8 -r 159b56e19e44 main.cpp
--- a/main.cpp	Fri May 24 19:22:00 2019 +0000
+++ b/main.cpp	Fri May 24 20:12:03 2019 +0000
@@ -37,27 +37,35 @@
 PinName lb2=D7;
 RGBmatrixPanel matrix(ur1,ug1,ub1,lb2,lg2,lr2,A0,A1,A2,D8,A3,D9,false);
 */
-Serial BT(p13,p14,115200); // Depart Bluetooth
-
+Serial BT_PR(p28,p27,115200); // Depart Bluetooth
+Serial BT_E(p13,p14,115200); // Depart Bluetooth
+//Serial pc(USBTX,USBRX,115200); // Depart Bluetooth
 int main()
 {
-    wait(5);
+    wait(1);
     matrix.begin();
 
-    for (int i =0; i<3; i++) { // Clignotement panneau
-        matrix.fillScreen(matrix.Color333(0, 0, 0));
-        wait_ms(500);
-        matrix.fillScreen(matrix.Color333(7, 0, 0));
-        wait_ms(500);
-    }
-    BT.printf("D");
     while(1) {
-        for (int j =0; j<=7; j++) { // Clignotement panneau
-            for (int k=0; k<=7; k++) {
-                for (int l =0; l<=7; l++) {
-                    matrix.fillScreen(matrix.Color333(j, k, l));
+        if(BT_PR.readable()) {         //Réception d'instruction de l'expérience
+            if(BT_PR.getc() == 'A') {
+                //pc.putc(BT_PR.getc());
+                for (int i =0; i<3; i++) { // Clignotement panneau
+                    matrix.fillScreen(matrix.Color333(0, 0, 0));
+                    wait_ms(500);
+                    matrix.fillScreen(matrix.Color333(7, 0, 0));
                     wait_ms(500);
                 }
+                BT_E.printf("D");
+                while(1) {
+                    for (int j =0; j<=7; j++) { // Clignotement panneau
+                        for (int k=0; k<=7; k++) {
+                            for (int l =0; l<=7; l++) {
+                                matrix.fillScreen(matrix.Color333(j, k, l));
+                                wait_ms(500);
+                            }
+                        }
+                    }
+                }
             }
         }
     }