still need some modification
Dependencies: mbed-http DebounceIn PinDetect OneButton
network-helper.h
00001 #ifndef _MBED_HTTP_EXAMPLE_H_ 00002 #define _MBED_HTTP_EXAMPLE_H_ 00003 00004 #include "mbed.h" 00005 #include "NetworkInterface.h" 00006 00007 /** 00008 * Connect to the network using the default networking interface, 00009 * you can also swap this out with a driver for a different networking interface 00010 * if you use WiFi: see mbed_app.json for the credentials 00011 */ 00012 NetworkInterface *connect_to_default_network_interface() { 00013 printf("[NWKH] Connecting to network...\n"); 00014 00015 NetworkInterface* network = NetworkInterface::get_default_instance(); 00016 network->set_network("10.5.254.91","255.255.248.0","10.5.248.1"); 00017 00018 if (!network) { 00019 printf("[NWKH] No network interface found, select an interface in 'network-helper.h'\n"); 00020 return NULL; 00021 } 00022 00023 nsapi_error_t connect_status = network->connect(); 00024 00025 if (connect_status != NSAPI_ERROR_OK) { 00026 printf("[NWKH] Failed to connect to network (%d)\n", connect_status); 00027 return NULL; 00028 } 00029 00030 printf("[NWKH] Connected to the network\n"); 00031 printf("[NWKH] IP address: %s\n", network->get_ip_address()); 00032 return network; 00033 } 00034 00035 #endif // _MBED_HTTP_EXAMPLE_H_
Generated on Sun Jul 17 2022 23:44:58 by
1.7.2