Availability | All terminals |
Description | This function blocks execution until a key is pressed. |
Syntax | int WaitKey( void ); |
Arguments | None |
Returns | When a key is pressed, the function will return the pressed key (TRIGGER_KEY or CLR_KEY) |
Example |
#include <stdio.h> #include "lib.h" void main( void ) { int key = -1; for(;;) { printf("\nPress any key"); ResetKey(); key = WaitKey(); GoodReadLed((key == TRIGGER_KEY) ? GREEN : RED, 50); // ON, 1 second } } |