File tree 1 file changed +16
-10
lines changed
1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 1
1
#include " pins.h"
2
2
#include " mbed.h"
3
- #include " MPL3115A2 .h"
3
+ #include " BMP388 .h"
4
4
5
- DigitalOut myled (STATE_LED_RED);
5
+ // TODO Define your pins here
6
+ // Syntax: DigitalOut <pin_name>(<pin_number>); (without the angle brackets)
6
7
7
8
float max_alt;
9
+ // TODO What other vars might it be useful to define?
8
10
9
11
I2C i2c_sensors (I2C_SENSOR_SDA, I2C_SENSOR_SCL);
10
12
Serial debug (DEBUG_TX, DEBUG_RX);
11
13
12
- Altitude altitude;
13
- MPL3115A2 altimeter (&i2c_sensors, &debug);
14
+ Pressure pressure;
15
+ BMP388 barometer (&i2c_sensors, &debug);
16
+
14
17
15
18
void start () {
19
+ // Assign any other variables here.
16
20
max_alt = 0 ;
17
- altimeter .init ();
21
+ barometer .init ();
18
22
}
19
23
20
24
void loop () {
21
- myled = (micros () / 1000000 ) & 1 ; // Flash every second
22
-
23
- altimeter.readAltitude (&altitude);
24
- const float alt = altitude.altitude ();
25
+ // Read pressure using the BMP388 library
26
+ barometer.readPressure (&pressure);
27
+ float pressure_pascals = pressure.pressure ();
28
+
29
+ // TODO Convert pressure to altitude.
30
+ // TODO Update max altitude
31
+ // TODO Deploy parachutes at the correct time by setting pins to a boolean true value
25
32
26
- max_alt = max (max_alt, alt);
27
33
}
28
34
29
35
int main () {
You can’t perform that action at this time.
0 commit comments