FlexTimer2 on Teensy 3

Status
Not open for further replies.

badhairday

New member
Hi,

I am moving some code from a Teensy 2 to a 3. I am getting an error using FlexTimer2 that it only works on an AVR architecture. Would this be an easy fix or is there a better, similar library to use? I don't want to spend a lot of time reinventing the wheel.

Thanks,
Chris
 
Sorry if I did not give enough details. Using Teesyduino, the code below compiles using a Teensy 2 but on a Teensy 3 errors with the following:

In file included from sketch_may12a.ino:1:0:
/Users/chris/Documents/Arduino/libraries/FlexiTimer2/FlexiTimer2.h:7:2: error: #error FlexiTimer2 library only works on AVR architecture

My question is would it be an easy fix (change) to FlexTimer2 to make it compatible with the ARM architecture.

Thanks,
Chris

Code:
#include <FlexiTimer2.h>


void setup() {
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  FlexiTimer2::set(50, flash); // 500ms period
  FlexiTimer2::start();
} 
  
void flash() {
  static boolean output = HIGH;   
  digitalWrite(11, output);
  output = !output;
}

void loop(){
  Serial.println("Looping");
  delay(1000);
}
 
Teensy 3.0 has IntervalTimer for this purpose. It works better than FlexiTimer2, with higher precision, up to 4 separate timers, and without disrupting any of the PWM pins.
 
Status
Not open for further replies.
Back
Top