Page 1 of 1
output calculation?
Posted: Wed Oct 12, 2011 5:11 am
by brandonb
an adc takes 0 to 5v and breaks it down into 0-255,.... is there anyway to use calculation box to do the same byte breakdown for an output, say if i want 255 different pulsewidths between 1m/s and 100m/s and i dont want to write output delays and counts for each one? reason why i ask is my friend has an audino and he claims he can do this with a couple lines of c code, he says that he has 2 pots, one that sweeps frequency and one that sweeps dutycycle with only 20 lines of code... im not a programmer but i dont see how thats possible
Re: output calculation?
Posted: Wed Oct 12, 2011 7:19 am
by medelec35
Hi brandon,
What you have just described, is using Arduino in PWM mode.
The difference between Arduino and Flowcode is Arduino would use its own C ( I believe) and Flowcode uses Icons that you drag,forming a flowchart ( and of course C or ASM if required).
Could your friends Arduino have a delay that went up to 100ms as that sounds far too low for PWM on duration.
For instance using 4MHz osc, the maximum period is just over 4ms
Martin
Re: output calculation?
Posted: Wed Oct 12, 2011 10:45 am
by JonnyW
Hello. Out of sheer morbid curiosity could you post the code that this is done in please? Im interested to know if this is pure code or this is 'a couple of lines of C code that actually call a large and complex function'. If its pure code, its possible for any C-type compiler that supports that hardware, which may include Flowcode.
Cheers,
Jonny