Counter to 480

Hello,

I would like to have a counter up to 480, and every 10 counts 1 LED On.
At the end 48 LED's should be On.

Who can help me?
mikafi

Three questions.
What board do you have? What code have to written so far? How do/did you wire the 48 LEDs?

Added: If you have an Arduino Mega/Due, it can be done very easily with no extra hardware... Except for the RTC, that you will need.

Check out the % (mod) operator.

If you use count%10 you will get a zero when the count is divisible by 10. so use:

if ((count % 10) == 0)
{ //turn on another light }

Why 480? Why not just do 1 to 10? Anyways, you can make a for loop from 1 to 480, increase by one, take modulo (% 10) and whenever that hits 0, you increase another integer by 1 that decides which led should be turned on now. Or you could do without the expensive modulo, increase by ten each round, or whatever. However, efficient design kinda requires knowledge on how did you wire the LED's and what makes you insist on counting up to 480. Maybe you have shift register or a few, and in that case I would do a little bit of bit math to light the leds.

I would do something like this:

 const int MAX_LOOPS = 480;
  int LED_check=0;
  for(int i=0;i<MAX_LOOPS;i++)
  {
   
   if( (i%10) == 0)
   {
   Serial.println("TURN LED ON");
   LED_check++; //0-9 to turn on each LED
   }
  }

OK, I situate the problem a little bit more.
I have 2 bicycles on rollers.
Each bicycle has a contact that gives a pulse every round of the wheel.
I want a display, and why not on a tv-screen, that gives the distance of each bicycle. after 480 pulses ( = 1000m) the distance is reached, and the winner is known.
So it would be beautifull to let the evolution (competition between the 2 bicycles) be displayed on a screen. Now it is mechanical with 2
I have not a lot of knowledge of the arduino, I used it once (arduino Uno) for counting.
So I start with nothing, I have yet no arduino, no program, and not an idea, how to do this.
I have just 2 bicycles on rollers, with mechanical - analog display.

I am sorry

mikafi

Have you got a way of outputting a signal every time the wheel rotates ?
Without that you can do nothing more towards this project.

Yes, it will be done by a (detection)sensor that gives a pulse every wheel rotation.
The pulse can be whatever is needed - 5V - 12V - 24 V

mikafi

Next step. Get an Arduino. Learn to read the sensor output so that you can count the revolutions of the wheel.