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 Lab7 mbed
Revision 0:63f971f6c872, committed 2018-04-11
- Comitter:
- dprowe
- Date:
- Wed Apr 11 01:34:07 2018 +0000
- Commit message:
- the second coding part
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADXL362.lib Wed Apr 11 01:34:07 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/teams/AnalogDevices/code/ADXL362/#ae171c032dc0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPL3115A2.lib Wed Apr 11 01:34:07 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/CPS-Lab123456/code/Lab7/#d893e6f4c1ba
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Apr 11 01:34:07 2018 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "ADXL362.h"
+#include "MPL3115A2.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+
+DigitalOut myled(LED1);
+ADXL362 adxl362(PA_0,PA_7,PA_6,PA_1);
+MPL3115A2 pressure_sensor(PB_7,PB_6,0x60);
+InterruptIn event(PA_4);
+
+Serial pc(SERIAL_TX, SERIAL_RX, 115200);
+Serial device(PA_9, PA_10, 115200);
+
+
+void blink() {
+ myled = 1; // LED is ON
+ wait(1); // 1 sec
+ myled = 0; // LED is OFF
+ wait(1);
+
+}
+
+int main() {
+ device.printf("AT+FSB=1\n");
+ wait(1);
+ device.printf("AT+NI=1,MTCDT-19400691\n");
+ wait(1);
+ device.printf("AT+NK=1,MTCDT-19400691\n");
+ wait(1);
+ device.printf("AT+JOIN\n");
+ wait(1);
+
+ int i = 0;
+ while(i<3){
+ blink();
+ i++;
+ }
+
+
+ double altitudeReading;
+ double tempReading;
+ altitudeReading = pressure_sensor.getAltitude();
+ tempReading = pressure_sensor.getTemperature();
+ device.printf("AT+SEND=%.2f %.1f\n",tempReading,altitudeReading);
+
+ while(1) {
+ wait(3600);
+ double altitudeReading;
+ double tempReading;
+ altitudeReading = pressure_sensor.getAltitude();
+ tempReading = pressure_sensor.getTemperature();
+ device.printf("AT+SEND=%.2f %.1f\n",tempReading,altitudeReading);
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Apr 11 01:34:07 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file