Got it into “uf2” mode by pressing the switches :-)
I see how that works.
Downloaded: “adafruit-circuitpython-pimoroni_tiny2040-en_GB-7.3.0.uf2” and copied to drive.
LED off. Solid off and then sometimes doing “2 red flashes”.
Copied Tony Goodhews’ variant of light flasher. Still no joy.
My “Lib” directory is empty, but I looked for libraries and did not find anything specific for Tiny 2040.
Using Mu1.1.1, using the “Check” facility there are lots of errors mostly:
“At least 2 spaces before online comment”, applied to lines with rpwm.
So I think (guess) it’s a missing library problem, but which libraries to use and where to get them (looked on Adafruit and it’s not clear to me) :-)
That looks like MicroPython code that you’re trying to run there - try this CircuitPython code! It uses the pwmio library, but I think that should come built into to your CircuitPython image.
It is CircuitPython, and from what I have read that is what I expect, it certainly does not report any missing libraries. Mu Check clears the code too.
Tried that, results in setting up as “UF Drive” and Tiny not being visible as a USB Drive.
Also tried “pimoroni-tiny2040-v1.18.7-micropython.uf2”. Same.
In this example GPIO 18 (red) is setup as an output, but then the loop is controlling GPIO 20 (blue), though since GPIO 20 wasn’t setup as an output it might be treated as a “no-op”.
Edit: some more stuff I thought of
Also python uses indention for scope, so if the code after the “while 1” is not indented (3 or 4 spaces) then it will be outside the scope of the loop.
And the pins for the LED are active low so driving the pin low turns it on, and vice-versa
With Circuit Python you should see a “CIRCUITPY” drive in file explorer.
With Micro Python it will only show up as PI-RP2 when in boot mode.
On the TINY 2040 its an RGB LED which is tied to
GPO 18 Red
GPO 19 Green
GPO 20 Blue
Putting a ground / low on the GPO pin will turn on that color LED on.
It doesn’t work the same way it does on a Pi PICO. tiny2040.sch (shopify.com)
If you use PWM you can control the brightness and get just about any color you want.
Tony’s file should work with Pimoroni’s Micro Python file. It uses PWM to do the magic.
rpwm = PWM(Pin(18)) # RED
gpwm = PWM(Pin(19)) # GREEN
bpwm = PWM(Pin(20)) # BLUE
Yes I was trying out all pins 18,19 and 20 the paste is from during a change.
Indentation lost due to copy and paste.
Yes. I tried Tony’s file “exactly”. That did the same.
The code (certainly Tony’s should be functional).
So. Let’s try something else…
print(“Hello from Mu”)
MU has a serial console. But I cannot see the printout.
Now. We have a green flash every 5 seconds.
OK. So. First thing. Am I loading the correct UF2 file?
These are my options:
“adafruit-circuitpython-pimoroni_tiny2040-en_GB-7.3.0.uf2” (Source Adafruit) [Seen as a USB drive]
“pimoroni-pico-v1.18.7-micropython.uf2” (Source Adafruit). [Not seen as a USB drive]
“pimoroni-tiny2040-v1.18.7-micropython.uf2” (Source Pimoroni) [Not Seen as a USB drive]
OR
Is there a better on?
The LED lit up right after I flashed it, to a light green.
Thonny shows it as “MicroPython v1.18 on 2022-05-16; Pimoroni Tiny 2040 with RP2040”
Interpreter is set to “MicroPython(Rasberry Pi PICO)”
It’s not seen as a USB storage device, which is normal in Micro Python.
Running Tony’s file gets me
white
red
green
blue
flashing blue
and then green that fades to black.
Something like that anyway, it happens quickly.
Circuit Python or Micro Python? It makes a difference code wise. Micro Python code will fail on Circuit Python and vise versa.
Plus, the Pimoroni Micro Python uf2 file has extra libraries in it for other Pimoroni Pico addons.
The “pimoroni-pico-v1.18.7-micropython.uf2” is for the 2mb Tiny2040.
And the “pimoroni-tiny2040-v1.18.7-micropython.uf2” is for the 8mb Tiny2049.
Just a FYI post.