Society of Robots - Robot Forum
Software => Software => Topic started by: bakil on July 25, 2007, 10:47:11 AM
-
hy today my question is that one of u guys can make a small c program that uses a little button and when you press the button i want a integer lets say a to be increased by one
like
main()
{
int a = 0;
if (button pushed)
{
a++;
}
}
hope u understand my question
thks in advance ;D
-
Im guessing that this is for a microcontroller? Which microcontroller? What compiler are you using?
-
atmega16l
programmed with stk500 board
avr studio with the C plugin (avr gcc)
-
i use a stk500 board (programmer and has LEDs and switches for testing)
avr studio and avr gcc
so how would u guys program somethin so that when u push a switch that an integer increments with one
-
Make sure to put a small capacitor across both connections of your button for debouncing.
Then do something like:
if(button_pin = 1)
counter=counter+1;