CPS-Lab* / Mbed 2 deprecated lab9_p2

Dependencies:   ADXL362 Lab7 mbed

Files at this revision

API Documentation at this revision

Comitter:
dprowe
Date:
Wed Apr 11 01:34:07 2018 +0000
Commit message:
the second coding part

Changed in this revision

ADXL362.lib Show annotated file Show diff for this revision Revisions of this file
MPL3115A2.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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