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: mbed ATParser MPL3115A2 TSL2561
Diff: main.cpp
- Revision:
- 0:53659b13e448
- Child:
- 1:731cbdf8e672
diff -r 000000000000 -r 53659b13e448 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Apr 05 14:55:49 2018 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "ATParser.h"
+#include "MPL3115A2.h"
+
+MPL3115A2 pressure_sensor(PB_7, PB_6, 0x60);
+BufferedSerial pc(SERIAL_TX, SERIAL_RX);
+BufferedSerial dev(PA_9, PA_10);
+DigitalOut myled(LED1);
+
+int main() {
+ double temp, pres;
+ char address[100];
+ char len;
+ pc.baud(115200);
+ dev.baud(115200);
+
+ pc.printf("Begin headaches\n\r");
+
+ ATParser at = ATParser(dev, "\r\n");
+
+ if (at.send("AT") && at.recv("OK"))
+ pc.printf("AT Communication Success\n\r");
+
+ // Set pressure sensor to read in units of ???????
+ pressure_sensor.setCTRL_REG1( 0xA1 );
+
+ // Wait for "s" string from console serial input.
+ while(1) {
+ // Read temperature and pressure from MPL3115A2.
+ if (pc.getc() == "s")
+ {
+ // Force XDot to send to MQTT server
+ temp = pressure_sensor.getTemperature();
+ pres = pressure_sensor.getAltitude();
+ }
+
+
\ No newline at end of file