February 2018
Beginner
580 pages
13h 20m
English
In this example, we can interface the LED and push button to Arduino and control using ROS. When the push button is pressed, the Arduino node sends a True value to a topic called pushed, and at the same time, it switches on the LED which is on the Arduino board.
The following shows the circuit for doing this example:

/* * Button Example for Rosserial */ #include <ros.h> #include <std_msgs/Bool.h> //Nodehandle ros::NodeHandle nh; //Boolean message for Push button std_msgs::Bool pushed_msg; //Defining Publisher in a topic called pushed ros::Publisher ...