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:
- 8:ac1e388d4d1b
- Parent:
- 7:f2c4408367f7
- Child:
- 9:19db940991af
--- a/lab7.cpp Fri Mar 02 20:12:03 2018 +0000
+++ b/lab7.cpp Sun Mar 04 22:41:57 2018 +0000
@@ -31,22 +31,16 @@
int main() {
printf("\n\rMPL3115A2 test\n\r");
mpl3115_reg_print(0x26, 1);
- // set control register 1 bit 7 to 1 (sets the pressure sensor to altimeter mode)
- uint8_t d[1];
- //pressure_sensor.readRegs(0x26, d, 1);//0x26
- //printf("d: %d\n\r",d[0]);
- //d[0] = d[0] & 0b10000001;
- //printf("d: %d\n\r",d[0]);
- pressure_sensor.readRegs(0x26, d, 1);
- d[0] = 0b10101001;
- pressure_sensor.writeRegs(d, 1);
- /* while(1) {
+ /* set bit 7 to one for altimeter mode */
+ pressure_sensor.setCTRL_REG1( 0xA9 );
+
+ while(1) {
// don't overflow buffer
if(buffer_full >= ARRAY_SIZE)
return 0;
- printf("nooooope\n\r");
+ //printf("nooooope\n\r");
if(startStop.read() == 1) {
printf("it worked\n\r");
collect_data();
@@ -56,12 +50,12 @@
offset += sizeof(double);
}
}
- */
+
- printf("start\r\n");
+ /*printf("start\r\n");
mpl3115_reg_print(38, 5);
printf("finish\r\n");
- return(0);
+ return(0);*/
}
//void MPL3115A2::readRegs(int addr, uint8_t * data, int len)
@@ -311,8 +305,8 @@
myled = !myled;
}
}
- *tempPtr = -3; // values that will indicate a sample is complete
- *pressPtr = -3;
+ *tempPtr = -23.2323; // values that will indicate a sample is complete
+ *pressPtr = -23.2323;
tempPtr = tempPtr + sizeof(double);
pressPtr = pressPtr + sizeof(double);
buffer_full++;