gf

Dependencies:   mbed MSGEQ7 ros_lib_melodic

Committer:
aldir99
Date:
Thu Mar 25 09:03:28 2021 +0000
Revision:
0:9940f2cb8603
cvgf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aldir99 0:9940f2cb8603 1 #include"mbed.h"
aldir99 0:9940f2cb8603 2 #include <ros.h>
aldir99 0:9940f2cb8603 3 #include <std_msgs/String.h>
aldir99 0:9940f2cb8603 4 #include <std_msgs/Int32.h>
aldir99 0:9940f2cb8603 5
aldir99 0:9940f2cb8603 6 ros::NodeHandle nh;
aldir99 0:9940f2cb8603 7
aldir99 0:9940f2cb8603 8 std_msgs::Int32 str_msg;
aldir99 0:9940f2cb8603 9 ros::Publisher chatter("chatter", &str_msg);
aldir99 0:9940f2cb8603 10
aldir99 0:9940f2cb8603 11 int32_t hello=1;
aldir99 0:9940f2cb8603 12
aldir99 0:9940f2cb8603 13 DigitalOut led = LED1;
aldir99 0:9940f2cb8603 14
aldir99 0:9940f2cb8603 15 int main() {
aldir99 0:9940f2cb8603 16 nh.initNode();
aldir99 0:9940f2cb8603 17 nh.advertise(chatter);
aldir99 0:9940f2cb8603 18
aldir99 0:9940f2cb8603 19 while (1) {
aldir99 0:9940f2cb8603 20 str_msg.data = hello;
aldir99 0:9940f2cb8603 21 chatter.publish( &str_msg );
aldir99 0:9940f2cb8603 22 nh.spinOnce();
aldir99 0:9940f2cb8603 23 wait_ms(50);
aldir99 0:9940f2cb8603 24 }
aldir99 0:9940f2cb8603 25 }