Combining different Programs

I'm new to Arduino and have run two programs. ForLoopIteration that lights six LED's one after another, and an analog read serial program that gives a number according to a pot you can turn. I'd like to combine the two and use the pot to control the speed of the led's. How do I do this? Thanks. Arduino Micro Windows 7- 64 bit

Grumpy_Mike has a guide:

http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

You have not posted your code but I am willing to bet that the LED program uses delay() to achieve the lighting of LEDs in sequence. If that is the case then you will run into problems reading the analogue input whilst the LED sequence is happening. Look at the BlinkWithoutDelay example in the IDE and Several things at the same time to see how to use millis() for timing.