This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

tests/time_test.cpp

Committer:
nucho
Date:
2012-02-29
Revision:
4:684f39d0c346
Parent:
3:1cf99502f396

File content as of revision 4:684f39d0c346:

//#define COMPILE_TIME_CODE_ROSSERIAL
#ifdef COMPILE_TIME_CODE_ROSSERIAL

/*
 * rosserial::std_msgs::Time Test
 * Publishes current time
 */

#include "mbed.h"
#include <ros.h>
#include <ros/time.h>
#include <std_msgs/Time.h>


ros::NodeHandle  nh;

std_msgs::Time test;
ros::Publisher p("my_topic", &test);

int main() {
    nh.initNode();
    nh.advertise(p);

    while (1) {
        test.data = nh.now();
        p.publish( &test );
        nh.spinOnce();
        wait_ms(10);
    }
}
#endif