I think the first part should be something like this:
- Code:
int tempkey=0;
zerolastkey(); //configure buttons
print("-Tap key for up",10,140,blue);
update();
while(!(tempkey = lastkey()))
{update();}
setCscan( tempkey );
print("-Tap key for down",10,160,blue);
update();
while(!(tempkey = lastkey()))
{update();}
setDscan( tempkey );
In case the changes aren't immediately obvious, what I changed is to replace the "while(!pressed())"s with "while(!(tempkey = lastkey()))"s. Basically, you can use lastkey as a check for button presses. I believe that if you use lastkey() it will erase the stored value (I think... I don't have the docs (or the source) handy), thus necessitating the tempkey variable. I believe (once again, I haven't been able to test it yet) that the setXscan functions use the last key pressed if the value is zero, and waits if that is also zero.
I hope this isn't too confusing. I'll check when I get home to see if it works.