So I am working on a project right now invloving waiting for input from some buttons. I have this function input, and I want to have a state machine for polling and waiting for someone to lift up from the button. I created some global variables for those states but I get an error.
A couple things to consider: This is a pretty big program -- I have 4 tabs. Im not sure if global variables need to go anywhere specific or if they just need to be outside of any function. I am using const int rather than #define because const int seems to be more versatile and safe.
Heres the code I am working with:
//////////////// input states\\\\\\\\\\\\\\\\\
const int POLL = 0;
const int PRESSED = 1;
const int MULTIPRESSED = 2;
const int LIFTED = 3;
const int CANCELED = 4;
//\\\\\\\\\\\\\\\\\\\\\/////////////////////////
int input(){
// This function waits for an input and returns the executed button
// returns:
// 0 = thumb
// 1 = pointer
// 2 = middle
// 3 = ring
// 4 = pink
int inputstate = POLL;
int buttons[5];
int button;
int pressed;
while(1)
{
// read buttons and switch(inputstate) etc
}
}
This is just the code from one of the tabs. I have other tabs and in my loop() this function, input() gets called. When I verify this program i get the error: 'POLL' was not declared in this scope, highlighting the line "int inputstate = POLL;"
Any ideas why this is and what I might do to fix it?
Thanks
Chet