ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have manage to get wiringPi and ROS working together. First step, you need to include in the CMakeList.txt where to find the lirary, for me it was:

FIND_LIBRARY(WIRINGPI_LIBRARY wiringPi /home/odroid/wiringPi)

The first parameter WIRINGPI_LIBRARY is just a name you give it which you will then use to refer within CMakeList. Second parameter is the library name and third parameter is the location on your system.

To use it, It depends on whether you're working using Python or C++.

1) For C++, include the library in your code and it would be something like this:

#include “wiringPi.h”       //include the library

………

wiringPiSetup();            //library setup function
pinMode(11,OUTPUT);         //set pin GPX2.1 as output. Based on wiringPi
//GPIO library map 

………

digitalWrite(11,data);      //write data(binary) to pin

And then in your CMakeList.txt, add the following:

add_executable(slave src/slave.cpp)
target_link_libraries(slave ${CATKIN_LIBRARIES} ${WIRINGPI_LIBRARY}
add_dependencies(slave beginner_tutorials_generate_messages_cpp wiringPi)

2) For python, I THINK its simply including the library in your code (not tested)