Search code examples
cbeagleboneblackrobotics

Robotics Cape Library not working on Beaglebone Blue


I have been trying to compile the example off of the BeagleBoneRobotics PDF, but the compiler can't find the header.

Here's the code I'm trying to compile:

#include <robotics_cape.h>
#define PIN 67

int main (void){
 // export gpio pin for use
 if(gpio_export(PIN)){
  printf("Unable to open export.\n");
  return -1;
 }
 // set pin for output
 if(gpio_set_dir(PIN, OUTPUT_PIN)){
  printf("Unable to open gpio67_direction.\n");
  return -1;
 }
 // start blinking loop
 printf("blinking LED\n");
 int i = 0;
 while(i<10){
  // turn pin on
  gpio_set_value(PIN, 1);
  printf("ON\n");
  sleep(1);
  // turn pin off
  gpio_set_value(PIN, 0);
  printf("OFF\n");
  i++; // increment counter
  sleep(1);
 }
 return 1;
}

Here's the error I'm getting:

Error

root@beaglebone:/var/lib/cloud9# gcc Testing.c -lrobotics_cape -o Testing
Testing.c:1:27: fatal error: robotics_cape.h: No such file or directory
 #include <robotics_cape.h>
                           ^
compilation terminated.

I'm on the BeagleBone Blue with robotics cape version 0.3.4.

I checked the appropriate folders, and the header and library seem to be in place. I've tried downloading the installer off of GitHub and making the library again, but still receive the same error. I've tried to reinstall the the cape with the same result. I've also dug through the source code to look for an error, but I can't find anything.

Any help would be greatly appreciated


Solution

  • Update: Solved the issue. It turns out the PDF I was using was outdated. There's a GitHub repository for the robotics cape that contains the updated code. You have to use the makefile contained in the repository to compile any code that involves the robotics cape. DO NOT USE GCC AND COMMAND LINE