Where to write code in circuitpython for circuit playground

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Korey
 
Posts: 2
Joined: Mon Oct 03, 2022 2:23 pm

Where to write code in circuitpython for circuit playground

Post by Korey »

Hello! Beginner question here, but I've been stuck for a couple hours now on where to actually start writing code for circuitpython.

I've downloaded the circuitpython git repo, installed the dependencies, and then made my first build following this guide https://learn.adafruit.com/building-cir ... cuitpython.

I didn't see a guide on where to actually put the code, though. I read through the README, and it seems to indicate that I just create a main.py and put the code in there. I tried that first putting main.py at the root of the git repo, then again while putting main.py inside at circuitpython/ports/atmel-samd/main.py. Neither build seemed to change the behavior of my circuit playground. I copied the code from here just to get something working https://learn.adafruit.com/circuit-play ... /the-cylon

I did a make clean before the build, then did the make build and copied the fimrware.uf2 folder into the circuit playground's directory (the D drive on my machine).

So my questions
1) Where is main.py actually supposed to go?
2) When I copy the firmware.uf2 file, should I be deleting the CURRENT.UF2 file that's already there? Each time I reset the device to see the folder again my firmware.uf2 file has gone away.
3) Is there any getting started guides that I could read that actually go through a first program walkthrough? If I had a reference to the library code and was able to essentially do a hello world, I'm sure I could get going, but I'm not sure how to even begin!

Thanks for the help!!

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Where to write code in circuitpython for circuit playground

Post by danhalbert »

You don't have to compile a main.py (or code.py) into CircuitPython itself. You load CircuitPython onto the Circuit Playground Express by double-clicking the rest button. You will see CPLAYBOOT. Drag the UF2 from https://circuitpython.org/board/circuit ... d_express/ onto CPLAYBOOT. After a few seconds, a CIRCUITPY drive should appear. In there you will see code.py. Edit that file to run a program.

This is all explained here: https://learn.adafruit.com/welcome-to-circuitpython
and here: https://learn.adafruit.com/adafruit-cir ... quickstart

User avatar
Korey
 
Posts: 2
Joined: Mon Oct 03, 2022 2:23 pm

Re: Where to write code in circuitpython for circuit playground

Post by Korey »

Fantastic! Not sure how I missed the welcome guide when I searched for circuitpython. Either way, I really appreciate the reply! Can't wait to get started today :)

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

Return to “Adafruit CircuitPython”