0

The Noobiest Question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

The Noobiest Question

by Tictac80 on Wed Jan 23, 2019 1:52 pm

This may be the stupidest question from a Noob, but here goes...
I have a Trinket M0 and using Circuitpython with the Mu editor on my computer.
Yesterday all was fine as I entered a few LED flashing programs. It seems these programs automatically uploaded to the connected Trinket when they were saved.
Today, I edited some code on Mu without the Trinket connected. The code was checked and all is OK, except I cannot get it uploaded to the Trinket.
My Mu editor has no UPLOAD or RUN buttons. I even copied the .PY file to the CIRCUITPY drive. I tried for hours to find help on the internet and other help files with no luck.
So, how does one get the code to upload and run?
Any help would be greatly appreciated.

Tictac80
 
Posts: 5
Joined: Sat Feb 11, 2017 12:16 pm

Re: The Noobiest Question

by adafruit_support_carter on Wed Jan 23, 2019 2:11 pm

Today, I edited some code on Mu without the Trinket connected. The code was checked and all is OK, except I cannot get it uploaded to the Trinket.

Did you reconnect it? Mu expects the board to be attached.

adafruit_support_carter
 
Posts: 9701
Joined: Tue Nov 29, 2016 2:45 pm

Re: The Noobiest Question

by Tictac80 on Wed Jan 23, 2019 2:22 pm

Thanks for the super quick response.
Yes, I turned everything off; connected the Trinket via USB; then started Mu with my code already there.
When I clicked on SERIAL, the REPL only shows printed matter from a previous program that also flashed the onboard LEDs.
The CIRCUITPY drive has three .PY files: MAIN.PY, CODE.PY and M0-ALARM.PY (which is the code I want it to run).
Do I need to delete the other two .PY files or rename mine to MAIN.PY or something?

Tictac80
 
Posts: 5
Joined: Sat Feb 11, 2017 12:16 pm

Re: The Noobiest Question

by adafruit_support_carter on Wed Jan 23, 2019 2:26 pm

Maybe. Or rename them. Those names are the special ones that will get run automatically:
https://learn.adafruit.com/welcome-to-c ... -file-7-30

adafruit_support_carter
 
Posts: 9701
Joined: Tue Nov 29, 2016 2:45 pm

Re: The Noobiest Question

by Tictac80 on Wed Jan 23, 2019 2:39 pm

It works now!
It had something to do with the filenames on the CITCUITPY drive. I deleted the CODE.PY and MAIN.PY files.
I then renamed my own file MAIN.PY. It started running my code after several presses on the RESET button.
Thank you very much.

Tictac80
 
Posts: 5
Joined: Sat Feb 11, 2017 12:16 pm

Re: The Noobiest Question

by PeteH51 on Thu Jan 24, 2019 7:15 pm

I found this useful when starting out. You have to rename the files sometimes.

from :
https://learn.adafruit.com/welcome-to-c ... iting-code

"CircuitPython looks for a code file on the board to run. There are four options: code.txt, code.py, main.txt and main.py. CircuitPython looks for those files, in that order, and then runs the first one it finds. "

PeteH51
 
Posts: 18
Joined: Sun Jan 06, 2019 12:04 pm

Please be positive and constructive with your questions and comments.