pk_digital()
Reads or sets the digital state of a PoKeys pin.
Syntax
pk_digital(pin)
pk_digital(pin, state)
Parameters
| Parameter | Type | Description | Comment |
| pin | Number | The digital pin number | Required |
| state | Number | The state to set (0 = Low, 1 = High) | Optional (write mode) |
Return Value
If called with one parameter, returns the current state of the specified pin (0 or 1).
If called with two parameters, sets the pin state and returns success status (0 for failure, 1 for success).
Examples
Read the state of digital pin 5
pk_digital(5);
Set digital pin 3 to HIGH
pk_digital(3, 1);
Set digital pin 8 to LOW
pk_digital(8, 0);
See also