Hello,
I need help making the code for scoreboard that is going on an air hockey table (school project). I am new to the Arduino and have no experience creating code. What I have is 4 7-segmented displays (will have parts no. of each part below)and I need 2 displays to display one score and the other 2 displays to display a different score. In air hockey regulations the first one to 7 wins, I just need these displays to go to 7. Once one set of displays reach 7 can reset to 0. These displays are being controlled by SparkFun Arduino Redboard. I also using Adafruit IR sensors to control what score to display. I have use SparkFun’s Large Digit Drive Hookup Guide to get me to at least to display numbers. Link: https://learn.sparkfun.com/tutorials/la … arge-digit
Parts I have:
4- 7-segmented displays- Part NO.: COM-08530 (From SparkFun Website)
4-Large digit driver-Part NO.: WIG-13279 (From SparkFun Website)
1-SparkFun Redboard-Part NO.: DEV-13975 (From SparkFun Website)
2- Adafruit 3mm IR Break Beam Sensors-Part NO.: 2167 (From Adafruit Website)
Any help with setting up the code would be greatly appreciated!
Start by thinking about how the code should work. When it comes to physical computing, think about the physical inputs. i.e. When a thing happens, what should happen as a result.
e.g. When sensor A detects a score, increment display A by one. If, the new number is 7, reset all displays to zero.
If you can put everything into a flow chart, you’ll have a good place to start.
In the interim, check out the examples for you parts. Figure out how to display the numbers you want on your displays and how to use the beam sensors.
That is some great advice, millercommamike!
To expand a bit on what you can look at code-wise, I would recommend trying to integrate a [ state-change counter for the I/O pin you are using for the signal from the IR beam kit to then increment the number on the 7-segment displays. It should not be terribly difficult to include that state-change code with our [Two Digit Example with some trial and error.
The tricky part will be if you want to use a single RedBoard for the entire circuit. That may not be possible if your sketch is too large for the memory on the ATMega328. You may want to look at using a more powerful Arduino like a Mega. Integrating two RedBoards on a single power supply would be another option to keep your code simpler since you can just duplicate the code for one scoreboard to run on the other scoreboard.
I hope this helps you get started with that code and gives some advice on how to build your circuit.](Large Digit Driver Hookup Guide - SparkFun Learn)](https://www.arduino.cc/en/Tutorial/StateChangeDetection)