| Main > Project Announcements |
| DIY Skeeball |
| << < (19/28) > >> |
| Chris:
--- Quote from: Ixliam on January 18, 2005, 01:06:37 pm ---BTW, are there any free C/C++ compilers for DOS ? --- End quote --- DJGPP. |
| Chris:
--- Quote from: RayB on January 18, 2005, 04:12:37 pm --- --- Quote from: Chris on January 18, 2005, 10:46:38 am ---Write a debounce into the code... once a switch registers, ignore it for the next 3 seconds or so. --- End quote --- The proper way to handle this is to wait for the switch to turn off. Right now, he's treating the button as a Flag rather than a toggle. His code sees the Flag is "true" and proceeds to award another score again. The code should be waiting for the Flag to clear (false) before going back to waiting for "true". --- End quote --- Unless the switch is indeed bouncing. Ignoring inputs for a couple of seconds will solve both problems. |
| RayB:
--- Quote from: Chris on January 18, 2005, 04:17:38 pm ---Unless the switch is indeed bouncing. --- End quote --- |
| Ixliam:
Its not bouncing, its that the ball takes a bit to go down, so it is holding down the button for longer than it needs to be, same thing if you held it down on the keyboard. I saw online someone had posted about clearing the keyboard buffer out before going further, so mine would look something like.. if(kbhit){ ch=getch(); while(getch() != ch) switch(ch) case 'a': printf("10 point ring.").....etc etc. Gonna try that to get it to prevent extended runs, and thanks for the pointer on the gnuc++ style C compiler. Brad |
| Chris:
--- Quote from: Ixliam on January 18, 2005, 05:03:25 pm ---Its not bouncing, its that the ball takes a bit to go down, so it is holding down the button for longer than it needs to be, same thing if you held it down on the keyboard. --- End quote --- RayB 1, Chris 0. ;D |
| Navigation |
| Message Index |
| Next page |
| Previous page |