![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial. This program contains an example.
Dependencies: rosserial_mbed_lib mbed Servo
Diff: examples/Logging.cpp
- Revision:
- 0:06fc856e99ca
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Logging.cpp Fri Aug 19 09:06:16 2011 +0000 @@ -0,0 +1,45 @@ +//#define COMPILE_LOGGING_CODE_ROSSERIAL +#ifdef COMPILE_LOGGING_CODE_ROSSERIAL + +/* + * rosserial PubSub Example + * Prints "hello world!" and toggles led + */ + +#include <ros.h> +#include <std_msgs/String.h> +#include <std_msgs/Empty.h> + +ros::NodeHandle nh; + +std_msgs::String str_msg; +ros::Publisher chatter("chatter", &str_msg); + +char hello[13] = "hello world!"; + +char debug[]= "debug statements"; +char info[] = "infos"; +char warn[] = "warnings"; +char error[] = "errors"; +char fatal[] = "fatalities"; + +int main() { + nh.initNode(); + nh.advertise(chatter); + + while (1) { + str_msg.data = hello; + chatter.publish( &str_msg ); + + nh.logdebug(debug); + nh.loginfo(info); + nh.logwarn(warn); + nh.logerror(error); + nh.logfatal(fatal); + + nh.spinOnce(); + wait_ms(500); + } +} + +#endif \ No newline at end of file