Button input

#include <dkey.h>
#include <dbutton.h>

Think of your RCX as a computer with a 4-key keyboard. You are also only allowed access to two of the keys, because brickOS reserves use of the other two for itself. With that said, there are only a few things we can think of that you could and would want to do with the keys, so here they are.

#define KEY_ONOFF 0x01		//!< the on/off key is pressed
#define KEY_RUN   0x02		//!< the run key is pressed
#define KEY_VIEW  0x04		//!< the view key is pressed
#define KEY_PRGM  0x08		//!< the program key is pressed

#define KEY_ANY   0x0f		//!< any of the keys

char getchar ( );
returns: one of the following KEY types: KEY_ONOFF, KEY_PRGRM, KEY_RUN, KEY_VIEW
the input keys are debounced in this routine

wakeup_t dkey_pressed ( wakeup_t data );
returns when a key is pressed

wakeup_t dkey_released ( wakeup_t data );
returns when a key is released