kyunsat / Mbed 2 deprecated MAG3110_2

Dependencies:   MotionSensor mbed

Fork of MAG3110 by kyunsat

Revision:
7:a8a59a2b6cf6
Child:
8:c8512336fa70
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 12 05:21:13 2017 +0000
@@ -0,0 +1,40 @@
+/*
+ * MAG3110 Sensor Library for mbed
+ * TODO: Add proper header
+ */
+
+
+#include "mbed.h"
+#include "MotionSensor.h"
+#include "MAG3110.h"
+
+Serial pc(USBTX,USBRX);
+int16_t x,y,z;
+LocalFileSystem local("local");
+
+MAG3110 mag(p28,p27);
+
+
+
+int main(){
+    while(1){
+    mag.enable();
+    //void disable(void);
+    mag.sampleRate(0x80);
+    //uint32_t whoAmI(void);
+    //uint32_t dataReady(void);
+    mag.getX(&x);
+    mag.getY(&y);
+    mag.getZ(&z);
+    //void getX(float * x);
+    //void getY(float * y);
+    //void getZ(float * z);
+    //void getAxis(MotionSensorDataCounts &data);
+    //void getAxis(MotionSensorDataUnits &data);
+    //void readRegs(int addr, uint8_t * data, int len);
+    pc.printf("x: %d  y: %d  z: %d\n",x,y,z);
+    
+    FILE *fp = fopen("/local/commpas_new.txt","a");
+               fprintf(fp,"%d,%d,%d\n",x,y,z);
+               fclose(fp);}
+}
\ No newline at end of file