qsfqsd

Dependencies:   C12832 mbed

Fork of EX25 by cherif bend ahmane

Revision:
1:ca389bf1cec5
Parent:
0:c09709a8f2f0
diff -r c09709a8f2f0 -r ca389bf1cec5 main.cpp
--- a/main.cpp	Wed Feb 01 11:00:41 2017 +0000
+++ b/main.cpp	Fri Feb 03 13:45:38 2017 +0000
@@ -7,18 +7,39 @@
 AnalogIn Pot1 (A0);
 C12832 ecran (D11,D13,D12,D7,D10);
 Ticker ticker;
+Ticker ticker2;
 
 char caractere = 0;
+char mot[100] = "Bonjour";
 int etat = 1;
-
+int nbCarac = 0;
+int transmissionActive = 0;
+int nbEnvoi = 1;
 void allumerEteindre()
 {
     green.write(etat);   
 }
 
+void envoyerBonjour()
+{
+    if(transmissionActive == 1 && nbEnvoi < 7*5  ){
+        pc.putc(mot[nbCarac]);
+        nbCarac ++;
+        nbEnvoi ++;
+        if(nbCarac == 7)
+        {
+            nbCarac = 0;
+        }
+        
+    }
+    
+}
+
 int main() {
     
     ticker.attach(&allumerEteindre,0.25);
+    
+    pc.attach(&envoyerBonjour,pc.TxIrq);
   
     
     while(1) {
@@ -37,7 +58,7 @@
            break;
            
            case 0x10 : //en haut
-           
+                transmissionActive = 0;
                 if(pc.writeable())
                 {
             
@@ -48,8 +69,20 @@
                 }
                   
            break;
+           
+           case 0x01 : // enfoncer
+              
+              transmissionActive = 1;
+              pc.putc(' ');
+              nbEnvoi = 0;
+              etat = 1;
+              while (joy == 0x01){}
+               
+            break;
+           
         }
         
+        
         wait(0.1);
         
     }