Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hi,
Strange issue: got some code working. Placed it in a function. In the main loop i've placed a interrupt to call upon that code. But somehow it will immediatly go to the function.
#include "mbed.h" #include "SCP1000.h" # define SAMPLENRS 7000 # define SAMPLES_SEC 161364 # define SAMPLERATE 9600 Serial pc(USBTX, USBRX); SCP1000 scp1000(p5,p6,p7,p8); Serial lcd (p28, p27); InterruptIn Potmeter(p5); DigitalOut led(LED1); void clear(void); void Measure(void); unsigned int samples[SAMPLENRS]; unsigned int average; unsigned int sum; Timer t; int main() { Potmeter.rise(&Measure); //if P5 high, then measure while (1) { led = !led; wait(0.25); pc.printf("say something"); } } void Measure() { // here are we measuring values coming in from de ADC }I can't see what im doing wrong. if i remove the line of code with the interrupt i see the LED blinking, and i got text through realterm.
What am i doing wrong ?
marcel