![](/media/cache/profiles/2019-02-17_Foto_de_perfil_014_03.jpg.50x50_q85.jpg)
Personal fork
Dependencies: Servo mbed rosserial_mbed_lib
Fork of rosserial_mbed by
Diff: examples/HelloWorld.cpp
- Revision:
- 0:06fc856e99ca
- Child:
- 3:dff241b66f84
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/HelloWorld.cpp Fri Aug 19 09:06:16 2011 +0000 @@ -0,0 +1,32 @@ +//#define COMPILE_HELLOWORLD_CODE_ROSSERIAL +#ifdef COMPILE_HELLOWORLD_CODE_ROSSERIAL + +/* + * 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!"; + +int main() { + nh.initNode(); + nh.advertise(chatter); + + while (1) { + str_msg.data = hello; + chatter.publish( &str_msg ); + nh.spinOnce(); + wait_ms(1000); + } +} + +#endif \ No newline at end of file