Follow on from ..."Colon control with 14 segment PED displays"

My recent post on this subject included a Micropython code snippet which I ran successfully on a Plasmestick2040W.. I find that this piece of code no longer runs and Thonny reports " can’t import name plasma2040". In desperation I have tried different .uf2 files but to no avail. Obviously I have done something to bring about this situation but have no idea what; any thoughts?

Are you still running it on a Plasma Stick, or are you trying to run it on something else?
If it is on your plasma stick, and you want to start over, you can do a full reset.
First thing is to back up any code you don’t want to lose, save it to your PC. Then wipe your plasma stick blank. You do this by flashing it with a flash_nuke uf2.
GitHub - Gadgetoid/pico-universal-flash-nuke · GitHub

After that you flash it with the custom pimoorni uf2.

I would go with the plasma_stick_2040_w-v1.1.0-micropython-with-filesystem.uf2. That will get you all the original files that it shiped with from Pimoroni. The included examples make for some good test files, depending on what you have attched.. If they run OK, move on to your code.

Thank you for the replies although I am still stuck. I have tried both versions of the latest .uf2 file (with and without the system content) but always get the same message from Thonny, “can’t import name plasma2040”. It’s almost as if the (module?) plasma2040 doesn’t exist or isn’t where it should be (where is that by the way? Is it within plasma?) I have tried looking in GitHub for a file named plasma2040 but to no avail. (and to think this all started because I couldn’t turn the colon off!)

I think the syntax is just import plasma these days, you don’t need to specify the board any more:

I think I am coming to the end of the road in my search for a solution to my “colon” problem but I thought before I abandon it, I would go back to basics one more time. I am using a plasmatic 2040W connected to a Sparkfun 4 digit alphanumeric display via I2C (the QW/ST connector on the plasmatstick). I am using Thonny 5.0.0 as the development tool. I initially used the

plasma_stick_2040_w-v1.1.0-micropython-with-filesystem

Uf2 file from Pimoroni and created a “fresh” code segment using the information from the HT16K33Segment14 write up by Tony Smith and located at smittytone.net. The code is as below:-

2 from ht16k33 import HT16K33Segment14

3 From machine import I2C

4 DEVICE_I2C_SCL_PIN=5

5 DEVICE_I2C_SDA_PIN=4

6 i2c=I2C(scl=Pin(DEVICE_I2C_SCL_PIN), sda=Pin(DEVICE_I2C_SDA_PIN))

7 #led=HT16K33Segment14(i2c, board=HT16K33Segment14_SPARKFUN_ALPHA)

8 led=HT16K33Segment14(i2c)

9 led.set_colon(True).draw()

10 time.sleep(2)

12 led.set_character(“1”,0).set_character(“2”,1).draw()

13 led.set_character(“3”,2).set_character(“4”,3).draw()

15 led.set_colon(False).draw()

17 time.sleep(10)

19 led.clear()

20 led.draw()

When I run this code in Thonny it reports:

Traceback (most recent call last):

File “”, line 2, in

ImportError: can’t import name HT16K33Segment14

I have tried using the alternative .uf2 file, plasma_stick_2040_w-v1.1.0-micropython and changed the Thonny interpreter from “micropython (RP2040)…..” to “micropython (Raspberry Pi Pico) but to no effect.

I have tried copying the driver files, ht16k33.py and ht16k33segment14.py into a separate directory named “lib” on the RP2040 device space but again to no avail. I have, in desperation, tried many combinations of upper and lower case in the names of the driver files, again without success.

My remaining recourse is to find someone with a time machine as I have definitely had this display device with this controller working in the past, Any offers ??

HT16K33Segment14

versus

ht16k33segment14.py

I think you need to edit HT16K33Segment14 to ht16k33segment14 in your code?

Using the </> Preformated Text option will display your code much better. It retains indents etc.

I would like to thank all those who have attempted to help me with this problem but I think I have reached the end of the road. I have tried the various suggestions made by yourselves and tried to follow those made by Tony Smith but to no avail. I am obviously doing something wrong but with my limited micropython knowledge I simply can’t spot it In the interests of protecting both my head and the adjacent wall I have given up for now. Thank you all again for trying.

I finally have a working display. I simply replaced the original "from’ line with “from ht16k33segment14 import HT16K33Segment14” and this solved the problem (I wish I understood why !) . As a slight aside, in case anyone should want to go down this path, the command to set the character on each digit (led.set_character(“1”,0).set_character(“2”,1).draw()) doesn’t like integers and wants strings so the modified line is:-

led.set_character(str(1),0).set_character(str(2),1).draw().

Flashing colon here I come and thanks again to everyone who has helped me.