Here it is ...
Dependencies: libxDot-mbed5 TSL2561
Fork of Dot-Examples by
Diff: examples/src/ota_example.cpp~
- Revision:
- 36:5529d26e97e6
- Parent:
- 35:b51d482e9731
- Child:
- 37:4818522075f8
--- a/examples/src/ota_example.cpp~ Tue Jul 24 11:57:49 2018 -0400 +++ b/examples/src/ota_example.cpp~ Wed Jul 25 10:39:56 2018 -0400 @@ -156,11 +156,21 @@ pc.printf("pseudo-light data: %d\r\n", light_data); pc.printf("hour: %d\r\n", ++counter); - //tx_data.push_back('M'); - sprintf(buffer, "%d", light_data); - pc.printf("char buffer: %s\r\n", buffer); - tx_data.push_back(*buffer); - tx_data.push_back(' '); + + // clean out char buffer + strcpy(buffer, "XXXX"); + // pc.printf("char buffer X: %s\r\n", buffer); + + // convert to ascii char && push to vector + ascii_converter(buffer, light_data, &tx_data, &pc); + pc.printf("char buffer converted: %s\r\n", buffer); + + if( counter < 12) + tx_data.push_back(' '); + + send_data(tx_data, &pc); + pc.printf("size: %d\r\n", tx_data.size()); + pc.printf("capacity: %d\r\n", tx_data.capacity()); // if going into deepsleep mode, save the session so we don't need to join again after waking up // not necessary if going into sleep mode since RAM is retained @@ -183,10 +193,16 @@ } pc.printf("\r\n"); - pc.printf("size of tx_data: %d\r\n", sizeof(tx_data)); + pc.printf("capacity tx_data: %d\r\n", tx_data.capacity()); + //tx_data.resize(tx_data.size()); + //tx_data.resize(36); + pc.printf("sized tx_data: %d\r\n", tx_data.size()); //actually send the data pc.printf("sending data\r\n"); - send_data(tx_data, &pc); + + int retVal = send_data(tx_data, &pc); + //while(retVal == 1) + //retVal = send_data(tx_data, &pc); // erase vector data & reset counter tx_data.erase(tx_data.begin(), tx_data.end());