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
Diff: source/network-helper.h
- Branch:
- mbed-os-5.10
- Revision:
- 30:4825e4f38844
- Child:
- 31:66704f6f17c5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/network-helper.h Mon Oct 29 14:34:43 2018 +0800 @@ -0,0 +1,28 @@ +#ifndef _MBED_HTTP_EXAMPLE_H_ +#define _MBED_HTTP_EXAMPLE_H_ + +#include "mbed.h" + +/** + * Connect to the network using the default networking interface, + * you can also swap this out with a driver for a different networking interface + * if you use WiFi: see mbed_app.json for the credentials + */ +NetworkInterface *connect_to_default_network_interface() { + printf("[NWKH] Connecting to network...\n"); + + NetworkInterface* network = NetworkInterface::get_default_instance(); + + nsapi_error_t connect_status = network->connect(); + + if (connect_status != NSAPI_ERROR_OK) { + printf("[NWKH] Failed to connect to network (%d)\n", connect_status); + return NULL; + } + + printf("[NWKH] Connected to the network\n"); + printf("[NWKH] IP address: %s\n", network->get_ip_address()); + return network; +} + +#endif // _MBED_HTTP_EXAMPLE_H_