Controlling with a pot the speed of flash patterns

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Frank607
Posts: 192
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times
Contact:

Controlling with a pot the speed of flash patterns

Post by Frank607 »

I have a simple PIC12F629 and programmed in Flowcode seven LED flash patterns. With a button you activate the next pattern.

Now I want to use a potentiometer to adjust the flash speed (delays) of the flash patterns. I can imagine that this is not so easy to do because my flash pattern have a standard delay (50ms) in the flowchart.

Somewhere in this forum I found a year ago a flowchart what seems to do this, but I can’t find it anymore.

Anyone who can help me?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Controlling with a pot the speed of flash patterns

Post by medelec35 »

Hi Frank,
This thread may help

Martin
Martin

Frank607
Posts: 192
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times
Contact:

Re: Controlling with a pot the speed of flash patterns

Post by Frank607 »

Hi Martin,

Thanks for the link to the topic. I have got my flowchart working with a potentiometer according
to your post.

But one thing I don’t understand very well and that is the calculation:

Code: Select all

Note the calculation
CODE: SELECT ALL
Delay = Delay * 16 / 10 + 100
The value is now 100ms to 500ms. How can I have 50ms >450ms ?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Controlling with a pot the speed of flash patterns

Post by medelec35 »

Hi Frank,
Frank607 wrote:The value is now 100ms to 500ms.
That's because of:
medelec35 wrote: Note the calculation

Code: Select all

Delay = Delay * 16 / 10 + 100 
use within the flowchart I posted just takes the digital value derived by ADC (0 to 255) and converts it in to a value suitable for a milliseconds delay (about 100 to just over 500)
Frank607 wrote:How can I have 50ms >450ms ?
You can try:

Code: Select all

Delay = Delay * 39 / 25 + 50
It should be very near is using ReadAsByte.
Probably 50 to 447ms?
Is that accurate enough?
Martin

Post Reply