I don't understand how it works internally to do it correctly.
For example:
- sensor max sampling rate is 1700Hz
- analogRead reads at 10.000Hz
- Serial output at 9600Hz but I might need 1000 reads per second
How to connect all that and use full performance of the sensor?
How do I sample sensor at 1700Hz when I would get same value for 10000/1700=5.88 sequential analogReads?
If I do analogRead of the sensor 1000 times in a loop I would get 170 (1000/5.88) unique readings and can average that to output after 2ms delay to get desired 1000 reads per second?
Loop
{
1000x analogRead and get Sum
Average=Sum/1000
delay 2ms
output Average to serial
}
Is that how you would do it? I am really struggling to understand the logic of this so any help is most welcome!