How to manage files for Metro Express

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
stampmaille
 
Posts: 2
Joined: Thu Dec 26, 2013 3:38 pm

How to manage files for Metro Express

Post by stampmaille »

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.

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: How to manage files for Metro Express

Post by dastels »

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

User avatar
stampmaille
 
Posts: 2
Joined: Thu Dec 26, 2013 3:38 pm

Re: How to manage files for Metro Express

Post by stampmaille »

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.

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: How to manage files for Metro Express

Post by dastels »

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

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

Return to “Metro, Metro Express, and Grand Central Boards”