Timer with leds and potentiometers

PaulS:
But, they are not. A0, A1, etc. are aliases defined for use when using the analog pins as digital pins. I do not like seeing people use A0 in an analogRead() statement. The potentiometer is connected to analog pin 0, not digital pin 14.

OK - I guess I disagree but I see where you are coming from.

analogRead() does provide that level of service for the end user and I feel it's by design and brings code clarity.

if you look at the code it does support "digital pin 14" being re-numbered as analog pin 0 automatically so that all is working smoothly. So this is totally intentional and designed to be used that way.

I do find value in the fact that for starters you have analog pins on one hand and digital pins on the other - even if this is a partial view of the world, and as you grow skills, then you get to understand all this better.

extract from int analogRead(uint8_t pin)

#if defined(analogPinToChannel)
#if defined(__AVR_ATmega32U4__)
	if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#endif
	pin = analogPinToChannel(pin);
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
	if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega32U4__)
	if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
	if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
	if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif

Thank you J-M-L and Paul I was successful with J-M-L code,little to change and all is working what I want ....
See you ! :wink:
If somebody needs the code send me PM.