8 years, 2 months ago.

sampling analogin and storing in an array

I am having trouble writing my code and need some help. The object of my code is to sample an analog input every 1 sec and then store the samples in to an array that is 1024 samples long. I think I have figured out how to sample and store, but can't figure out how to do it every second.

Any advice on how to sample it every second?

What did you do to store the samples in the array? I have the same issue, but with a temperature sensor and 1000 samples.

posted by Megan Crawford 13 Mar 2018

1 Answer

8 years, 2 months ago.

You can of course use a wait in a loop, but better way is using a Ticker: http://mbed.org/handbook/Ticker