Author Options:

Help with Arduino programming for LED display Answered

What I want to do is keep score with my coin soccer game. I will have 2 metal contacts in the goals that when a coin goes through it will break contact and send a signal to the Arduino having the contacts allways HIGH and then when its LOW, it changes an 7 segment LED. I am very new to programming and the C language. I think I can write the whole IF and ELSE statements but I don't know how to make the LED display change. I need the LED display to change after getting the signal from my Arduino by going up one number. It is a single 7 segment display. Can someone help me with the code for that? Thanks in advance.


The Skinnerz
The Skinnerz

9 years ago

If the number being displayed does not need to go above 20 or so, a look up table is probably the simplest solution. With this, the microcontroller has a list of which pins to put high for each value. However, if the numbers start to get big, it is more efficient to add a small section of code to seperate the value into individual decimal values, which can then be converted into 7 segment individually. I only know very basic C, but can help if your compiler accepts sections in ASM.