Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Manchester mbed CRC16 ManchesterMsg
Revision 0:91017f5f5cb3, committed 2017-05-17
- Comitter:
- hudakz
- Date:
- Wed May 17 07:59:46 2017 +0000
- Child:
- 1:2ce05484e526
- Commit message:
- Initial issue.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Manchester.lib Wed May 17 07:59:46 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/hudakz/code/Manchester/#d5c75b0e5708
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed May 17 07:59:46 2017 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "Manchester.h"
+
+DigitalOut led(LED1);
+Manchester man(p11, p12, 9600); // Tx pin, Rx pin, speed [bps]
+ManchesterMsg msg(255); // Message container (max bytes)
+char str[255]; // Array of char
+uint32_t val;
+
+int main(void) {
+
+ while(1) {
+ if(man.receive(msg)) { // Receive message
+ // Print data length and raw data
+ printf("\r\n----------------------\r\n");
+ printf("len = %d\r\n", msg.len);
+ printf("raw data :\r\n");
+ for(int i = 0; i < msg.len; i++)
+ printf("\t0x%.2x\r\n", msg.data[i]);
+
+ // Extract data from message and print
+ msg >> str >> val;
+ printf("data :\r\n");
+ printf("\tstr = %s\r\n", str);
+ printf("\tval = 0x%x\r\n", val);
+ }
+ else
+ printf("Error\r\n");
+
+ led = !led;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed May 17 07:59:46 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/4eea097334d6 \ No newline at end of file