Senses an earthquake with MPU6050 and gets time, coordenates and other details of the event with an Adafruit GPS. All the info is sent to an HTTP server

Dependencies:   MPU6050 mbed-http MBed_Adafruit-GPS-Library

Committer:
Jan Jongboom
Date:
Tue Oct 30 11:07:10 2018 +0800
Branch:
mbed-os-5.10
Revision:
31:66704f6f17c5
Parent:
30:4825e4f38844
Child:
35:4b847971db1b
Update to new mbed-http, which uses TLSSocket

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jan Jongboom 30:4825e4f38844 1 #ifndef _MBED_HTTP_EXAMPLE_H_
Jan Jongboom 30:4825e4f38844 2 #define _MBED_HTTP_EXAMPLE_H_
Jan Jongboom 30:4825e4f38844 3
Jan Jongboom 30:4825e4f38844 4 #include "mbed.h"
Jan Jongboom 31:66704f6f17c5 5 #ifdef TARGET_SIMULATOR
Jan Jongboom 31:66704f6f17c5 6 #include "EthernetInterface.h"
Jan Jongboom 31:66704f6f17c5 7 #endif
Jan Jongboom 30:4825e4f38844 8
Jan Jongboom 30:4825e4f38844 9 /**
Jan Jongboom 30:4825e4f38844 10 * Connect to the network using the default networking interface,
Jan Jongboom 30:4825e4f38844 11 * you can also swap this out with a driver for a different networking interface
Jan Jongboom 30:4825e4f38844 12 * if you use WiFi: see mbed_app.json for the credentials
Jan Jongboom 30:4825e4f38844 13 */
Jan Jongboom 30:4825e4f38844 14 NetworkInterface *connect_to_default_network_interface() {
Jan Jongboom 30:4825e4f38844 15 printf("[NWKH] Connecting to network...\n");
Jan Jongboom 30:4825e4f38844 16
Jan Jongboom 31:66704f6f17c5 17 #ifdef TARGET_SIMULATOR
Jan Jongboom 31:66704f6f17c5 18 NetworkInterface* network = new EthernetInterface();
Jan Jongboom 31:66704f6f17c5 19 #else
Jan Jongboom 30:4825e4f38844 20 NetworkInterface* network = NetworkInterface::get_default_instance();
Jan Jongboom 31:66704f6f17c5 21 #endif
Jan Jongboom 30:4825e4f38844 22
Jan Jongboom 30:4825e4f38844 23 nsapi_error_t connect_status = network->connect();
Jan Jongboom 30:4825e4f38844 24
Jan Jongboom 30:4825e4f38844 25 if (connect_status != NSAPI_ERROR_OK) {
Jan Jongboom 30:4825e4f38844 26 printf("[NWKH] Failed to connect to network (%d)\n", connect_status);
Jan Jongboom 30:4825e4f38844 27 return NULL;
Jan Jongboom 30:4825e4f38844 28 }
Jan Jongboom 30:4825e4f38844 29
Jan Jongboom 30:4825e4f38844 30 printf("[NWKH] Connected to the network\n");
Jan Jongboom 30:4825e4f38844 31 printf("[NWKH] IP address: %s\n", network->get_ip_address());
Jan Jongboom 30:4825e4f38844 32 return network;
Jan Jongboom 30:4825e4f38844 33 }
Jan Jongboom 30:4825e4f38844 34
Jan Jongboom 30:4825e4f38844 35 #endif // _MBED_HTTP_EXAMPLE_H_