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: ADXL362 mbed MPL3115A2
Revision 30:9e127911409d, committed 2018-03-08
- Comitter:
- htdoughe
- Date:
- Thu Mar 08 21:52:44 2018 +0000
- Parent:
- 29:f328fa35e8eb
- Child:
- 31:c924aad0dc4b
- Commit message:
- report and code
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| report.txt | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 08 21:18:29 2018 +0000
+++ b/main.cpp Thu Mar 08 21:52:44 2018 +0000
@@ -326,14 +326,14 @@
printf("error: WHO_AM_I is not 0xC4; exiting\r\n");
return -1;
} else {
- double data[1000];
+ double data[900];
int ind = 0;
//set sample_time
wait_ms(100);
uint8_t st = pressure.getCTRL_REG1();
- uint8_t msk = 0xc7;
+ uint8_t msk = 0x8f;
printf("CTL_REG1 = 0x%05x\r\n", st);
pressure.setCTRL_REG1(msk);
pressure.activate();
@@ -346,23 +346,25 @@
//GPIO pin indicates sampling should begin -- if voltage == 3.3, start
- while(ind < 1000 && !pc.readable()) {
+ while(ind < 900 && !pc.readable()) {
printf("in the while\r\n");
//then we measure
//pressure and temperature sampled at 10times/second (10 hz)
//LED blinks during sampling at 1 hz (1 time/second)
led3 = 1;
for(int i = 0; i < 10; i++) {
- pressure.readRegs(mregids[1], tmp, 3) ;
- pres = ((tmp[0]<<16)|(tmp[1]<<8)|(tmp[2])) >> 6;
+ pres = pressure.getPressure();
+ //pressure.readRegs(mregids[1], tmp, 3) ;
+ //pres = ((tmp[0]<<16)|(tmp[1]<<8)|(tmp[2])) >> 6;
data[ind++] = pres;
data[ind++] = pressure.getTemperature();
wait_ms(100);
}//for
led3 = 0;
for(int i = 0; i < 10; i++) {
- pressure.readRegs(mregids[1], tmp, 3) ;
- pres = ((tmp[0]<<16)|(tmp[1]<<8)|(tmp[2])) >> 6;
+ pres = pressure.getPressure();
+ //pressure.readRegs(mregids[1], tmp, 3) ;
+ //pres = ((tmp[0]<<16)|(tmp[1]<<8)|(tmp[2])) >> 6;
data[ind++] = pres;
data[ind++] = pressure.getTemperature();
wait_ms(100);
--- a/report.txt Thu Mar 08 21:18:29 2018 +0000
+++ b/report.txt Thu Mar 08 21:52:44 2018 +0000
@@ -17,7 +17,7 @@
# Documentation on Altimeter Measurement
-Our altimeter code (measureAlt()) reports the atmospheric pressure in Pascals and
+Our altimeter code (measureAlt()) reports the atmospheric pressure in Hecto-Pascals and
temperature in Celcius, retrieved from the appropriate registers at a rate of 10Hz.
The function saves the first 1000 measurements into an array of doubles (doubles being
the returned values of both our pressure and temperature measurements), arranged in
@@ -40,6 +40,9 @@
measuring values. This is a limitation of our code that we are attempting to
(and fully plan to) address.
+ In addition, our code does not include the GPIO pin at the moment because screen
+ breaks when it is added.
+
Example output:
98763.000000 22.187500