Can ADC input be used to adjust an output timing cycle


Need some help… I am working on a project that will use an input from a potentiometer to adjust/change the timing cycle for an output. i.e., push a button (input) to activate timing, output (1 to 60) seconds duration depending on the feedback/ position from the potentiometer.


Senior Member
Back in 2014 you asked a very similar question, and now the answer is still basically the same.

Read the ADC, multiply or divide it to get the right range, use it to control the length of a PAUSE.


Senior Member
10K pot. across the power supply rails, with the wiper connected to an ADC pin. The voltage will therefore vary between 0V and the +ve Rail. By default, READADC10 will give a result between 0 and 1023, depending on this voltage.

In this example for the 08M2, using C1. as the input pin, the first 1/3 of the pot travel gives a delay of 2sec, middle 1/3 gives 4secs, final 1/3 gives 6 secs.

Rich (BB code):
#picaxe 08m2
#terminal 4800

symbol ADCvalue = W13
symbol ADCPin = C.1

            W0 = ADCvalue                 ;remember last reading
            readadc10 ADCpin,ADCvalue     ;read voltage at pot wiper (gives an answer of 0-1023)
            sertxd (cr,lf,"ADCvalue",#ADCvalue) ; debug
            pause 100                     ;may want to allow time for pot. to be moved
      loop while ADCvalue <> W0           ;loop around until the value settles (ie pot stops moving)

      sertxd(" - Pot. stable")
      ; Take action based on voltage read from pot.
      select case ADCvalue
            case 0 to 340
            sertxd (" Pause 2secs") : pause 2000
            case 341 to 680
            sertxd (" Pause 4secs") : pause 4000
            case 681 to 1023
            sertxd (" Pause 6secs") : pause 6000
      end select        


Senior Member
That is a very odd thing to remember :LOL:
I didn't remember, I looked at Dave's previous posts !

Looking at previous posts gives a good indication of an OP's level of familiarity with Picaxe, and the post I linked to showed a very similar question had been answered.
Last edited:


Buzby is correct, I should have not done the "knee jerk reaction" for this question..Thank you Phil for jumping in and submitting a code!


Technical Support
Staff member
I must admit I can forget what I have asked years ago, don't think I have so don't bother searching,, or don't find the actual question if I do. I am always grateful when some kind soul points out it's 'the same as it ever was' and points me to the path I had previously walked.