arduino代码
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* rosserial Publisher Example
|
||||
* Prints "hello world!"
|
||||
*/
|
||||
|
||||
#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!";
|
||||
|
||||
void setup()
|
||||
{
|
||||
nh.initNode();
|
||||
nh.advertise(chatter);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
str_msg.data = hello;
|
||||
chatter.publish( &str_msg );
|
||||
nh.spinOnce();
|
||||
delay(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user