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
main.cpp
00001 #include "mbed.h" 00002 #include "ADXL362.h" 00003 #include "MPL3115A2.h" 00004 #include <stdio.h> 00005 #include <stdlib.h> 00006 00007 00008 DigitalOut myled(LED1); 00009 ADXL362 adxl362(PA_0,PA_7,PA_6,PA_1); 00010 MPL3115A2 pressure_sensor(PB_7,PB_6,0x60); 00011 InterruptIn event(PA_4); 00012 00013 Serial pc(SERIAL_TX, SERIAL_RX, 115200); 00014 Serial device(PA_9, PA_10, 115200); 00015 00016 00017 void blink() { 00018 myled = 1; // LED is ON 00019 wait(1); // 1 sec 00020 myled = 0; // LED is OFF 00021 wait(1); 00022 00023 } 00024 00025 int main() { 00026 device.printf("AT+FSB=1\n"); 00027 wait(1); 00028 device.printf("AT+NI=1,MTCDT-19400691\n"); 00029 wait(1); 00030 device.printf("AT+NK=1,MTCDT-19400691\n"); 00031 wait(1); 00032 device.printf("AT+JOIN\n"); 00033 wait(1); 00034 00035 int i = 0; 00036 while(i<3){ 00037 blink(); 00038 i++; 00039 } 00040 00041 00042 double altitudeReading; 00043 double tempReading; 00044 altitudeReading = pressure_sensor.getAltitude(); 00045 tempReading = pressure_sensor.getTemperature(); 00046 device.printf("AT+SEND=%.2f %.1f\n",tempReading,altitudeReading); 00047 00048 while(1) { 00049 wait(3600); 00050 double altitudeReading; 00051 double tempReading; 00052 altitudeReading = pressure_sensor.getAltitude(); 00053 tempReading = pressure_sensor.getTemperature(); 00054 device.printf("AT+SEND=%.2f %.1f\n",tempReading,altitudeReading); 00055 } 00056 }
Generated on Wed Jul 27 2022 12:09:23 by
1.7.2