Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / examples / HelloWorld / HelloWorld.pde @ c1426757

History | View | Annotate | Download (402 Bytes)

1
/*
2
 * rosserial Publisher Example
3
 * Prints "hello world!"
4
 */
5

    
6
#include <ros.h>
7
#include <std_msgs/String.h>
8

    
9
ros::NodeHandle  nh;
10

    
11
std_msgs::String str_msg;
12
ros::Publisher chatter("chatter", &str_msg);
13

    
14
char hello[13] = "hello world!";
15

    
16
void setup()
17
{
18
  nh.initNode();
19
  nh.advertise(chatter);
20
}
21

    
22
void loop()
23
{
24
  str_msg.data = hello;
25
  chatter.publish( &str_msg );
26
  nh.spinOnce();
27
  delay(1000);
28
}