HelloWorld.cpp
Go to the documentation of this file.
1 /*
2  * rosserial Publisher Example
3  * Prints "hello world!"
4  */
5 
6 #include"mbed.h"
7 #include <ros.h>
8 #include <std_msgs/String.h>
9 
11 
12 std_msgs::String str_msg;
13 ros::Publisher chatter("chatter", &str_msg);
14 
15 char hello[13] = "hello world!";
16 
17 DigitalOut led = LED1;
18 
19 int main() {
20  nh.initNode();
21  nh.advertise(chatter);
22 
23  while (1) {
24  led = !led;
25  str_msg.data = hello;
27  nh.spinOnce();
28  wait_ms(1000);
29  }
30 }
31 
void publish(const boost::shared_ptr< M > &message) const
char hello[13]
Definition: HelloWorld.cpp:15
ros::NodeHandle nh
Definition: HelloWorld.cpp:10
DigitalOut led
Definition: HelloWorld.cpp:17
int main()
Definition: HelloWorld.cpp:19
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Publisher chatter("chatter",&str_msg)
std_msgs::String str_msg
Definition: HelloWorld.cpp:12


rosserial_mbed
Author(s): Gary Servin
autogenerated on Mon Jun 10 2019 14:53:26