librpipGpioPinWrite

uint32_t librpipGpioPinWrite(uint32_t pin, uint32_t value);

Description

Sets a pin to off (0) or on (1).

Parameters

  • uint32_t pin
    The pin number to write to. The pin should be valid and configured for output.
  • uint32_t value
    0 is off, >=1 is on.

Returns

0 on failure, 1 on success.

Example

Setup GPIO pin 16 for output, and then set to high (1) :

uint32_t feature_set;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_GPIO) { 
        librpipGpioConfigPinWrite(16, LIBRPIP_GPIO_FLAG_FNC_OUT);
        librpipGpioPinWrite(16, 1);
}
librpipClose();