Lab4-01_measure_acceleration_lite

Dependencies:   mbed HEPTA_SENSOR_lite HEPTA_EPS_lite

Revision:
2:48467db233ff
Parent:
1:ddac5ec89167
Child:
3:b5809ec2a8cd
diff -r ddac5ec89167 -r 48467db233ff main.cpp
--- a/main.cpp	Wed Aug 11 03:50:32 2021 +0000
+++ b/main.cpp	Fri Aug 20 12:31:01 2021 +0000
@@ -1,19 +1,17 @@
 #include "mbed.h"
-#include "HEPTA_CDH.h"
-HEPTA_CDH cdh(PB_5, PB_4, PB_3, PA_8, "sd");
+#include "HEPTA_EPS.h"
+#include "HEPTA_SENSOR.h"
+HEPTA_EPS eps(PA_0,PA_4);
+HEPTA_SENSOR sensor(PA_7,PB_7,PB_6,0xD0);
 Serial pc(USBTX,USBRX,9600);
 int main()
-{
-    pc.printf("Hello World!\n");
- 
-    mkdir("/sd/mydir", 0777);
- 
-    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
-    if(fp == NULL) {
-        error("Could not open file for write\r\n");
+{   
+    float ax,ay,az;
+    pc.printf("Acceleration Sensor\r\n");
+    eps.turn_on_regulator(); //Turn on 3.3V converter
+    for(int i=0;i<50;i++){
+        sensor.sen_acc(&ax,&ay,&az);
+        pc.printf("%f,%f,%f\r\n",ax,ay,az);
+        wait_ms(1000);
     }
-    fprintf(fp, "Hello my name is HEPTA\r\n");
-    fclose(fp);
- 
-    pc.printf("Goodbye World!\r\n");
 }
\ No newline at end of file