rosserial_mbed Hello World

Dependencies:   mbed ros_lib_indigo

Files at this revision

API Documentation at this revision

Comitter:
garyservin
Date:
Tue Apr 19 21:11:17 2016 +0000
Commit message:
Initial commit

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
ros_lib_indigo.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 17fd7572aedb main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 19 21:11:17 2016 +0000
@@ -0,0 +1,30 @@
+/*
+ * rosserial Publisher Example
+ * Prints "hello world!"
+ */
+
+#include"mbed.h"
+#include <ros.h>
+#include <std_msgs/String.h>
+
+ros::NodeHandle  nh;
+
+std_msgs::String str_msg;
+ros::Publisher chatter("chatter", &str_msg);
+
+char hello[13] = "hello world!";
+
+DigitalOut led = LED1;
+
+int main() {
+    nh.initNode();
+    nh.advertise(chatter);
+
+    while (1) {
+        led = !led;
+        str_msg.data = hello;
+        chatter.publish( &str_msg );
+        nh.spinOnce();
+        wait_ms(1000);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 17fd7572aedb mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 19 21:11:17 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file
diff -r 000000000000 -r 17fd7572aedb ros_lib_indigo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ros_lib_indigo.lib	Tue Apr 19 21:11:17 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/garyservin/code/ros_lib_indigo/#fd24f7ca9688