User Tools

Site Tools


uphp:functions:pin_get

pin_get

WMPRO FW >= 1.0 WMMEGA FW >= 2.0

Return the value of an I/O pin

Description

int pin_get ( int $pin_index, int $pin_type )

This function will get the current value of a pin based on the pin index and pin type

Parameters

$pin_index: The internal pin number. Refer to pin_configure() for the list of available pins.

$pin_type:

Pin TypeDescription
1 Digital Output
2 Digital Input
4 Analog Input
16Counter

Return Values

Integer: The returned value depends upon the pin type:

Pin TypeDescriptionReturned Value
1 Digital Output0 or 1
2 Digital Input0 or 1
4 Analog InputADC value:
WMPRO 10-bit, 0-1023
WMMEGA 12-bit, 0-4095
16CounterCounter value

See Also

pin_configure() - Configure an I/O pin as a digital input, output, or analog input

pin_set() - Set a digital output to value 1 or 0

adc_read() - Read an onboard ADC channel

uphp/functions/pin_get.txt · Last modified: 2021/09/13 05:57 (external edit)