11 years, 4 months ago.

Problem with new revision of InterruptIn

Hello, an old program which use QEI library and works with old revision of MBED libraries crashes with new revision (probably since revision 44 of MBED libraries) due to an InterruptIn error... Thanks you for your help.

https://mbed.org/cookbook/QEI

#include "mbed.h"
#include "QEI.h"

Serial pc(USBTX, USBRX);
QEI wheel (p29, p30, NC, 624);

int main() {

    while(1){
        wait(0.1);
        pc.printf("Pulses is: %i\n", wheel.getPulses());
    }

}

2 Answers

11 years, 3 months ago.

Yes, Erik is right, we decided to trigger an error in case of initializing InterruptIn with an invalid pin like NC.

Although, I can see the point in the QEI library usage of InterruptIn, we should support NULL initializations, we corrected this behaviour of the InterruptIn constructor in Rev 50.

Cheers, Emilio

Accepted Answer
11 years, 4 months ago.

It seems that interruptIn cant handle NCs anymore. Library could be changed a bit to deal with it, but easiest solution for you is probably assigning a random pin that isnt used to where now NC is. Not a very nice solution, but since that pin doesnt affect the rest of the library it should work.

Thanks a lot Erik for your fast reply.

posted by IUT CACHAN 30 Nov 2012