PIR to SAMD21 to WS28212b Fade Color 250730

Hello @gcjr @alto777 and the Arduino forum,

can you just go back to older code that did compile and run and copy the changes,
one by one to the older version of the code

First the sketch
PIR_to_SAMD21_to_WS28212b_Fade_Color_250726.ino was compiled and loaded
onto the SAMD21 to test that the sketch operates as expected and as shown in video
posted in post 6 titled 'PIR to SAMD21 to WS2812b 270730'
Test result: As expected. That is, the strip begins with blue and fades
from blue to red then jumps back to blue and begins a new cycle.
Each cycle takes six seconds. There are four cycles. After 24 seconds
the strip glows red continuously until the PIR is triggered or
the power is removed.

It looks like there are two differences between
PIR_to_SAMD21_to_WS28212b_Fade_Color_250726.ino
and
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801.ino
the sketch copied from post 15.

Difference One.
...250801.ino adds the function void setLEDColor(int colorStep)

Difference Two.
The function runSAMD21 in ...250801.ino has four lines
of code.
The function runSAMD21 in ...250726.ino has eight lines
of code.

Test One. Add void setLEDColor(int colorStep) function
Drafted new sketch
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_1.ino
attached.
In ...250801_1.ino the code from sketch ...250726.ino
is copied into ...250801_1.ino and compiled.
The function void setLEDColor(int colorStep)
is then added between void loop() and
void runSAMD21() functions.
Compile Test Result: Compiles
WS28212b Strip Test: Runs the same as ...250726.ino
That is, same as video posted in post 6 titled 'PIR to SAMD21 to WS2812b 270730'

Test Two. Add function runSAMD21 from ...250801.ino
Drafted new sketch
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_2.ino
attached,
At ...250801_2.ino function runSAMD21 from ...250801.ino
(This should make ...250801_2 the same as the gcjr's code
copied from post 15 that returns the
'Compilation error: data section exceeds available space in board'
error. But will try anyway to see if a different result ensues.)
Compile Test Result: Compiles
WS28212b Strip Test: Runs similar to sketch ...250726.ino
except for two changes:

  1. Strip begins blue fades to red, blinks and now instead
    of jumping to blue the strip fades from red to blue.
  2. After four cycles the strip now, instead stopping at red,
    stops at blue and glows blue continuous until PIR triggered or power removed.
    Still have jump/blink between cycles.

Test Three. Comment out delay(10) at end of void setLEDColor(int colorStep) function
At PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_2.ino
Comment out delay(10) at end of void setLEDColor(int colorStep) function
Compile Test Result: Compiles
WS28212b Strip Test: Same as Test Two. That is, runs four cycles:
Begins blue.
Fades blue to red. Blinks. Fades red to blue.
Fades blue to red. Blinks. Fades red to blue.
Fades blue to red. Blinks. Fades red to blue.
Fades blue to red. Blinks. Fades red to blue.
Remains blue until PIR triggered or power removed.

Test Four. Comment out delay(10) at end of function void function void runSAMD21()
At PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_2.ino
Comment out delay(10) at end of function void function void runSAMD21()
Oops. I thought there was a delay(10) at the end of runSamD21
but the delay was removed in the sketch by gcjr copied from post 15.

So there is some improvement. Instead of jumping back to blue
after fading from blue to red, the strip blinks, fades from red to blue,
as desired and begins the cycle again from blue.

One minute video of strip operating sketch
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_2.ino

I thought that removing the delay would eliminate the blink.

If the blink is eliminated after fade to red and before
fade back to blue the design will be at home base.

Why does the strip blink? How can the blink be dismissed?

Thanks

Allen
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_1.ino.ino (1.9 KB)
PIR_to_SAMD21_to_WS28212b_Fade_Color_250801_2.ino (1.6 KB)