Keyin simple

From CSWiki
Jump to: navigation, search
Hid hi;
HidMsg msg;

0 => int deviceNum;
hi.openKeyboard( deviceNum ) => int deviceAvailable;
if ( deviceAvailable == 0 ) me.exit();
<<< "keyboard '", hi.name(), "' ready" >>>;

while( true )
{
       
    hi => now;
    
    while( hi.recv( msg ) )
    {
        if( msg.isButtonDown() )
        {
            <<< "down:", msg.which >>>;
        }
        
        else
        {
            <<< "up:", msg.which >>>;
        }
    }
    
}