======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 Type^Description^
|1 |Digital Output|
|2 |Digital Input|
|4 |Analog Input|
|16|Counter|
====Return Values====
Integer: The returned value depends upon the pin type:
^Pin Type^Description^Returned Value^
|1 |Digital Output|0 or 1|
|2 |Digital Input|0 or 1|
|4 |Analog Input|ADC value:|
|:::|:::|WMPRO 10-bit, 0-1023|
|:::|:::|WMMEGA 12-bit, 0-4095|
|16|Counter|Counter 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