getting fatal error: teensy4/teensy.h: No such file or directory when running code below

Ori1

Member
Hello
Could you help with that error?, Not find Teensy library, How to install it?
Thanks
 

Attachments

  • teensy_timer.ino
    257 bytes · Views: 313
Where did you find this 'TeensyTimer" library?
Did you intend to use the TeensyTimerTool library? If so, you need to install this libary from the Arduino library manager.

Another question on your code:
C++:
#include <teensy4/teensy.h>
#include <TeensyTimer.h>

TeensyTimer timer;

void setup() {
  timer.setClock(100000000);
  timer.setMode(TeensyTimer::MODE_PWM);
  timer.setCount(10);
  timer.setInterval(40000000);

  timer.start();
}

void loop() {
  // ...
}

Why did you include #include <teensy4/teensy.h>. It also throws a fatal error: teensy4/teensy.h: No such file or directory.

Paul
 
Apparently this example code was made up by ChatGPT. It's not real code from any library or working example. It's as unreal as those AI "photos" where the people have 6 or 7 or more fingers...

@Ori1 - we can try you, but we're real humans, not AI. At the very least, you have to compose a question that explains what you're trying to accomplish and gives us enough context to understand your project.
 
I'm using Teensy4.1, In button line need to generate a 10 nanosecond pulse every 50 milliseconds
 
The more I learn about these large language models (LLM) used in "AI" the more I think they are huge sink holes for other peoples intellectual property that get spit out the backend in a somewhat coherent form but not necessarily anything useful. I use Google's NotebookLM language model to query the IMX technical doc's but found that it gives ok at best insight but you could not use it solely to solve a programing question.
 
The timers run at 150 MHz on Teensy 4.1. Using a timer to control the pin, you'll get multiplies of 6.6ns because the timer clock frequency is 150 MHz.
 
The other limitation is timer resolution. Most timers have 16 bits. If the timer clocks at 150 MHz, the 16 bit count overflows every 432us. Such a timer alone can't give a repeat on such a long time scale as 50ms. It may be possible, but is not simple or easy.
 
OK.
Someone can help me to write simple code that just run 10 nanosecond pulse?
You didn't specify how precice you need that pulse. If you only need something roughly 10ns you can use the following code. It will generate a pulse of about 13ns every 50ms.

C++:
IntervalTimer timer;

void pulse()
{
   digitalWriteFast(0,HIGH);
   //digitalWriteFast(0,HIGH); add more of those lines if you need to make the pulse longer
   digitalWriteFast(0,LOW);
}

void setup()
{
  pinMode(0, OUTPUT);
  timer.begin(pulse,50'000);
}

void loop()
{
}
 
Thanks, I thought to try to write " digitalWriteFast " but didn't test it till now.
I did 4 test :

1. digitalWrite and CPU Speed: "600 MHz"
digitalWrite and CPU Speed 600 MHz.png


2. digitalWrite and CPU Speed: "816 MHz"
digitalWrite and CPU Speed 816 MHz.png


3. digitalWriteFast and CPU Speed: "600 MHz"
digitalWriteFast and CPU Speed 600 MHz.png


4. digitalWriteFast and CPU Speed: "816 MHz"
digitalWriteFast and CPU Speed 816 MHz.png
 
Paul gave you the link to the documentation of the library in #13 above. It contains all information how to use it. However, it does not contain a "simple list of commands".
I can give you examples if you tell us what you want to achieve with the library
 
These libraries all use digital pins.

To measure an analog signal, use analogRead(). If your signal is only value for 0.8ms, perhaps you can create circuitry which gives a digital pulse at the moment to measure? Then connect to a digital pin and use attachInterrupt() to cause a function to run when Teensy sees the pulse. If you're not familiar with these standard Arduino functions, a quick Google search will turn up the Arduino documentation.

At least that's the best advice I can give with so little understanding. You asked only 11 words in your question "Need to measure pulse amplitude that between 0.8 to 1.2 millisecond", which gives almost no context to understand. If this answer isn't suited to your needs, maybe you should consider writing more so we can actually understand.
 
Back
Top