POT Controlling Pause in Blink.bas


Closed Thread
Results 1 to 2 of 2
  1. #1
    RossW's Avatar
    RossW Guest

    Question POT Controlling Pause in Blink.bas

    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

  2. #2
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    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
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts