Hsieh JenYun
/
rosserial_mbed_hello_world_publisher
ROShelloworld
Fork of rosserial_mbed_hello_world_publisher by
main.cpp
- Committer:
- Tanakacool
- Date:
- 2018-10-01
- Revision:
- 1:332d75519cfa
- Parent:
- 0:17fd7572aedb
File content as of revision 1:332d75519cfa:
/* * 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); } }