waitForPin

suspend fun waitForPin(pin: Byte, value: Byte, millis: Short)

Waits for a given pin to reach a particular value before continuing execution.

This is useful for waiting until a GPIO device is in a particular state before trying to send it more commands.

eg. Waiting until the BUSY pin is set to 0, indicating that the GPIO device has finished whatever it was doing, before trying to make it do something else.

Parameters

pin

Pin to wait on

value

Value to wait for the pin to reach

millis

Milliseconds to wait between pin reads