fft_lin_out' referenced in section
.text.startup' of /var/folders/r_/cq1rth1s67g0vdc4p_n2th3h0000gn/T//ccOew28r.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/r_/cq1rth1s67g0vdc4p_n2th3h0000gn/T/build4f8279ca2bbd19c8b56e907dc6fe0cec.tmp/sketch/Photodiode_FFT_V6.ino.ino.cpp.o (symbol from plugin)
It pretty much is saying the variables listed are in a discarded section of the .text section of the program I'm running. Have any of you run into this? This popped up yesterday after the update and now none of my code will compile.
Im using the FFT Library from http://wiki.openmusiclabs.com/wiki/ArduinoFFT to processes a signal generated from light falling on a photodiode array. The original project can be found here: Arduino Playground - TSL1402R.
and this is the code I'm using in my program. Thank You!!
// Parallel read of the linear sensor array TSL1402R (= the sensor with 256 photodiodes)
//-------------------------------------------------------------------------------------
// Define various ADC prescaler:
const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
byte CLKpin = 4; // <-- Arduino pin delivering the clock pulses to pin 3 (CLK) of the TSL1402R
byte SIpin = 5; // <-- Arduino pin delivering the SI (serial-input) pulse to pin 2 of the TSL1402R
byte AOpin0 = 0; // <-- Arduino pin connected to pin 4 (analog output 1)of the TSL1402R
byte AOpin1 = 1; // <-- Arduino pin connected to pin 8 (analog output 2)of the TSL1402R
float maxindex; //integer storing the index at which we register the maxima of the fft
float maxvalue; // float variable that allows us to compare the values of the maxima making sure we get the maxima we are intersted in
float kmax; //float variable that calculates the magnitude of the fft at each index
// do #defines BEFORE #includes
#define LIN_OUT 1 // use the lin output function
#define FFT_N 256 //sets the FFT to 256 points
#include <FFT.h>; //includes the FFT library allowing for the functions to be carried out
#include <math.h>;
void setup()
{
// Initialize two Arduino pins as digital output:
pinMode(CLKpin, OUTPUT);
pinMode(SIpin, OUTPUT);
// To set up the ADC, first remove bits set by Arduino library, then choose
// a prescaler: PS_16, PS_32, PS_64 or PS_128:
ADCSRA &= ~PS_128;
ADCSRA |= PS_32; // <-- Using PS_32 makes a single ADC conversion take ~30 us
// Next, assert default setting:
analogReference(DEFAULT);
// Set all IO pins low:
for( int i=0; i< 14; i++ )
{
digitalWrite(i, LOW);
}
// Clock out any existing SI pulse through the ccd register:
for(int i=0;i< 260;i++)
{
ClockPulse();
}
// Create a new SI pulse and clock out that same SI pulse through the sensor register:
digitalWrite(SIpin, HIGH);
ClockPulse();
digitalWrite(SIpin, LOW);
for(int i=0;i< 260;i++)
{
ClockPulse();
}
Serial.begin(9600);
// Stop the ongoing integration of light quanta from each photodiode by clocking in a SI pulse
// into the sensors register:
digitalWrite(SIpin, HIGH);
ClockPulse();
digitalWrite(SIpin, LOW);
// Next, read all 256 pixels in parallell. Store the result in the array. Each clock pulse
// causes a new pixel to expose its value on the two outputs:
for(int i=0; i < 128; i++)
{
delayMicroseconds(20);// <-- We add a delay to stabilize the AO output from the sensor
fft_input[i] = analogRead(AOpin0);
fft_input[i+128] = analogRead(AOpin1);
ClockPulse();
}
// Next, stop the ongoing integration of light quanta from each photodiode by clocking in a
// SI pulse:
digitalWrite(SIpin, HIGH);
ClockPulse();
digitalWrite(SIpin, LOW);
// Next, send the measurement stored in the array to host computer using serial (rs-232).
// communication. This takes ~80 ms during whick time no clock pulses reaches the sensor.
// No integration is taking place during this time from the photodiodes as the integration
// begins first after the 18th clock pulse after a SI pulse is inserted:
//Serial.println(""); // <-- Send a linebreak to indicate the measurement is transmitted.
// Next, a new measuring cycle is starting once 18 clock pulses have passed. At
// that time, the photodiodes are once again active. We clock out the SI pulse through
// the 256 bit register in order to be ready to halt the ongoing measurement at our will
// (by clocking in a new SI pulse):
fft_reorder(); //reorders the fft_input array to allow the fft_run() command to be used
fft_run(); // This is the function that actually does the FFT
fft_mag_lin(); // Does the magnitude calculation sothe data can be read
maxvalue = 0;
maxindex = 0;
for (int i = 5; i < 128; i++)
{
if (fft_lin_out[i] > maxvalue) //if the magnitude is larger than the previously measured max it makes the new max that measured value and outputs the index at which it occurs
{
maxvalue = fft_lin_out[i];
maxindex = i;
}
}
}
void loop()
{
float Am; //coefficent of the real data
float Bm; //coefficent of imaginary data
float theta; //float variable that stores the value of displacement
float thetaD; //theta in degrees
float displacement; //measurement of displacement in nanometers
// Stop the ongoing integration of light quanta from each photodiode by clocking in a SI pulse
// into the sensors register:
digitalWrite(SIpin, HIGH);
ClockPulse();
digitalWrite(SIpin, LOW);
// Next, read all 256 pixels in parallell. Store the result in the array. Each clock pulse
// causes a new pixel to expose its value on the two outputs:
for(int i=0; i < 128; i++)
{
delayMicroseconds(20);// <-- We add a delay to stabilize the AO output from the sensor
fft_input[i] = analogRead(AOpin0);
fft_input[i+128] = analogRead(AOpin1);
ClockPulse();
}
// Next, stop the ongoing integration of light quanta from each photodiode by clocking in a
// SI pulse:
digitalWrite(SIpin, HIGH);
ClockPulse();
digitalWrite(SIpin, LOW);
// Next, send the measurement stored in the array to host computer using serial (rs-232).
// communication. This takes ~80 ms during whick time no clock pulses reaches the sensor.
// No integration is taking place during this time from the photodiodes as the integration
// begins first after the 18th clock pulse after a SI pulse is inserted
//Serial.println(""); // <-- Send a linebreak to indicate the measurement is transmitted.
// Next, a new measuring cycle is starting once 18 clock pulses have passed. At
// that time, the photodiodes are once again active. We clock out the SI pulse through
// the 256 bit register in order to be ready to halt the ongoing measurement at our will
// (by clocking in a new SI pulse):
kmax = maxvalue/256; //for debugging see if maxval/256 works
Am = 0;
Bm = 0;
for (int i = 0; i < 256; i++)
{
Am = Am + fft_input[i]*cos(kmax*i); //magnitude of real part
Bm = Bm + fft_input[i]*sin(kmax*i); //magnitude of imaginary part
}
theta = atan(Bm/Am); //faze angle measurement (rads)
thetaD = (180/(3.14159))*theta; //faze angle measurement (degrees)
displacement = ((theta*632*sqrt(2))/(4*3.14159));
Serial.println(displacement);
for(int i = 0; i < 260; i++)
{
if(i==18)
{
// Now the photodiodes goes active..
// An external trigger can be placed here
}
ClockPulse();
}
// The integration time of the current program / measurement cycle is ~3ms. If a larger time
// of integration is wanted, uncomment the next line:
// delay(15);// <-- Add 15 ms integration time
}
// This function generates an outgoing clock pulse from the Arduino digital pin 'CLKpin'. This clock
// pulse is fed into pin 3 of the linear sensor:
void ClockPulse()
{
delayMicroseconds(1);
digitalWrite(CLKpin, HIGH);
digitalWrite(CLKpin, LOW);
}