I am seeking to create an algorithm that uses arduino data as it is collected. Let me elaborate; I have a micromotor that vibrates at varying amplitude, which is currently determined by potentiometer angle. However I want to eliminate the potentiometer-based amplitude control and use an amplitude-generating algorithm instead. I also have a button to be used for data collection, such that I can record which amplitude can be detected by the fingers. What i wish to do is feed the given amplitude value back into an algorithm that can adjust the amplitude and increase the accuracy of the device. How do I bin data in order to reuse it immediately? Or how else could I get around this issue? Thanks.
PS I have little experience with C, I have only used Matlab language in the past.
How do I bin data in order to reuse it immediately?
How do you read the potentiometer value, to reuse that value immediately? The process you want to use is the same.
Or how else could I get around this issue?
Hard to say, without knowing what the issue is.
I have only used Matlab language in the past.
I was going to comment, but decided not to.
a function that can generate a random amplitude between 0 and 1.
return random(0,10000) * 0.0001;
If the amplitude stream must behave differently you should adapt the inner part accordingly,
e.g. read values from an SD card, a circular array, from your analogRead(), from the inner clock % some prime
example a simple sawtooth, every call is 1/1000 more that the previous until it reaches 1.0 then it resets.
static value = 0;
value = value + 0.001;
if (value >= 1) value = 0;