Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 314

How can i send a message from ROS to arduino using rosserial?

$
0
0
Here is my arduino code: #include #include #include ros::NodeHandle nh; void ledGlow(const std_msgs::Int8& val){ if(val.data==100){ digitalWrite(13, HIGH); } else{ digitalWrite(13, LOW); } } ros::Subscriber led("led/start", &ledGlow); void setup() { pinMode(13, OUTPUT); nh.initNode(); nh.subscribe(led); } void loop() { nh.spinOnce(); delay(10); } I am giving the following commands in the terminal: 1. roscore 2. rostopic pub led/start std_msgs/Int8 100 After giving the second command LED 13 doesn't glow, also RX led on arduino board doesn't blink.

Viewing all articles
Browse latest Browse all 314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>