Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

How to manage files for Metro Express
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to manage files for Metro Express

by Stampmaille on Mon Nov 29, 2021 8:39 pm

Apologies for the noob queston, I'm very new to circuit python.
How do I manage my python programs for my metro express.
As I understand it, the current program must be named code.py and be located in the root directory.
So, lets say I'm running a blinking led program and want to work on something different

I have to:
rename code.py to blink.py
rename double_blink.py to code.py

Is this correct?
This feels very clunky.
I'm hoping there's something I missed.
Stampmaille
 
Posts: 2
Joined: Thu Dec 26, 2013 3:38 pm

Re: How to manage files for Metro Express

by dastels on Mon Nov 29, 2021 10:49 pm

Typically you have a single application on a microcontroller board.

Personally, I don't actively develop on the board. I work on code on my workstation's drive and copy things to the board to test/run it using a deploy script: https://github.com/dastels/circuitpython_deploy.

Dave

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

Re: How to manage files for Metro Express

by Stampmaille on Sat Dec 04, 2021 1:54 pm

Thank you for your reply.
Unfortunately I'm too much of a noob to understand how to run a script or use github.
I thought I'd learn Python by converting my Arduino programs to run on a Metro Express and was hoping to lessen the learning curve.
Any other tips?
Thanks in advance.
Stampmaille
 
Posts: 2
Joined: Thu Dec 26, 2013 3:38 pm

Re: How to manage files for Metro Express

by dastels on Sat Dec 04, 2021 3:22 pm

Have a different directory (on your host system) for each project. Have code.py in that directory and copy it to CIRCUITPY when you want to test/run it. That's mostly what my script does, and also manages the libraries needed for the project.

If you have a lot of code, it's useful to separate it into multiple files, typically one per class. In this case I use main.py instead of code.py.

Learning the basic use of Github is pretty much a requirement these days. Git can do amazing things, but you generally don't need more than a few commands. There are plenty of introductions to Git and Github. I'd start by looking at github.com.

Dave

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

Please be positive and constructive with your questions and comments.