ROS to mbed serial communication
Revision 0:855bc4d85b0e, committed 2018-11-09
- Comitter:
- tknara
- Date:
- Fri Nov 09 17:04:19 2018 +0000
- Commit message:
- PC(ROS)=>mbed(serial);
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Nov 09 17:04:19 2018 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+Serial pc(USBTX,USBRX);
+DigitalOut myled(PB_3);
+void pc_rx_callback(){
+ pc.attach(pc_rx_callback, Serial::RxIrq);
+ //pc.printf("%s\r\n",pc.getc());
+}
+int main() {
+ pc.baud(115200);
+ pc.attach(pc_rx_callback, Serial::RxIrq);
+ while(1) {
+ myled = 1;
+ wait(0.5);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 09 17:04:19 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file