Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5471

SDK • Re: getchar_timeout_ms() can not get the correct character

$
0
0
The documentation is quite clear....
https://cec-code-lab.aps.edu/robotics/r ... 566bc868e8

int getchar_timeout_us ( uint32_t timeout_us)

Return a character from stdin if there is one available within a timeout.

Parameters
timeout_usthe timeout in microseconds, or 0 to not wait for a character if none available.

Returns
the character from 0-255 or PICO_ERROR_TIMEOUT if timeout occurs


PeterO
Thank you for the reply!
But I still don't understand how, I do press a key (like 'd', or 'p') then this function will be called, how can it return -1 for none available?
This function is called every time when I press a key, so how can I catch the key been pressed by this function?

Statistics: Posted by crisps — Fri Feb 23, 2024 1:34 pm



Viewing all articles
Browse latest Browse all 5471

Trending Articles