Hi
I don't think I am at the level to write program for micro-controller. I am doing focus on small building blocks
Switch : I am working on the function that should check the status of switch
Does it make sense ?
Updated : After post of AlbertHall
I don't think I am at the level to write program for micro-controller. I am doing focus on small building blocks
Switch : I am working on the function that should check the status of switch
Does it make sense ?
Code:
#define TRUE 1
#define Debounce 30
#define SWITCH_PRESSED 1
#define SWITCH_NOT_PRESSED 0
int CheckSwitch(void)
{
int ReturnValue = SWITCH_NOT_PRESSED;
if(Switch == TRUE)
{
DebounceDelay(Debounce);
if(Switch == TRUE)
{
ReturnValue = SWITCH_PRESSED;
}
}
return ReturnValue ;
Attachments
-
24 KB Views: 0
Last edited: