Metro M0 Express CircuitPython set up issues

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
infectiousdis
 
Posts: 4
Joined: Mon May 24, 2021 1:46 am

Metro M0 Express CircuitPython set up issues

Post by infectiousdis »

Hi all,
I just got a Metro M0 Express and started with setting up CircuitPython as specified in the manual. I started by copying the file adafruit-circuitpython-metro_m0_express-en_US-6.2.0.uf2 to METROBOOT. The drive name changed to CIRCUITPY and the LED is continuously flashing now in the following sequence 1 Green, ! Pink, 5 Blue on and on. I installed Mu Editor. When I start the editor, it is showing a bunch of modes like Python, CircuitPython etc but not Adafruit CircuitPython like shown in the manual. I selected CircuitPython but the bottom of the editor says "No device connected".

Why is the LED blinking continuously in multicolor after loading CircuitPython. I am running a Windows 8.1....

infectiousdis


2021-05-24 00:50:31,212 - mu.interface.main:970(show_confirmation) DEBUG: There is un-saved work, exiting the application will cause you to lose it.
2021-05-24 00:50:31,217 - mu.interface.main:971(show_confirmation) DEBUG: None
2021-05-24 00:50:35,917 - mu.interface.main:970(show_confirmation) DEBUG: There is un-saved work, exiting the application will cause you to lose it.
2021-05-24 00:50:35,917 - mu.interface.main:971(show_confirmation) DEBUG: None
2021-05-24 00:50:37,709 - mu.settings:169(save) DEBUG: Saving to C:\Users\pc\AppData\Local\python\mu\session.json
2021-05-24 00:50:37,711 - mu.logic:1385(quit) INFO: Quitting.


2021-05-24 00:50:37,711 - mu.settings:169(save) DEBUG: Saving to C:\Users\pc\AppData\Local\python\mu\session.json
2021-05-24 00:50:37,712 - mu.settings:169(save) DEBUG: Saving to C:\Users\pc\AppData\Local\python\mu\venv.json
2021-05-24 00:57:02,456 - root:265(run) INFO:

-----------------

