output calculation?
Moderator: Benj
-
brandonb
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
output calculation?
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
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: output calculation?
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
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
Martin
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: output calculation?
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
Cheers,
Jonny