Using ADC free-run mode?

Hello everyone , I'm new to the whole free-run mode concept and have hit a problem.

I'm trying to take a periodic analogic signal with a frequency of 100Hz from the pin A0, and i need many measures for my signal so my Arduino UNO must work in a free-run mode.

1/First,How May integrate this mode in my program ?
2/Second, How may I print the value mesured in the serial monitor at the same time ?


You can read about it in the processor datasheet. You generally don't get a lot of choice in how fast the free-running mode generates samples. The clock dividers available are 2,4,8,16,32,64, and 128. If the clock is faster than 200 kHz you can't get full resolution (10 bits) so on a 16 MHz processor you need a prescale of at least 80 to get full resolution so your only choice is a prescale of 128 or 125 kHz. Each conversion takes 13 cycles so that gives you about 9.6 kHz . There are no higher prescale values so you can't make the free-running mode any slower. If you only want 100 Hz I would have the free-running interrupt calculate a 10-sample average and then use a timer to grab the average 100 times a second.

You can sample 10-bit resolution at 300Hz or 400Hz without need to use free run mode.

void setup(){
timeBefore = micros();

void loop(){
timeNow = micros();
elapsedTime = timeNow -timeBefore;
if ( elapsedTime >= 2500){ // 400 Hz sample rate
   timeBefore = timeNow + 2500;  // set next sample time

I leave the variable declaration up to you. All time related elements should be unsigned long.

Thanks Sir @johnwasser and @CrossRoads
I am a Begginer with Arduino so could you explain for me more ?
If we use 400 Hz sample rate it will take just 8 samples in T=0,02s(50Hz) but i need more samples (200 samples or more) so ther is a way to do it without Free-Run Mode ?

This should get you 100 Hz without using free-running mode which can't run that slow.

const unsigned long SampleIntervalMicros = 1000000UL / 100;  // 100 Hz
unsigned long LastSampleTimeMicros;
const byte InputPin = A0;

void setup()
  LastSampleTimeMicros = micros();

void loop()
  if (micros() - LastSampleTimeMicros >= SampleIntervalMicros)
    int sample = analogRead(InputPin);
    LastSampleTimeMicros += SampleIntervalMicros;  // Start of next sample interval