Idependant flash rates needed

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Timo
Posts: 7
Joined: Tue Nov 06, 2007 8:42 pm
Location: Northumberland
Contact:

Idependant flash rates needed

Post by Timo »

I've been trying without success to create a program that allows Idependant LED flash rates to be controlled by two independant ADC inputs (ADC0 & ADC1).
The stumbling block seems to be associated with the neccesity of using the ADC values as variables to control the respective delays for the two different flash rates. They interact adversley with one another (one delay delays the other?)
Can you suggest a way to overcome this and produce truly independant flash rates?
Regards,
Tim

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: Idependant flash rates needed

Post by medelec35 »

Have a read of this post, it will explain why ADC0 and ADC1 don't appear to be independent.

http://www.matrixmultimedia.com/mmforum ... 202#p11270

All you need to do is sample ADC0, read ADC0, assign variable 1 to ADC0
then sample ADC1, read ADC1, assign variable 2 to ADC1.
Martin

Timo
Posts: 7
Joined: Tue Nov 06, 2007 8:42 pm
Location: Northumberland
Contact:

Re: Idependant flash rates needed

Post by Timo »

Thank you for that thought but I did comply with this requirement to sample then read each ADC input in the correct sequence.
I have used the variables representing the resultant values to generate the delays necessary for the two different flash rates and this is where it all appears to fall apart. The execution of the first delay seems to be delaying or interfeering with the second delay, niether being independant from each other as is needed.
Regards,
Tim

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: Idependant flash rates needed

Post by chevy6600 »

Hi timo, this might sound a bit obvious but maybe you missed this. As the program only does one instruction at a time, and you are using your adc to cause a delay....a delay as in halting the program in it`s tracks....the rest of the program will also be delayed until the delay ends which then allows the continuation of the program code, the rest of this program code containing the other adc, hence the reason for the delay affecting both adc inputs. If this is how you have written your program, you need to redo your program to keep the program loop moving, to enable the second adc input to be tripped. If you cannot accomplish a work around maybe you need to use a more complex method such as the `interrupt` mechanism?.

Post Reply