PDA

View Full Version : POT Controlling Pause in Blink.bas



RossW
- 30th July 2004, 21:52
Hi all,

I want to write a program that takes the input of the current setting of a pot to use in calculating the pause value when blinking an LED. For example:

delay var WORD

Loop:
HIGH GPIO.0
PAUSE delay
LOW GPIO.0
GoTo Loop

I don't want to constantly read the pot value, both for performance considerations and to eliminate 'noise' that might keep adjusting the delay value.

Does anyone have an example of the above?

Cheers,
Ross

Dwayne
- 30th July 2004, 22:17
Hello Rossw,

Rossw>>Loop:
HIGH GPIO.0
PAUSE delay
LOW GPIO.0
GoTo Loop<<


Here is a untested program Psuedocode...

ADVal var byte.

Loop:
if (condition is met) ADCin Pinx, ADVal
GoSub ToggleGPIO
Do a bunch of stuff...
.........
.........
goto Loop

ToggleGPIO
HIGH GPIO.0
PAUSE ADVal
LOW GPIO.0
return

Dwayne