Starting Mu 1.1.0.beta.4
2021-05-24 00:57:02,456 - root:266(run) INFO: uname_result(system='Windows', node='raji', release='8.1', version='6.3.9600', machine='AMD64', processor='Intel64 Family 6 Model 69 Stepping 1, GenuineIntel')
2021-05-24 00:57:02,456 - root:267(run) INFO: Python path: ['C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\python38.zip', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\DLLs', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\setuptools-49.6.0-py3.8.egg', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\pip-20.2.2-py3.8.egg', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\win32', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\win32\\lib', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\Pythonwin', 'C:\\Users\\pc\\AppData\\Local\\Programs\\Mu Editor\\Python\\lib\\site-packages\\IPython\\extensions']
2021-05-24 00:57:02,456 - root:268(run) INFO: Language code: en_US
2021-05-24 00:57:02,456 - mu.settings:220(load) WARNING: No settings file found at C:\Users\pc\AppData\Local\python\mu\settings.json; skipping
2021-05-24 00:57:02,495 - mu.virtual_environment:480(ensure_and_create) INFO: Added log handler.
2021-05-24 00:57:02,781 - mu.virtual_environment:491(ensure_and_create) DEBUG: Checking virtual environment; attempt #1.
2021-05-24 00:57:02,782 - mu.virtual_environment:542(ensure_path) INFO: Virtual Environment found at: C:\Users\pc\AppData\Local\python\mu\mu_venv-38-20210522-211124
2021-05-24 00:57:02,787 - mu.virtual_environment:555(ensure_interpreter) INFO: Interpreter found at: C:\Users\pc\AppData\Local\python\mu\mu_venv-38-20210522-211124\scripts\python.exe
2021-05-24 00:57:03,139 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output: 38
2021-05-24 00:57:03,139 - mu.virtual_environment:585(ensure_interpreter_version) INFO: Both interpreters at version 38
2021-05-24 00:57:03,142 - mu.virtual_environment:611(ensure_pip) INFO: Pip found at: C:\Users\pc\AppData\Local\python\mu\mu_venv-38-20210522-211124\scripts\pip.exe
2021-05-24 00:57:03,142 - mu.virtual_environment:597(ensure_key_modules) DEBUG: Verifying import of: pgzero
2021-05-24 00:57:03,270 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output:
2021-05-24 00:57:03,270 - mu.virtual_environment:597(ensure_key_modules) DEBUG: Verifying import of: flask
2021-05-24 00:57:03,794 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output:
2021-05-24 00:57:03,794 - mu.virtual_environment:597(ensure_key_modules) DEBUG: Verifying import of: qtconsole
2021-05-24 00:57:03,978 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output:
2021-05-24 00:57:03,978 - mu.virtual_environment:597(ensure_key_modules) DEBUG: Verifying import of: esptool
2021-05-24 00:57:04,174 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output:
2021-05-24 00:57:04,174 - mu.virtual_environment:597(ensure_key_modules) DEBUG: Verifying import of: adafruit_board_toolkit
2021-05-24 00:57:04,427 - mu.virtual_environment:379(run_subprocess) DEBUG: Process returned 0; output:
2021-05-24 00:57:04,427 - mu.virtual_environment:496(ensure_and_create) INFO: Valid virtual environment found at C:\Users\pc\AppData\Local\python\mu\mu_venv-38-20210522-211124
2021-05-24 00:57:04,430 - mu.settings:169(save) DEBUG: Saving to C:\Users\pc\AppData\Local\python\mu\venv.json
2021-05-24 00:57:04,432 - mu.virtual_environment:509(ensure_and_create) DEBUG: Emitter: <bound PYQT_SIGNAL display_text of StartupWorker object at 0x000000612DFD5CA0>; Splash Handler; <SplashLogHandler (INFO)>
2021-05-24 00:57:04,545 - mu.logic:758(__init__) INFO: Setting up editor.
2021-05-24 00:57:04,546 - mu.logic:778(__init__) INFO: Log directory: C:\Users\pc\AppData\Local\python\mu\Logs
2021-05-24 00:57:04,546 - mu.logic:779(__init__) INFO: Data directory: C:\Users\pc\AppData\Local\python\mu
2021-05-24 00:57:04,546 - mu.logic:793(setup) INFO: Available modes: python, circuitpython, microbit, esp, web, pyboard, debugger, pygamezero, lego, pico
2021-05-24 00:57:04,546 - mu.modes.base:61(get_default_workspace) INFO: Using workspace C:\Users\pc\mu_code from settings file
2021-05-24 00:57:04,595 - mu.modes.base:61(get_default_workspace) INFO: Using workspace C:\Users\pc\mu_code from settings file
2021-05-24 00:57:04,596 - mu.logic:1521(change_mode) INFO: Workspace directory: C:\Users\pc\mu_code
2021-05-24 00:57:04,596 - mu.logic:867(restore_session) DEBUG: <SessionSettings from C:\Users\pc\AppData\Local\python\mu\session.json>
2021-05-24 00:57:04,603 - mu.logic:978(_load) INFO: Loading script from: E:\blink.py
2021-05-24 00:57:04,612 - mu.logic:316(read_and_decode) DEBUG: Trying to decode with utf-8
2021-05-24 00:57:04,612 - mu.logic:319(read_and_decode) INFO: Decoded with utf-8
2021-05-24 00:57:04,612 - mu.logic:332(read_and_decode) DEBUG: Detected newline '\n'
2021-05-24 00:57:04,612 - mu.logic:1077(_load) DEBUG: # Write your code here :-)
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
#time.sleep(0.5)
#led.value = False
#time.sleep(0.5)

