subscribe variable in arduino [closed]

asked 2016-04-06 08:15:08 -0500

Emilien gravatar image

updated 2016-04-06 09:19:37 -0500

hi, i create a node arduino that publish a variable with 3 values in Int8 type, and also i create a node cpp that subscribe in the variable value. when i subscribe, i receive a value fix and different to my values with 8 numbers. 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;
}

but when i run: rosrun echo /servo, i receive my values

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by ahendrix
close date 2016-04-06 14:03:42.753797

Comments

"what can i do please?" You could show your code : )

NEngelhard gravatar image NEngelhard  ( 2016-04-06 08:55:38 -0500 )edit

ok i add my code.

Emilien gravatar image Emilien  ( 2016-04-06 09:19:58 -0500 )edit

This is a duplicate of http://answers.ros.org/question/23097... . Please follow the comments and update your existing question instead of asking a new question.

ahendrix gravatar image ahendrix  ( 2016-04-06 14:03:39 -0500 )edit