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: lab7.cpp
- Revision:
- 10:4bf253a5c1a5
- Parent:
- 9:19db940991af
- Child:
- 11:1bf881a206a4
--- a/lab7.cpp Mon Mar 05 17:16:07 2018 +0000
+++ b/lab7.cpp Tue Mar 06 15:52:02 2018 +0000
@@ -32,8 +32,10 @@
printf("\n\rMPL3115A2 test\n\r");
mpl3115_reg_print(0x26, 1);
- /* set bit 7 to one for altimeter mode */
- pressure_sensor.setCTRL_REG1( 0xA9 );
+ /* set bit 7 to one for altimeter mode && set bits 3,4,5
+ 0xA9 for 1
+ to 0b101 130 ms, 0b100 for 66 ms if 130 is too slow (e.g. 0xA1) */
+ pressure_sensor.setCTRL_REG1( 0xA1 );
while(1) {
// don't overflow buffer
@@ -41,12 +43,13 @@
return 0;
//printf("nooooope\n\r");
- if(startStop.read() == 1) {
+ if(startStop.read()) {
printf("it worked\n\r");
collect_data();
+ printf("done collecting\n\rarray size: %d,\t buffer fill: %d\n\r", ARRAY_SIZE, buffer_full);
int offset = 0;
- for(int i = 0; i < ARRAY_SIZE; i++)
- printf("%lf\t%lf\n\r", *(pressure_arr + offset), *(temp_arr + offset));
+ for(int i = 0; i < buffer_full; i++)
+ printf("%d\t%lf\t%lf\n\r", i,*(pressure_arr + offset), *(temp_arr + offset));
offset += sizeof(double);
}
}
@@ -305,7 +308,8 @@
myled = !myled;
}
}
- *tempPtr = -23.2323; // values that will indicate a sample is complete
+
+ *tempPtr = -23.232323; // values that will indicate a sample is complete
*pressPtr = -23.2323;
tempPtr = tempPtr + sizeof(double);
pressPtr = pressPtr + sizeof(double);