Board:- Teensy 4.0
Teensyduino:- 1.51
TimerOne Library:- https://github.com/PaulStoffregen/TimerOne
I created simple Blink code
This only works properly with 150 MHz and 24 Mhz. This is not working with 600 MHz selection.
Teensyduino:- 1.51
TimerOne Library:- https://github.com/PaulStoffregen/TimerOne
I created simple Blink code
Code:
#include <TimerOne.h>
const int led = LED_BUILTIN; // the pin with a LED
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(led, OUTPUT);
Timer1.initialize(100000);
Timer1.attachInterrupt(blinkLED); // blinkLED to run every 0.10 seconds
}
void loop() {
// put your main code here, to run repeatedly:
}
// The interrupt will blink the LED, and keep
// track of how many times it has blinked.
int ledState = LOW;
volatile unsigned long blinkCount = 0; // use volatile for shared variables
unsigned long guTime1, guTime2 = 0;
void blinkLED(void)
{
guTime2 = micros();
if (ledState == LOW) {
ledState = HIGH;
blinkCount = blinkCount + 1; // increase when LED turns on
} else {
ledState = LOW;
}
digitalWrite(led, ledState);
Serial.println(guTime2-guTime1);
guTime1 = guTime2;
}
This only works properly with 150 MHz and 24 Mhz. This is not working with 600 MHz selection.