HelloWorld.cpp
Go to the documentation of this file.
00001 /*
00002  * rosserial Publisher Example
00003  * Prints "hello world!"
00004  */
00005 
00006 #include"mbed.h"
00007 #include <ros.h>
00008 #include <std_msgs/String.h>
00009 
00010 ros::NodeHandle  nh;
00011 
00012 std_msgs::String str_msg;
00013 ros::Publisher chatter("chatter", &str_msg);
00014 
00015 char hello[13] = "hello world!";
00016 
00017 DigitalOut led = LED1;
00018 
00019 int main() {
00020     nh.initNode();
00021     nh.advertise(chatter);
00022 
00023     while (1) {
00024         led = !led;
00025         str_msg.data = hello;
00026         chatter.publish( &str_msg );
00027         nh.spinOnce();
00028         wait_ms(1000);
00029     }
00030 }
00031 


rosserial_mbed
Author(s): Gary Servin
autogenerated on Sat Oct 7 2017 03:08:46