I'm trying to generate a series of pulses and during a window of approximately 2mSec. average the ADC. I'm new to both C programming and mbed. The segment of code goes as follows:
d_window =1;
t.start();
while(t.read() <= t5)
{
avg = avg + ain;
++count;
}
avg= avg / count;
signal = avg;
t.stop();
What happens when I run the code is the while loop is bypassed. I assumed t.read() was larger than t5, so I try many values of t5. I also tryed t.read_us() with no luck. The examples for the timer looks simple enough, but they use a 'printf' command that I'm not using properly (?).
Any help would be appreciated.
Dan Janssen
I'm trying to generate a series of pulses and during a window of approximately 2mSec. average the ADC. I'm new to both C programming and mbed. The segment of code goes as follows:
d_window =1; t.start(); while(t.read() <= t5) { avg = avg + ain; ++count; } avg= avg / count; signal = avg; t.stop();
What happens when I run the code is the while loop is bypassed. I assumed t.read() was larger than t5, so I try many values of t5. I also tryed t.read_us() with no luck. The examples for the timer looks simple enough, but they use a 'printf' command that I'm not using properly (?). Any help would be appreciated.
Dan Janssen