2021-05-24 00:57:04,922 - mu.logic:889(restore_session) INFO: Loaded files.
2021-05-24 00:57:04,922 - mu.logic:892(restore_session) INFO: User defined environment variables: []
2021-05-24 00:57:04,922 - mu.logic:897(restore_session) INFO: Minify scripts on micro:bit? False
2021-05-24 00:57:04,955 - mu.logic:1521(change_mode) INFO: Workspace directory: E:\
2021-05-24 00:59:30,569 - mu.logic:1115(get_dialog_directory) INFO: Using path for file dialog: E:\
2021-05-24 00:59:33,321 - mu.interface.main:405(get_load_path) DEBUG: Getting load path: E:/main.py
2021-05-24 00:59:33,322 - mu.logic:978(_load) INFO: Loading script from: E:/main.py
2021-05-24 00:59:33,335 - mu.logic:316(read_and_decode) DEBUG: Trying to decode with utf-8
2021-05-24 00:59:33,335 - mu.logic:319(read_and_decode) INFO: Decoded with utf-8
2021-05-24 00:59:33,335 - mu.logic:332(read_and_decode) DEBUG: Detected newline '\r\n'
2021-05-24 00:59:33,336 - mu.logic:1077(_load) DEBUG: # Metro IO demo
# Welcome to CircuitPython 2.2.0 :)

import board
import time
import neopixel
from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogIn
import audioio
import touchio
import simpleio

# keyboard support
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

# One pixel connected internally!
dot = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)

# Built in red LED
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT

# Analog audio output on A0, using two audio files
audiofiles = ["rimshot.wav", "laugh.wav"]

# Analog input on A1
analog1in = AnalogIn(board.A1)

# Capacitive touch on A2
touch = touchio.TouchIn(board.A2)

# Digital input with pullup on D2, D3, and D4
buttons = []
for p in [board.D2, board.D3, board.D4]:
button = DigitalInOut(p)
button.direction = Direction.INPUT
button.pull = Pull.UP
buttons.append(button)

# Servo on D5
servo = simpleio.Servo(board.D5)

# NeoPixel strip (of 16 LEDs) connected on D6
NUMPIXELS = 16
neopixels = neopixel.NeoPixel(board.D6, NUMPIXELS, brightness=0.2, auto_write=False)

# Used if we do HID output, see below
kbd = Keyboard()

######################### HELPERS ##############################

# Helper to convert analog input to voltage
def getVoltage(pin):
return (pin.value * 3.3) / 65536

# Helper to give us a nice color swirl
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0):
return [0, 0, 0]
if (pos > 255):
return [0, 0, 0]
if (pos < 85):
return [int(pos * 3), int(255 - (pos*3)), 0]
elif (pos < 170):
pos -= 85
return [int(255 - pos*3), 0, int(pos*3)]
else:
pos -= 170
return [0, int(pos*3), int(255 - pos*3)]

def play_file(filename):
print("")
print("----------------------------------")
print("playing file "+filename)
f = open(filename, "rb")
a = audioio.AudioOut(board.A0, f)
a.play()
while a.playing:
pass
print("finished")
print("----------------------------------")

######################### MAIN LOOP ##############################

i = 0
while True:
# spin internal LED around! autoshow is on
dot[0] = wheel(i & 255)

# also make the neopixels swirl around
for p in range(NUMPIXELS):
idx = int ((p * 256 / NUMPIXELS) + i)
neopixels[p] = wheel(idx & 255)
neopixels.show()

# Read analog voltage on A1
print("A1: %0.2f" % getVoltage(analog1in), end="\t")

# use A2 as capacitive touch to turn on internal LED
print("A2 touch: %d" % touch.raw_value, end="\t")
if touch.value:
print("A2 touched!", end ="\t")
led.value = touch.value

if not buttons[0].value:
print("Button D2 pressed!", end ="\t")
# optional! uncomment below & save to have it sent a keypress
#kbd.press(Keycode.A)
#kbd.release_all()

if not buttons[1].value:
print("Button D3 pressed!", end ="\t")
play_file(audiofiles[0])

if not buttons[2].value:
print("Button D4 pressed!", end ="\t")
play_file(audiofiles[1])

