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: mbed X_NUCLEO_IKS01A2
Diff: main.cpp
- Revision:
- 1:57673ebedd58
- Parent:
- 0:2da416334d69
--- a/main.cpp Thu Apr 23 18:36:48 2020 +0000 +++ b/main.cpp Thu Apr 23 19:55:53 2020 +0000 @@ -105,13 +105,15 @@ } void at_send(uint16_t port, const string& payload, bool ack = false) { - string port_msg; - port_msg.reserve(5); // max port 2^16-1 = 65545 - sprintf(&port_msg[0], "%d", port); - + //string port_msg; + char port_pref[12] = {"AT+SEND="}; + //port_msg.reserve(5); // max port 2^16-1 = 65545 + sprintf(port_pref + 8, "%d", port); + //pc.printf(port_pref); string hex_payload = hex_encode(payload); - - modem_at_cmd("AT+SEND=" + port_msg + "," + hex_payload + "," + (ack ? '1' : '0')); + //string test = (string)port_pref + "," + hex_payload + "," + (ack ? '1' : '0'); + //pc.printf(&test[0]); + modem_at_cmd((string)port_pref + "," + hex_payload + "," + (ack ? '1' : '0')); } void modem_at_cmd(const string& buffer) {