![](/media/cache/profiles/7c39a5f991bef4a1e34187677a65871d.jpg.50x50_q85.jpg)
Manchester transmitter demo.
Dependencies: Manchester mbed CRC16 ManchesterMsg
main.cpp@0:f58990cef4fe, 2017-05-17 (annotated)
- Committer:
- hudakz
- Date:
- Wed May 17 07:54:14 2017 +0000
- Revision:
- 0:f58990cef4fe
- Child:
- 1:cc6d7d370126
Initial issue.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:f58990cef4fe | 1 | #include "mbed.h" |
hudakz | 0:f58990cef4fe | 2 | #include "Manchester.h" |
hudakz | 0:f58990cef4fe | 3 | |
hudakz | 0:f58990cef4fe | 4 | DigitalOut led(LED1); |
hudakz | 0:f58990cef4fe | 5 | Manchester man(p11, p12, 9600); // Tx pin, Rx pin, speed [bps] |
hudakz | 0:f58990cef4fe | 6 | ManchesterMsg msg(255); // Message container (max bytes) |
hudakz | 0:f58990cef4fe | 7 | |
hudakz | 0:f58990cef4fe | 8 | int main(void) { |
hudakz | 0:f58990cef4fe | 9 | while(1) { |
hudakz | 0:f58990cef4fe | 10 | msg.clear(); // Clear message |
hudakz | 0:f58990cef4fe | 11 | msg << "Hello World!" << 0xfa74c309; // Add data to message |
hudakz | 0:f58990cef4fe | 12 | man.transmit(msg); // Transmit message |
hudakz | 0:f58990cef4fe | 13 | wait_ms(1000); |
hudakz | 0:f58990cef4fe | 14 | led = !led; |
hudakz | 0:f58990cef4fe | 15 | } |
hudakz | 0:f58990cef4fe | 16 | } |
hudakz | 0:f58990cef4fe | 17 |