![](/media/cache/profiles/7c39a5f991bef4a1e34187677a65871d.jpg.50x50_q85.jpg)
Transmitter demo for the Manchester encoding library using UART's hardware.
Dependencies: CRC16 ManchesterMsg ManchesterUART mbed
Example of a Manchester code transmitter using the ManchesterUART library.
Diff: main.cpp
- Revision:
- 1:1d2b38950e98
- Parent:
- 0:85e4298d91d6
- Child:
- 2:2b031e7e30e9
diff -r 85e4298d91d6 -r 1d2b38950e98 main.cpp --- a/main.cpp Wed Nov 22 16:50:01 2017 +0000 +++ b/main.cpp Mon Jul 30 09:40:23 2018 +0000 @@ -2,15 +2,16 @@ #include "ManchesterUART.h" #include "CRC16.h" -ManchesterUART man(D8, D2, 230400); // Tx pin name, Rx pin name, speed [bps] -ManchesterMsg msg(255); // Message container (max bytes) +ManchesterUART man(D8, D2, 115200); // Tx pin name, Rx pin name, baudrate [bps] +ManchesterMsg msg(256); // Message container (max bytes) CRC16 crc16; // CRC16 object DigitalOut led(LED1); int main(void) { while(1) { msg.clear(); // Clear the message - msg << "Hello World!" << 0xfa74c309; // Add some data to the message + msg << 0xfa74c309; // Add some binary data to the message + msg << "Hello World!"; // Add some string 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);