sd
Dependencies: BLE_API mbed nRF51822
Fork of BLE_UARTConsole by
Diff: main.cpp
- Revision:
- 10:be0d350e5489
- Parent:
- 9:5f0732aa3008
--- a/main.cpp Tue Sep 29 12:12:10 2015 +0000 +++ b/main.cpp Mon Oct 03 13:31:13 2016 +0000 @@ -42,8 +42,30 @@ void periodicCallback(void) { - led1 = !led1; - DEBUG("ping\r\n"); + //led1 = !led1; + // DEBUG("ping\r\n"); + #if 0 + /*This is tested and working fine */ + uint8_t tx_arr[5]; + tx_arr[0] = 'a'; + tx_arr[1] = 'b'; + tx_arr[2] = 'c'; + tx_arr[3] = '\n'; + tx_arr[4] = '\r'; + uart->write(tx_arr, sizeof(tx_arr)); +#endif + int temp = 0; + temp = uart->_getc(); + if (temp != EOF) + { + uint8_t tx_arr[5]; + tx_arr[0] = 'a'; + tx_arr[1] = 'b'; + tx_arr[2] = 'c'; + tx_arr[3] = '\n'; + tx_arr[4] = '\r'; + uart->write(tx_arr, sizeof(tx_arr)); + } } int main(void) @@ -58,7 +80,7 @@ uart = new UARTService(ble); - /* setup advertising */ + /* setup advertising */ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, @@ -67,7 +89,10 @@ (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed)); ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ - ble.startAdvertising(); + ble.startAdvertising(); + + + while (true) { ble.waitForEvent();