In UP mode you always turns relays off before setting them to correct value, that will cause spikes
if(num > PrvNum){
Serial.println("UP");
PrvNum = num;
for (int i = 0; i < 7; i++) { ...
This is slightly confusing exactly how are the Teensy, Nextion and optocouplers connected ? Which pin is input from Nextion, and which is the corresponding output from Teensy ?
You have 16 leds in the matrix and 24 steps per beat, that makes it a bit tricky to count the beats, every beat is 24=6*4 steps that is one and a half full matrix of steps.
Also the lastTime should be updated as ...
Time libraries are supposed to be able to handle times before 1970, so the times can be represented as negative numbers.
If you are sure that your use of time is after 1970 you can convert/copy/typecast time values...
Perhaps filter the incoming midi data, keep the latest master values of controllers and only update changes to the slave every ... say 1 ms or send as often as the i2c can handle dependent on how many channels are being...
You will not do any ISR based timing at more than a fraction of the processor clock divided by ( ISR setup cycles + ISR execute cycles + ISR return cycles). This might be fast compared to audio frequencies ( 600 MHz /...
Looks like binary data is received and not converted to printable form ... but
How can anyone help without knowing anything about the code you are actually running, or what dta you are supposedly transmitting. There...
Its a queue with maximal size equal to sample window, so a ring buffer should work fine. My guess is that on average the length should be something like 2log(N), if the values are a bit randomly distributed
The key to understanding the algorithm are the following properties of the list L of (sample volume, sample index) pairs
* L is always sorted by increasing sample index/sample time since we only append at the end,...
I assume you want the data in descriptions array to be in binary format, in that case they must be prefixed with 0b like
0b0000011100000111,
Your program only outputs the data once in the setup and the serial...
Not necessarily, your frame rate calculation is just valid for the image transmission, but the sensor array has a minimum exposure time in order to create a useful image, that would be the frame time for a single pixel...
Do I get the picture right, the camera is above the hammers, is this a standing piano so the camera sees the edge of the hammers, or is like a grand piano so the camera sees the top/back of the hammers ?
How do you...
Here is a ring buffer variant to test also
/* Control a set of solenoids with MIDI
* Note on messages trigger solenoids, and they will be turned off after a certain amount of ms has passed
*/
int...
Its not my project, but I agree that this a could be a good way to handle something like 100 solenoids, a number to big for the Teensy pincounts. In this case there would be a solenoid array, or bitmap, on/off for the...
I have tested your original code on a Teensy 3.6 and a virtual midi keyboard on MacOS, outputs just connected to led's. With only these 5 possible solenoids its very fast, in order of ten microseconds for the loop code....
With all delays equal and the time always monotonically increasing its a simple queue, I would use a circular buffer with the reference (pointer) to the head which is the next element to remove, and another reference to...
The sending loop in writeSeq callback has no control over the bit timings. So on the Teensy 4 the bitrate will be much higher than for the LC, possibly/probably causing issues for the N64 to read the bitstream. I think...