Hey Guys! I am fairly new to Arduino so please bear with me I am using an Arduino MEGA 2560 to implement automated bottle rejection system. The summary of the system is this: Its got four checks for rejection, a variable speed conveyor belt (hence an encoder) and the distance between check point and rejection point is 20 revs. Here is how I planned to implement it and please mind for now i just need to show my algo on hardware and not on the real system:
1) Four hardware debounced push buttons for the four checks
2) Using interrupt routine for each check to increment the corresponding check counter and add current timerCounter value +20 to stack
3) Use stacks to implement desired FIFO logic
Now here is where I am stuck:
i. For some reasons I can only use just two interrupts at a time.. It must be some rookie mistake on my part.. i am using attachInterrupt() and pin mapping is correct as far as I know
ii. I am confused on how to implement stacks
Please I really need urgent help with this project.. Looking forward to hearing from the amazing programmers out there