The pushbutton allows the user to start a 3D scan by the push of a button, similar to how a real portable camera works. I wasnt able to access the beagleboards user button with software, so I used a simple SPST switch and wired one side to GND and the other to GPIO 139. I mounted the button on the topside of the polycarb housing. With project deadlines luming, I didn’t add any hardware de-bouncing, but this can be done later in software.
The guys over at ridgerun have a great example on GPIO and interrupts, which I have modified to suit my purposes. I have posted modifications below:
gpio = 139; // SPST connected to GPIO 139 gpio_export(gpio); //export to user space gpio_set_dir(gpio, 0); //set direction to input gpio_set_edge(gpio, “falling”); // Set interrupt edge, can be rising, falling or both. gpio_fd = gpio_fd_open(gpio);
printf("Starting Scann"); slScanner(); // run the sl code printf("Scan Completen"); printf("Press button to scan again or Ctrl C to quit");