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.
HelloWorld.cpp
00001 #define COMPILE_HELLOWORLD_CODE_ROSSERIAL 00002 #ifdef COMPILE_HELLOWORLD_CODE_ROSSERIAL 00003 00004 /* 00005 * rosserial Publisher Example 00006 * Prints "hello world!" 00007 */ 00008 00009 #include"mbed.h" 00010 #include <ros.h> 00011 #include <std_msgs/String.h> 00012 00013 ros::NodeHandle nh; 00014 00015 std_msgs::String str_msg; 00016 ros::Publisher chatter("chatter", &str_msg); 00017 00018 char hello[13] = "hello world!"; 00019 00020 int main() { 00021 nh.initNode(); 00022 nh.advertise(chatter); 00023 00024 while (1) { 00025 str_msg.data = hello; 00026 chatter.publish( &str_msg ); 00027 nh.spinOnce(); 00028 wait_ms(1000); 00029 } 00030 } 00031 00032 #endif
Generated on Sun Jul 17 2022 00:31:54 by
1.7.2