Adaptation of the esp8266-driver demo program to control a GOPRO HERO3+ camera. This demo can only take a photo
Fork of mbed-os-example-mbed5-wifi by
Revision 35:052c1ba06ce7, committed 2017-09-26
- Comitter:
- mbed_official
- Date:
- Tue Sep 26 11:45:04 2017 +0100
- Parent:
- 34:297e06ef6c8f
- Child:
- 36:aa0b6789bbd2
- Commit message:
- Get rid of \r\n by adding newlines to mbed_app.json
We can do it in the `mbed_app.json`, rather than in every single
`printf()` line.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-wifi
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed_app.json | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 26 11:15:03 2017 +0100 +++ b/main.cpp Tue Sep 26 11:45:04 2017 +0100 @@ -63,7 +63,7 @@ { WiFiAccessPoint *ap; - printf("Scan:\r\n"); + printf("Scan:\n"); int count = wifi->scan(NULL,0); @@ -74,11 +74,11 @@ count = wifi->scan(ap, count); for (int i = 0; i < count; i++) { - printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\r\n", ap[i].get_ssid(), + printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\n", ap[i].get_ssid(), sec2str(ap[i].get_security()), ap[i].get_bssid()[0], ap[i].get_bssid()[1], ap[i].get_bssid()[2], ap[i].get_bssid()[3], ap[i].get_bssid()[4], ap[i].get_bssid()[5], ap[i].get_rssi(), ap[i].get_channel()); } - printf("%d networks available.\r\n", count); + printf("%d networks available.\n", count); delete[] ap; } @@ -88,13 +88,13 @@ TCPSocket socket; nsapi_error_t response; - printf("Sending HTTP request to www.arm.com...\r\n"); + printf("Sending HTTP request to www.arm.com...\n"); // Open a socket on the network interface, and create a TCP connection to www.arm.com socket.open(net); response = socket.connect("www.arm.com", 80); if(0 != response) { - printf("Error connecting: %d\r\n", response); + printf("Error connecting: %d\n", response); socket.close(); return; } @@ -107,13 +107,13 @@ { response = socket.send(sbuffer+response, size); if (response < 0) { - printf("Error sending data: %d\r\n", response); + printf("Error sending data: %d\n", response); socket.close(); return; } else { size -= response; // Check if entire message was sent or not - printf("sent %d [%.*s]\r\n", response, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); + printf("sent %d [%.*s]\n", response, strstr(sbuffer, "\r\n")-sbuffer, sbuffer); } } @@ -121,9 +121,9 @@ char rbuffer[64]; response = socket.recv(rbuffer, sizeof rbuffer); if (response < 0) { - printf("Error receiving data: %d\r\n", response); + printf("Error receiving data: %d\n", response); } else { - printf("recv %d [%.*s]\r\n", response, strstr(rbuffer, "\r\n")-rbuffer, rbuffer); + printf("recv %d [%.*s]\n", response, strstr(rbuffer, "\r\n")-rbuffer, rbuffer); } // Close the socket to return its memory and bring down the network interface @@ -132,27 +132,27 @@ int main() { - printf("WiFi example\r\n\r\n"); + printf("WiFi example\n\n"); scan_demo(&wifi); - printf("\r\nConnecting...\r\n"); + printf("\nConnecting...\n"); int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2); if (ret != 0) { - printf("\r\nConnection error\r\n"); + printf("\nConnection error\n"); return -1; } - printf("Success\r\n\r\n"); - printf("MAC: %s\r\n", wifi.get_mac_address()); - printf("IP: %s\r\n", wifi.get_ip_address()); - printf("Netmask: %s\r\n", wifi.get_netmask()); - printf("Gateway: %s\r\n", wifi.get_gateway()); - printf("RSSI: %d\r\n\r\n", wifi.get_rssi()); + printf("Success\n\n"); + printf("MAC: %s\n", wifi.get_mac_address()); + printf("IP: %s\n", wifi.get_ip_address()); + printf("Netmask: %s\n", wifi.get_netmask()); + printf("Gateway: %s\n", wifi.get_gateway()); + printf("RSSI: %d\n\n", wifi.get_rssi()); http_demo(&wifi); wifi.disconnect(); - printf("\r\nDone\r\n"); + printf("\nDone\n"); }
--- a/mbed_app.json Tue Sep 26 11:15:03 2017 +0100 +++ b/mbed_app.json Tue Sep 26 11:45:04 2017 +0100 @@ -22,6 +22,9 @@ } }, "target_overrides": { + "*": { + "platform.stdio-convert-newlines": true + }, "UBLOX_EVK_ODIN_W2": { "target.device_has": ["EMAC"] },