3
Contributors
2
Replies
15
Views
1 Year
Discussion Span
Last Post by vegaseat
1

This is not enough to go on. Are these sensors built into your computer? External sensors with some sort of network connectivity? What? Have you contacted the sensor manufacturer's web site for libraries/api's and such to communicate with them, or even to get their technical specifications?

0

Here is a typical eaxample ...

//
// http://www.airspayce.com/mikem/bcm2835/examples.html
//

#include <bcm2835.h>
#include <stdio.h>
// Input on RPi pin GPIO 15
#define PIN RPI_GPIO_P1_15

int main(int argc, char **argv)
{
    // If you call this, it will not actually access the GPIO
    // Use for testing
//    bcm2835_set_debug(1);
    if (!bcm2835_init())
        return 1;
    // Set RPI pin P1-15 to be an input
    bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_INPT);
    //  with a pullup
    bcm2835_gpio_set_pud(PIN, BCM2835_GPIO_PUD_UP);
    // Blink
    while (1)
    {
        // Read some data
        uint8_t value = bcm2835_gpio_lev(PIN);
        printf("read from pin 15: %d\n", value);

        // wait a bit
        delay(500);
    }
    bcm2835_close();
    return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.