projets de S3 S4 année 21 22

Dependencies:   mbed

Revision:
2:1af4d847d589
Parent:
1:95a7e179a181
Child:
5:10349dda4f42
--- a/main.cpp	Tue May 10 11:50:12 2016 +0000
+++ b/main.cpp	Thu May 12 12:11:23 2016 +0000
@@ -8,6 +8,9 @@
 #define R 0
 #define V 1
 #define B 2
+
+AnalogIn canx(PC_4);AnalogIn cany(PB_1); DigitalOut plus(PB_15); //adxl335
+
 DigitalOut sd(PC_9);
 Serial serie(NC, PC_7);  // tx, rx  
 BusOut ABCD(PA_14,PB_0,PA_15,PC_1); // version 32/32  nucleo f401 
@@ -38,6 +41,8 @@
 char pixt ; int rr; int vv ; int bb ; // pour des couleurs
 int ptx; int pty ; int xx ; int yy ; // utile dans recv > 1078
 int bcl ;
+float xin; float yin;  // lecture accelero
+int accx ; int accy ;  // acceleration
       
 #include "LED.h"       // transferts LED <>401
 #include "char.h"     // transfert RX 401<>1768
@@ -55,6 +60,7 @@
     Tr();  // efface T
     Ir();  // efface I
     ordrefait = 0;
+    plus = HIGH ;
    }
 
 int main()
@@ -63,7 +69,9 @@
 
 //
 while(1)  // boucle sans fin ( temps d'execution 30 ms )
-    {      
+    {  
+    xin = canx.read(); yin= cany.read(); 
+    accx = xin * 150-75; accy = yin * 150 - 75 ;      
     draw();  //   dans draw.h c'est le lieu de votre programme en Tr
            
     IversT();   // recharge votre image I  vers T