delay

suspend fun delay(millis: Short)

Tells the Pico server to wait for a defined amount of time before moving onto the next request.

This is useful when sending through multiple commands in a single packet.

For example, let's say your GPIO device requires you to wait for 10ms after setting a pin before writing SPI data.

One way of doing this would be for your client application to send a SET_PIN command, wait 10ms, then send a WRITE_BYTES command.

Another way of doing this would be to send a SET_PIN command, a DELAY command, and a WRITE_BYTES command all in one packet.

The second approach sends 3 commands instead of 2, but it does so in 1 packet instead of 2, making it faster overall due to network latency and packet size constraints.

Parameters

millis

Time to wait in milliseconds