# sweep a servo from 0-180 degrees (map from 0-255)
servo.angle = simpleio.map_range(i, 0, 255, 0, 180)

i = (i+1) % 256 # run from 0 to 255
#time.sleep(0.01) # make bigger to slow down

print("")

2021-05-24 01:06:07,996 - mu.logic:1394(show_admin) INFO: Showing admin with logs from C:\Users\pc\AppData\Local\python\mu\Logs\mu.log
2021-05-24 01:06:07,997 - mu.virtual_environment:788(installed_packages) INFO: Discovering installed third party modules in venv.
2021-05-24 01:06:08,979 - mu.virtual_environment:193(run) DEBUG: Process output: Package Version

---------------------- -------

adafruit-board-toolkit 1.0.1

backcall 0.2.0

bitstring 3.1.7

cffi 1.14.5

click 7.1.2

colorama 0.4.4

BANNED 3.4.7

decorator 5.0.7

ecdsa 0.16.1

esptool 3.0

Flask 1.1.2

ipykernel 5.5.3

ipython 7.22.0

ipython-genutils 0.2.0

itsdangerous 1.1.0

BANNED 0.18.0

Jinja2 2.11.3

jupyter-client 6.1.12

jupyter-core 4.7.1

MarkupSafe 1.1.1

numpy 1.20.2

parso 0.8.2

pgzero 1.2.1

pickleshare 0.7.5

pip 21.1.1

prompt-toolkit 3.0.18

pycparser 2.20

pygame 2.0.1

Pygments 2.8.1

pyserial 3.5

python-dateutil 2.8.1

pywin32 300

pyzmq 22.0.3

qtconsole 4.7.4

QtPy 1.9.0

reedsolo 1.5.4

setuptools 56.0.0

six 1.15.0

tornado 6.1

traitlets 5.0.5

wcwidth 0.2.5

Werkzeug 1.0.1

wheel 0.36.2
2021-05-24 01:06:08,979 - mu.virtual_environment:797(installed_packages) INFO: []









PS: Sorry for posting duplicate topic as I already opened another topic in a different folder.

User avatar
blnkjns
 
Posts: 963
Joined: Fri Oct 02, 2020 3:33 am

Re: Metro M0 Express CircuitPython set up issues

Post by blnkjns »

Please use code-tags around code.

Did you try to double-tap the reset button. Does the board show up as drive then? And does it show up in MU now?

User avatar
infectiousdis
 
Posts: 4
Joined: Mon May 24, 2021 1:46 am

Re: Metro M0 Express CircuitPython set up issues

Post by infectiousdis »

blnkjns wrote:Please use code-tags around code.

Did you try to double-tap the reset button. Does the board show up as drive then? And does it show up in MU now?
When I do the double tap reset, the drive changes from CIRCUITPY to METROBOOT. Nothing else happens, Mu still shows No device connected.

My immediate concern is, how do I ensure that the board I received is working correctly.

User avatar
infectiousdis
 
Posts: 4
Joined: Mon May 24, 2021 1:46 am

Re: Metro M0 Express CircuitPython set up issues

Post by infectiousdis »

Should I manually delete everything in CIRCUITPY and try copying everything again one by one....

User avatar
blnkjns
 
Posts: 963
Joined: Fri Oct 02, 2020 3:33 am

Re: Metro M0 Express CircuitPython set up issues

Post by blnkjns »

You had a Circuit Py drive appearing?
On Metroboot load the circuitpython file again. Just drag it on the Metroboot drive, just that.
Somehow I could not get MU to work myself, but I have succes when using Thonny.
I see this after downloading the U2F straight to Metroboot:
Schermafbeelding 2021-05-24 om 09.50.53.png
Schermafbeelding 2021-05-24 om 09.50.53.png (44.73 KiB) Viewed 368 times
Schermafbeelding 2021-05-24 om 09.52.15.png
Schermafbeelding 2021-05-24 om 09.52.15.png (14.58 KiB) Viewed 368 times

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

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