test

Dependencies:   mbed MMA8452Q

Fork of HelloWorld by Simon Ford

Revision:
3:8494c3f7108d
Parent:
2:42408ce8f4ae
Child:
4:a38ef4c242ef
--- a/main.cpp	Tue Aug 29 20:05:04 2017 +0000
+++ b/main.cpp	Wed Aug 30 17:42:03 2017 +0000
@@ -1,6 +1,26 @@
 #include "mbed.h"              
  
 Serial pc(USBTX, USBRX); // tx, rx
+I2C comI2C(p9,p10);
+// Communication I2C
+int main() {
+    int degree = 3;
+    while(1){
+        
+    pc.printf("test avant read");
+    comI2C.start();
+    comI2C.read(1);
+    comI2C.stop();
+    pc.printf("test apres read");
+    
+    pc.printf("degree = %d", degree);
+    wait(2);
+    }
+}
+
+
+/* communication SPI 
+Serial pc(USBTX, USBRX); // tx, rx
 SPI acc(p11,p12,p13);
 DigitalOut cs(p14);
 int main() {
@@ -11,14 +31,13 @@
     pc.printf("Votre numero entrez est le : %d", nombre);
   
     cs = 0;
-    acc.write(0x5A);
+    acc.write(nombre);
     cs = 1;
     wait(0.2);
     cs = 0;
     wait(1);
     }
-}
- 
+}*/
  /*
 Serial pc(USBTX, USBRX); // tx, rx
 Serial mc(p13,p14);