The Function "noInterrupts()" doesn't exist but attachInterrpts works! Using processing 3.2.1 on Pi3

edited September 2016 in Raspberry PI

I am using processing 3.2.1 on Raspberry Pi3. I have imported the library : "import processing.io.*"

and my program properly works to run the function GPIO.attachInterrupt(2, this, "DocState", GPIO.RISING); in setup method. now within callBack function : DocState if I am using the "noInterrupts();" and "interrupts()" it is showing the error that function doesn't exist.

I have no idea why this is happening as Library is included and one of the function is running. I updated processing and restarted R-Pi3 but unable to get through it!

Answers

  • edited September 2016 Answer ✓

    Got resolved.....

    The processing example in the link has used set of instructions like : "interrupts()" and "noInterrupts()" which I was running by copying from examples it was showing errors which says the function "noInterrupts()" doesn't exist while i was successfully using attachInterrupt(). As the example didn't work I had long time checking library files and all. But still couldn't find solution.

    It worked perfectly when I added "GPIO." prefix and instructions were like "GPIO.interrupts()" and "GPIO.noInterrupts()".

    This needs to be somehow updated in example source codes.

  • https://github.com/processing/processing/blob/570d441fb22165a554129b715bf04135c41b5b1d/java/libraries/io/src/processing/io/GPIO.java#L323

    it's in the source as

    public static void noInterrupts() {
    

    the static means it'll need calling using the classname (as you have) GPIO.noInterrupts();

    alternatively you can add static to the import and you'll then be able to just use noInterrupts(). but i prefer the method you've used as it's more explicit.

  • Answer ✓

    Thanks @Bhargav, good catch. I'll update the example.

Sign In or Register to comment.