Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: teensy 3 and interrupt error

  1. #1

    teensy 3 and interrupt error

    i am trying to work with interrupts and tried this simple example.
    but it does not compile.
    i get this error:
    error: expected constructor, destructor, or type conversion before '(' token

    i am on osx 10.8.5 arduion IDE 1.0.5, downloaded teensy just yersterday.



    #include <avr/io.h>
    #include <avr/interrupt.h>
    volatile unsigned int overflow_count=0;
    void setup(){
    void loop(){
        /* Timer 0 overflow */
        if (overflow_count < 0xFFFF) overflow_count++;

  2. #2
    Senior Member
    Join Date
    Aug 2013
    Gothenburg, Sweden
    That example is for AVR processors, Teensy 2's.
    Teensy 3 needs ARM interrupt code.

  3. #3
    by any chance do you have an example for this?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    If you're trying to run an interrupt at a periodic rate, use IntervalTimer:

    If you really want to do low-level coding, you're going to have to read the manual. Sorry, it's not the same as AVR. It's actually so much better in so many ways, except the way where you can directly apply existing AVR-specific code and knowledge.

  5. #5
    thanks. as you probably noticed from my other post, i am trying to get DMX receiving working. so the interrupt should be called when data comes in on the serial1 RX pin.
    The DMXreceiver library you pointed me to works fine.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts