Hello,
sorry for my english,
I use a teensy 4.0 the outputs numbered 2 to 10 are used to control leds with a PWM symbol.
Each led and controlled by a "state machine" with millis functions (9 millis defined randomly by state machine) triggering conditions such as on off long stop short stop.
The 8 outputs work very well at the same time, that's exactly what I want.
My problem comes when I want to control everything with an impulse from an RC receiver (input number 15 on the Teensy 4.0 board) using Pulsin or IntervalTimer or RXInterrupt.
independently the program works but when I add RXInterrupt for example, it sends me wrong values (reinitialization of interrupts?)
I have the same type of program on a nano card but with 4 outputs, 1 input which uses ISR but from what I have seen and tested it is not compatible 8 bits against 32 bits
Below is the code used with the Nano card, I don't know how to update it for Tennsy 4.0
I would like to replace Arduino by Tennsy it's so much better...
Thank you for possibly helping me if you have an idea of the problem!
sorry for my english,
I use a teensy 4.0 the outputs numbered 2 to 10 are used to control leds with a PWM symbol.
Each led and controlled by a "state machine" with millis functions (9 millis defined randomly by state machine) triggering conditions such as on off long stop short stop.
The 8 outputs work very well at the same time, that's exactly what I want.
My problem comes when I want to control everything with an impulse from an RC receiver (input number 15 on the Teensy 4.0 board) using Pulsin or IntervalTimer or RXInterrupt.
independently the program works but when I add RXInterrupt for example, it sends me wrong values (reinitialization of interrupts?)
I have the same type of program on a nano card but with 4 outputs, 1 input which uses ISR but from what I have seen and tested it is not compatible 8 bits against 32 bits
Below is the code used with the Nano card, I don't know how to update it for Tennsy 4.0
I would like to replace Arduino by Tennsy it's so much better...
Thank you for possibly helping me if you have an idea of the problem!
Code:
ISR(PCINT0_vect)
{
current_time = micros();
// Channel 1 -------------------------------------------------
if (PINB & B00000001) { // Is input 8 high ?
if (previous_state[CHANNEL1] == LOW) { // Input 8 changed from 0 to 1 (rising edge)
previous_state[CHANNEL1] = HIGH; // Save current state
timer[CHANNEL1] = current_time; // Start timer
}