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.
↧