Errors in the Larson Scanner Shades project code.

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bilagaana
 
Posts: 27
Joined: Sun Dec 10, 2017 2:14 pm

Errors in the Larson Scanner Shades project code.

Post by bilagaana »

The CircuitPython code currently provided in the Larson Scanner Shades project does not function. This is very frustrating for novice users.

Please see the discussion at viewtopic.php?f=8&t=187339 for a working version of the code provided through the efforts of user caitlinsdad.

User avatar
adafruit_support_carter
 
Posts: 29175
Joined: Tue Nov 29, 2016 2:45 pm

Re: Errors in the Larson Scanner Shades project code.

Post by adafruit_support_carter »

Just tested the code:
https://learn.adafruit.com/larson-scann ... ython-code
on a Trinket M0 running CircuitPython 7.1.1:
https://circuitpython.org/board/trinket_m0/
and it ran as expected.

Might be seeing the "blink when reversing" issue mentioned. But the square bracket syntax is not an issue.

What version of CircuitPython were you running?

User avatar
bilagaana
 
Posts: 27
Joined: Sun Dec 10, 2017 2:14 pm

Re: Errors in the Larson Scanner Shades project code.

Post by bilagaana »

Thanks for the prompt response.

The boot_out.txt file reads "Adafruit CircuitPython 3.1.1 on 2018-11-02; Adafruit Trinket M0 with samd21e18"

Is that the relevant information or should I look in another location?

This is a Trinket M0 ordered January 8, 2022 and received last week.

User avatar
adafruit_support_carter
 
Posts: 29175
Joined: Tue Nov 29, 2016 2:45 pm

Re: Errors in the Larson Scanner Shades project code.

Post by adafruit_support_carter »

Thanks. Looks like 3.1.1. That's a pretty old version of CircuitPython. That could explain the issue. The code is likely based on newer versions. Try updating your CircuitPython firmware:
https://circuitpython.org/board/trinket_m0/

You'll also want to grab the latest library bundle and update your libraries:
https://circuitpython.org/libraries

User avatar
bilagaana
 
Posts: 27
Joined: Sun Dec 10, 2017 2:14 pm

Re: Errors in the Larson Scanner Shades project code.

Post by bilagaana »

Okay, if I am understanding correctly then I received a board with an outdated version of CircuitPython and need to install the current version.

I find pages referencing the 7.1.1 version and the UF2 bootloader but am unclear as to how to proceed.

As a novice user, I need step-by-step instructions to accomplish any updates. I have not located such, so far. Can you provide a link?

Thanks.

User avatar
adafruit_support_carter
 
Posts: 29175
Joined: Tue Nov 29, 2016 2:45 pm

Re: Errors in the Larson Scanner Shades project code.

Post by adafruit_support_carter »

Check out the main guide on using CircuitPython:
https://learn.adafruit.com/welcome-to-circuitpython

It covers how to install/update the firmware:
https://learn.adafruit.com/welcome-to-c ... cuitpython

It also covers working with the libraries:
https://learn.adafruit.com/welcome-to-c ... -libraries

User avatar
bilagaana
 
Posts: 27
Joined: Sun Dec 10, 2017 2:14 pm

Re: Errors in the Larson Scanner Shades project code.

Post by bilagaana »

I followed the steps to the best of my understanding, confirmed that the UF2 is current, then dragged and dropped the adafruit-circuitpython-trinket_m0-en_US-7.1.1.uf2 file to the TRINKETBOOT drive.

I then opened Mu Editor, copied and Saved the original CircuitPython Larson Scanner code as shown in the tutorial (with the correct number of pixels for my strip and the pixpin value D4).

The result is that no pixels are illuminated, the green LED on the Trinket is illuminated and the Dotstar occasionally flashes red.

Incidentally, attempting to install the current libraries may be an issue. However, dl'ing the mpy bundle, unzipping and attempting to drag and drop the lib folder the CIRCUITPY drive gives the "not enough space" error.

It appears I have missed a step or am misunderstanding the proper procedure for installing the library.

Suggestions?

User avatar
adafruit_support_carter
 
Posts: 29175
Joined: Tue Nov 29, 2016 2:45 pm

Re: Errors in the Larson Scanner Shades project code.

Post by adafruit_support_carter »

When updating the firmware you also need to update the libraries. If you only updated the firmware (adafruit-circuitpython-trinket_m0-en_US-7.1.1.uf2) then it probably trying to still use the older libraries already on the board and erroring out.

User avatar
bilagaana
 
Posts: 27
Joined: Sun Dec 10, 2017 2:14 pm

Re: Errors in the Larson Scanner Shades project code.

Post by bilagaana »

That was a learning experience. One which would not have been necessary had the Trinket been shipped with a current iteration of onboard software. In any case, now I know what to look for if the problem recurs on other boards.

It appears that the Larson Scanner routine needs the library module:
adafruit_pypixelbuf.mpy

and, possibly (it's unclear to me from the REPL messages):
neopixel.mpy

...copied to the lib folder on the board.

After those are copied over, the code does run and produce the Larson Scanner effect.

The animation does still illuminate the tail-end pixel before reversing direction (as noted in the thread linked at the start of this Topic). Inserting user caitlinsdad's "while True" code snippet (as seen in the original Topic) corrects that problem. There's still a white flash sneaking into the main pixel grouping just before the sequence reverses direction nearest the cpu. This will give me something else to troubleshoot and perhaps learn something about CircuitPython in the process.

In addition, changing the value for the #brightest pixel from (255, 48, 0) to (255, 0, 0) produces what to my tastes is a more esthetically pleasing pure red.

I appreciate your patience and assistance.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”