ただのシリアルです

Dependencies:   mbed ros_lib_kinetic

main.cpp

Committer:
yuto17320508
Date:
2018-03-06
Revision:
0:728f686a985b

File content as of revision 0:728f686a985b:

/*
   2  * rosserial Publisher Example
   3  * Prints "hello world!"
   4  */
#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);
     }
 }