![](/media/cache/profiles/7c39a5f991bef4a1e34187677a65871d.jpg.50x50_q85.jpg)
Manchester transmitter demo.
Dependencies: Manchester mbed CRC16 ManchesterMsg
Diff: main.cpp
- Revision:
- 2:0ab7d3335571
- Parent:
- 1:cc6d7d370126
- Child:
- 3:28ae6f223bed
--- a/main.cpp Thu May 18 10:47:08 2017 +0000 +++ b/main.cpp Sun May 21 19:21:31 2017 +0000 @@ -6,16 +6,13 @@ Manchester man(p11, p12, 9600); // Tx pin, Rx pin, speed [bps] ManchesterMsg msg(255); // Message container (max bytes) CRC16 crc16; // CRC16 object -unsigned short calcCRC16; // CRC16 calculated int main(void) { while(1) { - msg.clear(); // Clear message - msg << "Hello World!" << 0xfa74c309; // Add some data to message - calcCRC16 = crc16.calc(msg.data, msg.len); // Calculate CRC16 - printf("calculated CRC16 = %d\r\n", calcCRC16); - msg << calcCRC16; // Append CRC16 to message - man.transmit(msg); // Transmit message + msg.clear(); // Clear the message + msg << "Hello World!" << 0xfa74c309; // Add some data to the message + msg << crc16.calc(msg.data, msg.len); // Append CRC16 to the message + man.transmit(msg); // Transmit the message wait_ms(1000); led = !led; }