Hi, i am using a stellaris launchpad micro controller and i want to poll one of my switch's for a press. I have configured all the necessary ports and everything but i cant get it to work. I know that all of my ports are configured correctly.
I created a function called wait_for_key that polls the switch for a press. The wait_for_key function is called from int main from inside a while loop.
I know that the micro processor and while loop run faster than i can press the key. So im am asking if anyone has any suggestions on how to "catch' the key press.
If tried delays, but that doesn't seem to work. Also i have to use the while loop in int main.
void wait_for_key (void) { while (GPIO_PORTF_DATA & 0x10); // wait for SW1 press, poll low } int main(void){ while(1) { wait_for_key(); } }
thanks Steve