Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MotionSensor mbed
Fork of MAG3110 by
main.cpp
- Committer:
- Nike3221
- Date:
- 2017-01-12
- Revision:
- 7:a8a59a2b6cf6
- Child:
- 8:c8512336fa70
File content as of revision 7:a8a59a2b6cf6:
/*
* 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);}
}
