publish/subscribe arduino [closed]

asked 2016-04-07 03:22:43 -0500

Emilien gravatar image

hi, i want to subscribe in a node which publish 3 values from arduino. when i run: rostopic echo /servo, i receive my values, but when i run my node i receive others values. what can i do please? this is my code:

    #include "ros/ros.h"
#include "std_msgs/Int8.h"
void angleCallback(const std_msgs::Int8& servo_msg)
{
ROS_INFO("I turn: [%i]", servo_msg);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "angle_listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/servo", 1000, angleCallback);
ros::spin();
return 0;
}
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by ahendrix
close date 2016-04-07 04:23:45.769881

Comments

This is a duplicate of http://answers.ros.org/question/23097... . Please update that question instead of asking a new question. You can update your question by using the edit button.

ahendrix gravatar image ahendrix  ( 2016-04-07 04:23:42 -0500 )edit