The datasheet is a bit unclear, can it be that this encoder has only half a quadrature period per detent? You can try by setting it to CountMode::full and see how much the count value increases if you rotate the encoder by one detent.
I tested...
Thats not an error in your code but some glitch in the Arduino IDE. Seems like deleting the files in your temp folder fixes ist: https://forum.arduino.cc/t/internal-error-in-mingw32-gt-pch-use-address/1107884
If you switch the standard library from the default newlib to newlib-nano your size difference shrinks down to a few 100 bytes. Here some info about the two versions of the standard library...
I recently stumbled over std::optional which comes in handy for such situations. Of course, changing an already published API is a no-go, but std::optional seems to be a nice tool for the toolbox...
#include <optional>
std::optional<unsigned>...
Instead of SMALLEST_CODE you could also try to add --specs=nano.specs which will switch to newlib-nano (same as SMALLEST_CODE does) but keeps the optimization level.
You are right of course. To be on the save side one should use
DMAMEM alignas(A) uint8_t buf[sizeof (A)]; // statically allocate memory for an object of type A
to allocate the buffer.
Here a quick test which shows that the compiler relys on initialization during startup.
class A
{
public:
int i = 42;
const int c = 17;
void print()
{
Serial.printf("i=%d &i=%p\n", i, &i);
Serial.printf("c=%d...
I have successfully worked on a proof of concept to upload ehex files with TeensySharp. However, I haven't integrated it into the library yet. Anyway, the purpose of TeensySharp is to allow users to integrate Teensy detection and firmware upload...
Actually isPressed() returns the debounced state of the button. So, replacing pressed() by isPressed() in @japreja s code should work.
Here an example showing the behaviour of isPressed()
#include "Bounce2.h"
Button b1;
void setup()
{...
Thanks, I'll fix that. However, CallbackHelper was just an experiment to understand how those things work. Please note that since the new TD1.59, the core contains teensy::Inplace_function which is a much better solution.
You can't.
For frequency measurements see here: https://www.pjrc.com/teensy/td_libs_FreqCount.htm
For pulse height you need to use analogRead, but that will be difficult if you have short pulses
For pulse width see here...
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...
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.
IntervalTimer timer;
void pulse()
{
digitalWriteFast(0,HIGH)...
Technically you'd put the objects in DMAMEM, not the class. Here an example: c1 lives in ITCM, c2 lives in DMAMEM and c3 in FLASHMEM
class myClass
{
public:
unsigned i = 42;
};
myClass c1;
DMAMEM myClass c2;
FLASHMEM const myClass c3;
void...
I just gave WebSerial a try. This is also very simple to use:
Here a simple test web page:
<!DOCTYPE html>
<html>
<head>
<title>Page Title2</title>
</head>
<body>
<h1>WebSerial Tester</h1>
<button type="button"...
@PaulS, Maybe I didn't understand this correctly, but I always thought WebUSB is a low level API where you directly communicate to endpoints / interfaces etc. Thus, wouldn't you need a corresponding driver on the Teensy side to make this work...
Actully accelstepper::run() is not very expensive and the T4.1 processor is quite fast. Here a simple test which moves 4 steppers with random parameters. tick() calls the run() functions of the steppers in a timer interrupt every 100µs. During...
In case WebHID is sufficient: I did try it some time ago, it worked nicely with minimal code: https://forum.pjrc.com/index.php?threads/making-webusb-work-with-the-teensy-what-is-pluggableusb.60782/post-247184.
I just tried it, it still compiles...
Yes, I'll never understand why the Arduino IDE doesn't have a simple "clean all". Anyway, the note is issued during compiling, not linking. So, in this case forcing a rebuild doesn't help.
I can reproduce that with @PaulStoffregen s code. I also saw that the warning/note is generated by the compiler, not the linker. So, opposed to what was written in the StackOverflow link it doesn't help doing a clean recompile. Anyway, you can...
The warning seems to be about linking code compiled with an older compiler to code compiled with a newer compiler. See here for details: https://stackoverflow.com/a/48149400/1842762.
Are you sure that you are doing a clean rebuild? Are you...
There still is a leftover from the old code in intervaltimer.h:
https://github.com/PaulStoffregen/cores/blob/c5e716375532ae0d8b912d7034707c0859b68801/teensy4/IntervalTimer.h#L73C2-L78C3
here the corresponding PR...
Registering an interrupt service routine (ISR) is usually done by storing its address in a table (often called the "vector table"). The IntervalTimer.begin() function does this for you. If an interrupt wtih number n occurs, the processor...
@cmarcus: Here you can experiment: https://godbolt.org/z/djMe46bj1
As mentioned above, signed integers generate much more code than an unsigned version
Couple of years ago I did a lot of experiments with high speed data transfer over usb serial. It turned out that on Win10 you can stably transfer some 10MByte/sec from a Teensy to a dotNet (C#) application.
However, there is a known bug in the...