Counting 7-Segment with RF Reciever and Key Fob

Hello all! I've been searching around for help as to how to continue my project and figured I might as well ask here.

Basically what I'm doing is using an Arduino MEGA to operate 2 7-Segment LED Displays, a 4-button Key Fob, and a 4-Output RF Receiver (1 pin for each button). The key fob is a Momentary type.

I've attached the code I've written so far for reference because its too long to put into a post.

What I'm looking for help/advice for is what the most efficient way you guys think is to operate the RF Receiver to count up or down on the 7-segments. Right now I'm using Switch / Case statements and thought I would have 1 button on the key fob increment the variable for the Switch and another key decrement the variable.

Should the Switch / Case be outside the loop and only have the RF Receiver inside?

Would a delay be helpful to prevent several inc/dec as the button is pushed?

Any help you guys can provide is greatly appreciated! :slight_smile:

Double_7-SegmentOpposite_With_RF_Reciever.ino (21 KB)

Would a delay be helpful to prevent several inc/dec as the button is pushed?

Look into the state change detection example in the IDE examples (File, Examples, Digital). That will let you detect when the button BECOMES pressed or released (as opposed to IS pressed or released). There are also examples explaining non-blocking debounce. Using delay stops the execution of the program and make the program run slower (not good).