#Neradoc 2644 On reset the light flashes

1 messages ยท Page 1 of 1 (latest)

timber berry
#

ok so that's the bootloader followed by the safe mode blink, followed by an exception that happened when it ran the code

#

if you have the CIRCUITPY drive, what is in code.py ?

frosty holly
#

Code.py is the initial program given: # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries

SPDX-License-Identifier: MIT

"""CircuitPython blink example for built-in NeoPixel LED"""
import time
import board
import neopixel

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)

while True:
pixel.fill((0, 255, 0))
time.sleep(0.5)
pixel.fill((0, 0, 0))
time.sleep(0.5)

#

Oh I change the color to green too

timber berry
#

aha did you install the neopixel library ?

frosty holly
#

Oooh, I didn't

#

Good call

timber berry
#

from the bundle's lib directory to the board's lib directory

#

so red blink means error, green means "code finished", yellow means "safe mode" (not executing user code)

#

(every 5 seconds)

#

and if your code is running, it's your code that controls the LED

frosty holly
#

Wait, there are 2 libraries in lib: adafruit_pixelbuf.mpy and neopixel.mpy.

#

Now on pushing the reset button windows wants to repair the CIRCUITPY (:F) drive

timber berry
#

yeah it's better to eject the drive first if you reset

#

usually it's nothing unless it resets while you are saving, like within 1 minute of it, though some software might touch the drive (which you would notice if the code resets for no reason)

#

pixelbuf if not necessary, it's a dependency for some small (flash size) boards, most have it built into Circuitpython now

#

(it doesn't hurt though so it's fine either way)

frosty holly
#

When making a change in Mu I expect it to make the board flash yellow like it's loading something, but that never happens with this QT-PY

timber berry
#

when you save, the code just restarts, it shouldn't flash unless your code does the flashing

frosty holly
#

It looks like my code never runs. No matter what color I program, it continues to double blink red.

timber berry
#

do you have access to the Mu serial console ?

frosty holly
#

Yes, it has nothing on it.

timber berry
#

if you click on it and hit ctrl-C then ctrl-D, what happens ?

frosty holly
#

Nothing happens

timber berry
#

what if you change code.py with that:

while True:
  print("Hello")
frosty holly
#

No serial output

timber berry
#

no just the code I put

#

(also Mu is currently in 1.2.0)

frosty holly
#

oh, still no serial

#

hmm, now there's no lights on...

timber berry
#

maybe that version of Mu doesn't capture the serial correctly ?

frosty holly
#

downloading updated mu...

timber berry
#

also press reset on the board just in case (after ejecting)

frosty holly
#

BTW the Mu loading screen is animated and funny

#

Updated Mu serial is working. It's repeating Hello ๐Ÿ˜„

timber berry
#

ok, now back to the original code and see if it complains

frosty holly
#

Look at that, the program calls for green but the board double blinks red.

#

and there is no serial output

timber berry
#

the serial output, ctrl-C ctrl-D

#

ctrl-C should get you the REPL prompt >>>

#

and ctrl-D restart the code

frosty holly
#

The serial window still shows the repeated hellos

timber berry
#

can you hit ctrl-C there ?

frosty holly
#

I can, but nothing changes

timber berry
#

I had the hellos print a little fast, it might make the serial unresponsive, just make sure that code.py does not contain that loop again and restart Mu maybe

#

(I would normally add a sleep, but that was just a quick test for the serial console)

frosty holly
#

Restarted Mu, Serial shows: Traceback (most recent call last):
File "code.py", line 6, in <module>
MpyError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.

Code done running.

timber berry
#

AHA !

frosty holly
#

Bad library?

timber berry
#

progress !

#

so make sure to delete the libraries and install the correct files from the bundle

frosty holly
#

I deleted the libraries in the CIRCUITPY (F:) lib folder but I don't know how to install the correct files or where the bundle is.

timber berry
frosty holly
#

Thank you so much @timber berry ๐Ÿ’

#

The second I put the new library in the board's lib folder, it blinks the right color! YAY!