Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Starting out with Gemma M0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Starting out with Gemma M0

by oscillodope on Tue Oct 26, 2021 1:56 pm

Hey Everyone!

I am brand new to programming and decided to add the Gemma to a project I am working on. I was able to plug it in, load the newest UF2 and start working on coding but I cannot seem to get the libraries to work in order for it to recognize the on board DotStar.

I have downloaded the latest bundles, reset the Gemma and updated the UF2 multiple times, checked the boot text to make sure I have the correct version of CircuitPython and no matter what I do I always get the .mpy error even though I copy the code text straight from the guide. The only time I don't get this error is when I put the dotstar.mpy from the 6.x bundle into my CIRCUITPY library but that doesn't make sense as I've verified that I am running everything on 7.x, regardless I still can't control the on board Dotstar even when it seems to recognize this library.

Every once in a while as I am working on this the Dotstar will turn white and stay white but I haven't been able to reproduce that in a consistent way or get it to change and control it from there. I was easily able to control the blinking on the LED but as soon as I moved away from that I haven't been able to do any of the exercises with the DotStar. The code I'm using for the DotStar is just from the Gemma guide below. https://learn.adafruit.com/adafruit-gem ... al-rgb-led

Code: Select all | TOGGLE FULL SIZE
"""CircuitPython Essentials Internal RGB LED red, green, blue example"""
import time
import board

# For Trinket M0, Gemma M0, ItsyBitsy M0 Express, and ItsyBitsy M4 Express
import adafruit_dotstar
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
# For Feather M0 Express, Metro M0 Express, Metro M4 Express, Circuit Playground Express, QT Py M0
# import neopixel
# led = neopixel.NeoPixel(board.NEOPIXEL, 1)

led.brightness = 0.3

while True:
    led[0] = (255, 0, 0)
    time.sleep(0.5)
    led[0] = (0, 255, 0)
    time.sleep(0.5)
    led[0] = (0, 0, 255)
    time.sleep(0.5)


Any help would be awesome!

oscillodope
 
Posts: 3
Joined: Mon Oct 25, 2021 6:37 pm

Re: Starting out with Gemma M0

by dastels on Tue Oct 26, 2021 2:27 pm

Can you post the error output that you see in the REPL?

You need to use a version of the bundle (e..g. 7.x or 6.x) that matches the version of CircuitPython you are using.

Ideally you should be using the latest of both CP and the bundle.

I've found it best to delete everything from CIRCUITPY/lib, empty trash, and copy new libraries in.

Dave

dastels
 
Posts: 7972
Joined: Tue Oct 20, 2015 3:22 pm

Re: Starting out with Gemma M0

by oscillodope on Tue Oct 26, 2021 4:03 pm

I will post the REPL when I get home but I know that the version on the Gemma is 7.x (from on board text file and REPL) and the version of the bundle that I downloaded is 7.x. I am also putting what I think is the most recent boot loader uf2 on and that says version 7.x.

I will try the lib process, should the only thing in the folder once I delete the current contents and clear trash be just the mpy's that I need? So the only thing that will be in the folder after this is the 7.x version of adafruit_DotStar.mpy? Or are there other library files that I need to drag over as well?

oscillodope
 
Posts: 3
Joined: Mon Oct 25, 2021 6:37 pm

Re: Starting out with Gemma M0

by dastels on Tue Oct 26, 2021 4:10 pm

That should be all although there might need to be some support libraries (busio maybe). Watch the REPL when the code runs; it will tell you if something is missing.

Dave

dastels
 
Posts: 7972
Joined: Tue Oct 20, 2015 3:22 pm

Re: Starting out with Gemma M0

by oscillodope on Tue Oct 26, 2021 5:50 pm

Deleted the contents of the library and added back adafruit_dotstar and adafruit_pypixelbuf and it worked perfectly! thank you so much!

oscillodope
 
Posts: 3
Joined: Mon Oct 25, 2021 6:37 pm

Re: Starting out with Gemma M0

by dastels on Wed Oct 27, 2021 9:57 am

Sometimes old files are left when the libraries get updated/refactored and can confuse things.

Dave

dastels
 
Posts: 7972
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.