arduino FHT

you need to switch between the various ADC inputs in the loop(). also, you should turn off all DIDR0 that you will be using. if you are sampling 3 ADCs, you can either interleave them, which gives you 1/3rd the sample rate, or you can do them sequentially, which gives you the full sample rate. the example below shows the latter. the advantage to doing it this way, is that you dont run out of memory.

#define LOG_OUT 1 // use the log output function
#define FHT_N 256 // set to 256 point fht

#include <FHT.h> // include the library

void setup() {
  Serial.begin(115200); // use the serial port
  TIMSK0 = 0; // turn off timer0 for lower jitter
  ADCSRA = 0xe5; // set the adc to free running mode
  ADMUX = 0x40; // use adc0
  DIDR0 = 0x07; // turn off the digital input for adc0,1,2
}

void loop() {
  for (byte n = 0; n < 3; n++) { // go through the first 3 ADCs
    ADMUX = 0x40 | n; // set mux to the current ADC
    cli();  // UDRE interrupt slows this way down on arduino1.0 
    for (int i = 0 ; i < FHT_N ; i++) { // save 256 samples
      while(!(ADCSRA & 0x10)); // wait for adc to be ready
      ADCSRA = 0xf5; // restart adc
      byte m = ADCL; // fetch adc data
      byte j = ADCH;
      int k = (j << 8) | m; // form into an int
      k -= 0x0200; // form into a signed int
      k <<= 6; // form into a 16b signed int
      fht_input[i] = k; // put real data into bins
    }
    fht_window(); // window the data for better frequency response
    fht_reorder(); // reorder the data before doing the fht
    fht_run(); // process the data in the fht
    fht_mag_log(); // take the output of the fht
    sei();
    Serial.write(255); // send a start byte
    Serial.write(fht_log_out, FHT_N/2); // send out the data
  }
}