led sweep

hi, i'm new in this world and I need to do a simple project but i have no idea for where begin.
what i have to do is make a sweep with 9 leds connected to a resistor of 220 ohm every one, and add 2 push button, one of them is to increase the speed of the sweep and the other for decrease the speed, both button must be connected to a resistor of 1k ohm and at 5 volts arduino.

Here the image of the graph that gave the teache.

Here the image of the graph that gave the teache.

Where?
Please read this:-
How to use this forum to find out how to post or attach images.

Next look at this code as your starting point:-

I assume this is the "Knight Rider" or "Larson Scanner" effect? You should be able to find lots of examples for that...

How far did you get? If you understand how the Blink LED example works, it shouldn't be too hard to blink/sequence a few more LEDs.

If you are required to make it sweep both directions, work on one direction first. Then when that works, add the reverse direction.

Try to get the sequence working before you mess-around with changing the speed.

Then make a variable for the delay-time so you can change the speed by simply changing one variable. Just put that in your program, don't worry about the up-down buttons 'till you can change the speed in software.

Then make a button that just increases speed, and when you get that working add the button to decrease speed.

NOTE - The processor "locks up" during delay(). That means if you use delay(), you cannot read the up/down button states during delay() and you'll have to hold down button until the end of the sequence before the button-state is read.

If you understand how the Blink Without Delay example works or how to use millis(), try using that method instead of delay() so you can read the button states at any time. If you haven't used millis() yet, it's probably OK for you to use delay(). Most real-world programs avoid delay(), or it's used very carefully and usually for very short delays.

...Bit shifting can make this "easy" (that's how I do it), but you need to understand binary and bitwise operations (and it helps to understand hexadecimal) and you have to know how to associate one bit with one LED. If you haven't learned any of that in your class yet, don't use it. :wink: