test

Dependencies:   mbed MMA8452Q

Fork of HelloWorld by Simon Ford

Revision:
2:42408ce8f4ae
Parent:
0:fb6bbc10ffa0
Child:
3:8494c3f7108d
diff -r 03c191369089 -r 42408ce8f4ae main.cpp
--- a/main.cpp	Sun Jan 01 20:57:57 2012 +0000
+++ b/main.cpp	Tue Aug 29 20:05:04 2017 +0000
@@ -1,6 +1,40 @@
-#include "mbed.h"
+#include "mbed.h"              
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+SPI acc(p11,p12,p13);
+DigitalOut cs(p14);
+int main() {
+    while(1){
+    int nombre = 0;
+    pc.printf("Entrez un nombre de 4 chiffres : ");
+    pc.scanf("%d", &nombre);
+    pc.printf("Votre numero entrez est le : %d", nombre);
+  
+    cs = 0;
+    acc.write(0x5A);
+    cs = 1;
+    wait(0.2);
+    cs = 0;
+    wait(1);
+    }
+}
+ 
+ /*
+Serial pc(USBTX, USBRX); // tx, rx
+Serial mc(p13,p14);
+int main() {
+    
+    int nombre = 0;
+    pc.printf("Entrez un nombre de 4 chiffres : ");
+    pc.scanf("%d", &nombre);
+    pc.printf("Votre numero entrez est le : %d", nombre);
+    mc.printf(nombre);
+}
+ */
 
-DigitalOut myled(LED1);
+
+/*
+DigitalOut myled(LED2);
 
 int main() {
     while(1) {
@@ -10,3 +44,4 @@
         wait(0.2);
     }
 }
+*/
\ No newline at end of file