test recieve
Dependencies: libxDot-mbed5 ISL29011
Fork of Dot-Examples by
Diff: examples/src/peer_to_peer_example.cpp
- Revision:
- 25:bd723518db86
- Parent:
- 22:d9bc10bbc433
--- a/examples/src/peer_to_peer_example.cpp Tue Jul 11 10:46:17 2017 -0500 +++ b/examples/src/peer_to_peer_example.cpp Sun Feb 11 00:01:23 2018 +0000 @@ -163,34 +163,23 @@ while (true) { uint16_t light; - std::vector<uint8_t> tx_data; + std::vector<uint8_t> rx_data; // join network if not joined if (!dot->getNetworkJoinStatus()) { join_network(); } -#if defined(TARGET_XDOT_L151CC) - // get the latest light sample and send it to the gateway - light = lux.getData(); - tx_data.push_back((light >> 8) & 0xFF); - tx_data.push_back(light & 0xFF); - logInfo("light: %lu [0x%04X]", light, light); - send_data(tx_data); -#else - // get some dummy data and send it to the gateway - light = lux.read_u16(); - tx_data.push_back((light >> 8) & 0xFF); - tx_data.push_back(light & 0xFF); - logInfo("light: %lu [0x%04X]", light, light); - send_data(tx_data); -#endif - // the Dot can't sleep in PEER_TO_PEER mode - // it must be waiting for data from the other Dot - // send data every 5 seconds - logInfo("waiting for 5s"); - wait(5); + dot->openRxWindow(6000, dot->getFrequencyBand()); + dot->recv(rx_data); + for(int i = 0; i< rx_data.size(); i++) + { + logInfo("%x02",rx_data[i]); + } + //wait(6); + void closeRxWindow(); + } return 0;