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.
Diff: main.cpp
- Revision:
- 1:2c0d72027a69
- Parent:
- 0:0a596069bd38
--- a/main.cpp Thu Mar 07 12:57:23 2013 +0000
+++ b/main.cpp Tue Mar 12 07:55:13 2013 +0000
@@ -15,16 +15,12 @@
return value / 256;
} //ADXL345
-float toDeg_Sec(float value) {
+short int toDeg_Sec(short int value) {
//return (value - ((scp1000.readTemperature() + 13200.0) / 280.0 + 35.0)) / 16.4;
- return (value - ((20 + 13200.0) / 280.0 + 35.0)) / 16.4; //at 20degC
+ //return (value - ((20 + 13200.0) / 280.0 + 35.0)) / 16.4; //at 20degC
+ return value / 16.4;
} //IMU3000
-
-int Xw;
-int Yw;
-int Zw;
-
short int read_x_2byte;
short int read_y_2byte;
short int read_z_2byte;
@@ -65,9 +61,10 @@
char adrIMU3000_y[1];
char readIMU3000[8];
- short int read_x_2byte = 0;
- short int read_y_2byte = 0;
- short int read_z_2byte = 0;
+ read_x_2byte = 0;
+ read_y_2byte = 0;
+ read_z_2byte = 0;
+
while (1) {
@@ -85,14 +82,22 @@
read_x_2byte = ((readIMU3000[0] << 8) + readIMU3000[1]);
read_y_2byte = ((readIMU3000[2] << 8) + readIMU3000[3]);
read_z_2byte = ((readIMU3000[4] << 8) + readIMU3000[5]);
- float Xw = toDeg_Sec(read_x_2byte );
- float Yw = toDeg_Sec(read_y_2byte );
- float Zw = toDeg_Sec(read_z_2byte );
+ short int Xw = toDeg_Sec(read_x_2byte );
+ short int Yw = toDeg_Sec(read_y_2byte );
+ short int Zw = toDeg_Sec(read_z_2byte );
+
+ scp1000.readPressure();
+ scp1000.readTemperature();
+ int Pa = scp1000.readPressure();
+ int Dc = scp1000.readTemperature();
- FILE *fp = fopen("/sd/Data.txt","a");
- fprintf(fp, "%f, %f, %f, %f, %f, %f, %f, %f\n", accelX, accelY, accelZ, Xw, Yw, Zw, scp1000.readPressure(), scp1000.readTemperature());
- myled = 1;
+ FILE *fp = fopen("/local/Data.txt","a");
+ myled = 1;
+ //fprintf(fp, "%f, %f, %f, %d, %d, %d, %f, %f\n", accelX, accelY, accelZ, Xw, Yw, Zw, Pa, Dc);
+ //fprintf(fp, "%f, %f, %f", accelX, accelY, accelZ);
+ fprintf(fp, "%d, %d, %d", Xw, Yw, Zw);
+ //fprintf(fp, "%f, %f\n", Pa, Dc);
fclose(fp);
myled = 0;