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: mbed ros_lib_melodic
Revision 0:91fdcf1ce3aa, committed 2021-10-29
- Comitter:
- stivending
- Date:
- Fri Oct 29 12:36:50 2021 +0000
- Commit message:
- a working sample keeping to publish data;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 29 12:36:50 2021 +0000
@@ -0,0 +1,36 @@
+/*
+ * rosserial Publisher Example
+ * Prints "hello world!"
+ */
+
+#include "mbed.h"
+#include "string.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[] = "Hello from Nucleo";
+DigitalOut led = LED1;
+DigitalIn but(USER_BUTTON);
+
+int main() {
+ nh.initNode();
+ nh.advertise(chatter);
+
+ while (1) {
+ //if(but == 0) {
+ // while(but == 0);
+ led = !led;
+ str_msg.data = hello;
+ chatter.publish( &str_msg );
+ nh.spinOnce();
+
+ //}
+
+ wait_ms(100);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 29 12:36:50 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ros_lib_melodic.lib Fri Oct 29 12:36:50 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/garyservin/code/ros_lib_melodic/#da82487f547e