#circuitpython-dev

1 messages Β· Page 127 of 1

solar atlas
#

Ahh, sorry. you refereed me to that & I tried short cutting & that's how I ended up on that page.

#

I have no clue what pip is.

tidal kiln
#

it's an installer for python stuff

#

you may already have it if you've installed python, so just give it a try

#

the 3 just means python 3

solar atlas
#

I'm guessing that I don't cuz my PC didn't know what to do with the mu-editor-1.0.0b12.tar.gz file.

tidal kiln
#

hmmm. but it got that somehow?

solar atlas
#

it got what?

tidal kiln
#

what do you get from:

pip3 -V
opaque patrol
#

I wasn't able to get the mu-editor to see the circuit playground express on windows 10, but that was a week or two ago.

solar atlas
#

pip being the installer that u mentioned, 3 from the ver of Python (mind u those I only know cuz u said them) & the other I don't have a clue

tidal kiln
#

yeah, you need the 3 because there's also just pip which is typically the Python 2 version

#

Python 2 and Python 3 are different things (sadly)

#

so you need to make sure to run the Python 3 version of pip

#

this simple command:

pip3 -V
solar atlas
#

I thought that python 3 was still in beta?

#

Where do I enter that command?

stuck elbow
#

Python 3 is the default, in fact, Python 2 is not supported anymore.

#

Since some 2 years.

tidal kiln
stuck elbow
#

Yeah, that's the security updates and stuff.

#

But no new development is happening since a while.

solar atlas
#

ok, how do I get python 3 & how do I get my PC to install mu-editor-1.0.0b12.tar.gz file.

tidal kiln
#

@solar atlas do you know how to bring up a command window?

solar atlas
#

yup got it

tidal kiln
#

ok, now try just typing that simple command: pip3 -V

solar atlas
#

not a reconised command

tidal kiln
#

ok, so it's not installed

#

it's a different approach, installing putty. have you tried that already?

#

@solar atlas how did you get the file mu-editor-1.0.0b12.tar.gz ?

solar atlas
#

Ya I was just looking at that but would like to get MU working if possible. It''l be much easier for my daughter to work with & learn with then that way

#

From a link in the link that u sent me.

#

I clicked download & it bounced me down to the bottom of hte page where that file was listed.

manic glacierBOT
tidal kiln
#

ok. see it. yah, that file is not going to be useful for you.

manic glacierBOT
solar atlas
#

can I just search for python 3? Like I first did with the Mu.

tidal kiln
#

think so. was checking that. looks like pip comes with python3 these days.

solar atlas
#

Cool, & it looks like python has uped again. it says to download 3.0.1 now.

tidal kiln
#

if that's a python version, it's pretty old

#

download the Windows x86-64 executable installer

solar atlas
#

Ok, I was wondering about that cuz it said that that ver was relieced on '09

tidal kiln
#

current relase is 3.6.3

solar atlas
#

ok, I found 3.6.3 on the downloads page.

tidal kiln
#

ok. should be able to just download and run the executable installer

solar atlas
#

yup it's installing now.

#

ridiculously slowly...

#

Lol, there we go now the bar is moving.

tidal kiln
#

ok. and just to be clear, what you're installing is not circuitpython. it's the full on big sister python.

#

you'll be able to go to the command prompt and do:

python3

to run it (if you want)

#

and for windows it might install some shortcuts and stuff also

#

but at this point all we care about is pip

solar atlas
#

ya I figfured that that is what it was, the full enchalada. And that's fine just so I'll be able to finally get that ver of Mu to work including the REPL.

tidal kiln
#

well, hopefully. it is still beta.

slender iron
#

@solar atlas mu is very beta still so we can't promise REPL will work now

tidal kiln
#

@unique turret there's probably a more pythonic way, but this'll work:

def get_stuff(temperature):
    n = 0
    color = 0
    if temperature > 70:
        n = 1
        color = cyan
    if temperature > 80:
        n = 2
        color = blue
    #
    # etc
    #
    return (n, color)
solar atlas
#

But that was the whole reason for going through all of this. @slender iron . Do you know how to get Mu to change what board it looks for? I installed Mu, but it keeps looking for a micro bit & I am using a CPX.

tidal kiln
#

i think only the beta has CPX at this point

solar atlas
#

ok, even still, what else do I have to do to get the Beta ver of Mu to work?

tidal kiln
#

once pip3 is installed, just use that to install it

#

is your download still going?

solar atlas
#

Nope dwnld is done.

tidal kiln
#

ok. run what got downloaded.

#

should install python3 (and pip3 along with it)

solar atlas
#

ok, what was that comand again?

#

ok forget it, I found it.

#

k did that said that it's not defind

opaque patrol
#

pip runs from the command line.

tidal kiln
#

^^ that

#

@solar atlas don't run python

opaque patrol
#

type quit() to exit the repl (you know this by the >>> ) then enter the pip command at the C:> prompt

solar atlas
#

Oops that's were I first tried entering that cmd, was in the python cmd promt, but I just put it in the reg cmd & it looks like it ran ok.

tidal kiln
#

ok, now do:

pip3 install mu-editor
solar atlas
#

It's done but it posted a bunch of stuff in red:

tidal kiln
#

☹

#

what's sudo for win10?

slender iron
#

I have no idea

#

@plucky flint might know

#

(he's mu's creator)

tidal kiln
#

there's like a "run as admin" in the context menu

slender iron
#

but in the UK

solar atlas
#

Google says
There is no sudo command in Windows. The nearest equivalent is "run as administrator." You can do this using the runas command with an administrator trust-level, or by right-clicking the program in the UI and choosing "run as administrator."Mar 11, 2012
How to run 'sudo' command in windows - Stack Overflow
https://stackoverflow.com/questions/9652720/how-to-run-sudo-command-in-windows

tidal kiln
#

yep

solar atlas
#

lol, sry the Nube tossed in his 2 cents. πŸ˜›

tidal kiln
#

@solar atlas i think that's the answer. do you know to do that?

solar atlas
#

O bollex. I forgot about running the cmd in Admin.

#

Hmm not sure how to do that in Win 10

tidal kiln
#

if you can open the cmd window via that approach, then just run the command again

#

oh

#

unfortunately i'm not sure either...

#

how did you bring up the command window currently?

opaque patrol
#

My circuit playground express is showing up as USB Drive in windows, is this a bug or is it windows?

solar atlas
#

right click select 'RUN'

#

I googled it but the instructions that google returned dnt make sense for Win 10

slender iron
#

@opaque patrol its intentional. whats the name of the drive?

opaque patrol
#

D drive

slender iron
#

ah, not CIRCUITPY or CPLAYBOOT?

opaque patrol
#

I think the mu-editor is looking for CIRCUITPY, but it can't find my Metro M0 or trinket m0 either

solar atlas
#

Is "Power shell the name for CMD promt?

slender iron
#

I'm not a windows user so I can't help you

tulip sleet
#

powershell is an enhanced version of CMD, sort of

tidal kiln
#

maybe. that used to be a different shell with more commands.

tulip sleet
#

you can run most CMD commands in powershell

opaque patrol
#

@solar atlas One way to run the cmd on windows 10 is to right-click in the task bar and open task manager, then on the task manager click File > Run new task

#

@slender iron I was just asking because I think mu is looking for that drive name, but I am still looking at their code to make sure

slender iron
#

yeah, I'm not sure about it either

tidal kiln
#

@solar atlas can you get a "Run as administrator" to show up if you right click on the cmd prompt shortcut in the start menu?

solar atlas
#

ok, ya I was just googling it & it said that it is basically the same just not as good. as the classic CMD

slender iron
solar atlas
#

I found it.
Search CMD then instead of just hitting "Enter" hit"CTL +SHIFT + ENTER" It'll ask if that's what to do hit yes & ur running as admin.

tidal kiln
#

neat

solar atlas
#

I'm down right surprised. Goes to show doesn't matter what you go through, even years of Mini strokes, you can retrain & relearn & regain what you thought you had long sense lost. πŸ˜ƒ πŸ˜„

#

Ok, I think it finished.

manic glacierBOT
tidal kiln
#

looks better

solar atlas
#

Cool. what's next?

tidal kiln
#

run it. did it add it to the start menu? or shortcut on desktop?

opaque patrol
#

run it from the CMD with just mu

solar atlas
#

Nope nothing new on the desktop & nothing new in the start menu. Does that mean that it didn't work?

tidal kiln
#

nope.

#

try what @opaque patrol suggested

solar atlas
#

What CMD do I put in to run it?

opaque patrol
#

I am having trouble getting it to work though

#

mu

#

@solar atlas mu

tidal kiln
#

same way you ran pip

solar atlas
#

just type "mu" in the admin cmd? ok

tidal kiln
#

that, or hopefully don't need admin privs at this point

#

so maybe try it from a non admin command window

solar atlas
#

IT LIVES!!!!!

opaque patrol
#

When I run mu, there are no "Ok" | "Cancel" buttons on the selection dialog, but I was able to modify the settings.json file manually to use Adafruit

solar atlas
#

Lol, ok, I select Adafruit python right?

opaque patrol
#

But it still seems confused on whether there is a device connected

tidal kiln
#

@solar atlas yes

#

@opaque patrol what os are you on?

opaque patrol
#

Windows 10

tidal kiln
#

can you post a screen cap of that?

#

@solar atlas do you get the buttons?

solar atlas
#

Yup it works now. well looks like its all good. I'm going to try it with a cpx now

opaque patrol
#

But if you go to C:\Users\David\AppData\Local\python\mu (replace David with your User name) you can edit the settings.json file

solar atlas
#

See mine had the button at the bottom.

tidal kiln
#

@opaque patrol thanks. i'll pass that on to the mu author. did you do anything non-standard during the install?

slender iron
#

@opaque patrol @timber lion saw a similar problem

tidal kiln
#

@solar atlas sounds like you don't have the ui issue. so see if you can get the REPL to work.

opaque patrol
#

No, but I might have installed PyQt before... Qt is notorious for conflicting with itself

tidal kiln
#

@slender iron yeah, i'm on that thread. i'll add that screen shot to the discussion.

#

@opaque patrol that's very much likely what the issue is

opaque patrol
#

Which thread? I am looking at the mu code now

tidal kiln
#

@opaque patrol internal email πŸ˜ƒ

opaque patrol
#

@tidal kiln Okay, I uninstalled everything that looked Qt related in pip and I am reinstalling the mu-editor now.

tidal kiln
#

cool. any info you can come up with for 'why it broke' or even 'what got it working again' would be useful.

opaque patrol
#

I am curious if it is working for @solar atlas

#

Okay, I got the buttons, but still can't do anything in the repl

tidal kiln
#

so it was just a qt thing?

solar atlas
#

Not really working well. I'm having a hard time getting Mu to up load & show anything in REPL.

#

I also tried pinning Mu to the task bar & that didn't work either even though it showed that it was until I closed Mu & there wasn't any button for it in my task bar.

opaque patrol
#

I changed code.py to Blinky and saved and it works that way

#

@solar atlas You really should try using putty or tera term, you can still use mu for an editor

tidal kiln
#

@slender iron do you know status of mu beta on win10? sounds like there's been discussion here about it.

slender iron
#

not really

opaque patrol
#

Hey, It works now.

#

@solar atlas Try closing mu-editor, then press the reset button ONE time to reset the cpx, then restart mu

#

I had an extra step of connecting to the com port with tera term but hopefully that won't be needed

solar atlas
#

Ya it looks like I'm going to have to use one of them @opaque patrol , I can't even get Mu to upload a program to the CPX let alone use the REPL.

opaque patrol
#
  "theme": "contrast",
  "mode": "adafruit",
  "paths": [
    "D:/code.py"
  ],
  "workspace": "D:\\",
  "microbit_runtime_hex": null
}```
#

these are the settings mu is using, you could try ensuring the workspace dir is correct for you. If you click Load, does it open to the correct directory?

solar atlas
#

Wow, nice what all that @opaque patrol ?

#

Yup it looks like its going to the right place.

tidal kiln
#

@solar atlas what's code.py look like?

solar atlas
#

THe program that I have in there right now?
from adafruit_circuitplayground.express import cpx

cpx.pixels[0] = ((0, 0, 3))
cpx.pixels[5] = ((3, 0, 0))

opaque patrol
solar atlas
#

Trying to keep it simple but it still didn't work.

#

nice

tidal kiln
#

@solar atlas what do you mean by not working?

solar atlas
#

I try & save or upload to the CPX & it doesn't work.

tidal kiln
#

does it act like saves ok?

solar atlas
#

to the CPX? nope not at all.

tidal kiln
#

do you get an error message of any kind?

solar atlas
#

nope.

tidal kiln
#

so if you change the code, try to save the changes, it does nothing and the changes get lost?

solar atlas
#

program does show anything, any issue but yet the CPX doesn't change at all.

#

I even closed Mu reset the CPX & tried again to no evail.

opaque patrol
#

@solar atlas Are you able to load code.py?

solar whale
#

@tulip sleet First test of SPI Flash on M4 Express working well!

solar atlas
#

Strange thing also, The only way that I can open Mu is by thru a CMD promt, but then after I open Mu, if I close the cmd window Mu closes too.

opaque patrol
#

That is because mu is a child process of the cmd window

solar atlas
#

I'm able to upload to the CPX thru other programs like Atom, but just not Mu.

tidal kiln
#

@solar atlas try changing your code.py to the following:

from adafruit_circuitplayground.express import cpx
cpx.pixels.fill((255,0,0))
solar atlas
#

That's weird! Ya that worked perfectly.

tidal kiln
#

now change the color value and save again

#

do the neopixels change accordingly?

solar atlas
#

That other code worked before with no problem being sent from Atom, but then didn't from Mu.

solar whale
#

@slender iron testing with the "py" bundle on M4 - looks good! Thanks!

solar atlas
#

Yup, again worked perfectly

opaque patrol
#

Do you still have it open in Atom?

slender iron
#

@solar whale great!

tidal kiln
#

@solar atlas ok, now change it back to your original code and see what happens

solar atlas
#

Nope closed atom a long time ago.

#

back when we were getting Mu to work.

#

again worked perfectly.

tidal kiln
#

cool. not sure what original problem was. something was just wrapped around the axel.

#

but now basic editting and saving works

solar atlas
#

Any idea why
from adafruit_circuitplayground.express import cpx

cpx.pixels[0] = ((0, 0, 3))
cpx.pixels[5] = ((3, 0, 0))

wont work anymore?

opaque patrol
#

this is the path to mu.exe C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36\Scripts

tidal kiln
#

oh. thought you just said it did?

opaque patrol
#

you can create a shortcut to it to run it directly

solar atlas
#

O, na I thought u ment change it back to the orriganal code that u sent

#

The all red one

tidal kiln
#

try your code again

#

i just did and it worked for me

opaque patrol
#

You could try deleting code.py from the drive and see if mu will create one

solar atlas
#

this

from adafruit_circuitplayground.express import cpx

cpx.pixels.fill((0, 0, 3))

But yet This

from adafruit_circuitplayground.express import cpx

while True:
if cpx.switch:
print("Slide switch off!")
else:
print("Slide switch on!")

Didn't work. Or at least isn't showing anything in the REPL.

opaque patrol
#

are you able to use the repl? It might need to reload (CTRL-D)

tidal kiln
#

@solar atlas you have the repl window open? at the bottom of the editor?

opaque patrol
#

If you click in the repl and hit CTRL-C, then any key, do you see a >>>

solar atlas
#

Yup

tidal kiln
#

what are all those code.py tabs open to?

solar atlas
#

nope nothing happens

opaque patrol
#

close all the extra code.py tabs.....maybe close all of them and re-open the file

solar atlas
#

@tidal kiln all of the various programs that I've been trying on the CPX that I've been saying ya or na if they work.

tidal kiln
#

but which is one is current? there can be only one

#

:highlander_emoji:

solar atlas
#

The last one that I just showed. The one that is supposed to be printing to the REPL

tidal kiln
#

yah. close them all and repopen it.

#

not sure which one it thinks is the real one

opaque patrol
#

It won't let me open the file more than once

solar atlas
#

K, closed all of them, closed Mu, & reset the CPX. Now restarting Mu.

tidal kiln
#

k. then open code.py and see what's there.

#

the code works, at least

solar atlas
#

O sure now it work. πŸ˜›

tidal kiln
#

something about all those tabs being opened then

#

there are known issues with various OS's doing delayed writes

#

mu is trying to fix that

#

but not sure what it was doing with those multiple tabs

solar atlas
#

Wait a minute! I didn't have repl open when I took that pic & then when I opened the repl it didn't show anything.

#

I swear this thing is messing with me. EEERRGGGG>>>

#

lol

tidal kiln
#

try this, change code.py back to this:

from adafruit_circuitplayground.express import cpx
cpx.pixels.fill((0,0,3))
#

save and verify that you get blue pixels

opaque patrol
#

@solar atlas mu is really finicky....I was able to break the repl on mine again and had trouble getting it to work again

solar atlas
#

Finicky is an under statement. I'd say spoiled & possed.

#

Ya that code works fine @tidal kiln

tidal kiln
#

ok. with that running, post a screen shot of mu

solar atlas
opaque patrol
#

click down in the repl and see if you can do anything....try CTRL-C

tidal kiln
#

^^ that

#

although it doesn't look happy ☹

opaque patrol
#

If that doesn't work, click on the Adafruit by the gear in the lower right corner and select python

solar atlas
#

nope still nothing

opaque patrol
#

and Click ok, the repl window will close and you will need to re open it, does it come up with Jupyter QtConsole? Takes a few seconds

solar atlas
#

ok report sent.

#

nope repl stayed open & nothing else came up. n sry first thought that what came up was a bug report and not just a log.

opaque patrol
#

This will open the dialog where you can select which mode (Python, Microbit or Adafruit)

#

Try changing it to Python to see if the Jupyter repl works and then change it back to Adafruit

solar atlas
#

ok ya the menu to select what ur connecting with right? ya that came up.

solar whale
#

@meager fog tried new mu updates - from ntoll repo - (has your updates included) - My linux box now recognizes my Trinket M0! Nice! Just curious - I don't see any M4's in the new list - are they just waiting for official release? At least on my linux box, attempt to REPL to Metro M4_express fails. No hurry on this, just wanted to make sure i was expected.

opaque patrol
#

@solar atlas right, try selecting the Python3 option at the bottom and clicking ok, then give a few seconds and open the repl

solar atlas
#

ok gotcha

#

yup it opened

opaque patrol
#

Okay, now try switching it back to adafruit and see if the repl reconnects

solar whale
#

@meager fog I reread your updates and see you were refering only to CP 2.1 for mu so it makes sense m4's are not included. Sorry if I jumped the gun. Thanks for the updates.

opaque patrol
#

I gotta run and pick up the wife, I should be back in 15 minutes, I think the com connection is getting stuck open and when you try to open the repl it can't reconnect. If it isn't working yet, try closing mu and resetting the cpx and maybe unplugging it and plugging back in before you restart mu again

solar atlas
#

ok,

tulip sleet
#

@slender iron I'm satisfied now, understanding what's up with the SPI clock rates. Going back to busio and pulseio. Maybe uart next.

slender iron
#

@tulip sleet awesome! good sleuthing

tulip sleet
#

I'm kinda surprised the granularity of SPI clock rates is so jumpy, but I guess for many applications it doesn't matter.

idle owl
#

@solar atlas The issue @opaque patrol suggested seems likely. I know even running the REPL from terminal (cmd) in MacOS I run into issues where it stays open and then can't reconnect. I have to reset the CPX to get it to play nice again.

opaque patrol
#

I am able to break it though. If I reset the cpx while open in mu, it locks me out. I am looking for a way to fix it that doesn't require connecting with putty or tera term...

solar whale
#

@opaque patrol FYI - I just tried resetting CPX while in Mu (on linux) and it recovered if I exited REPL and reentered on MU - that is click on REPL to exit - click again to reenter.

opaque patrol
#

@solar whale Not sure if you want to try this, but what happens if you have mu-editor open with repl open and press the reset button on the cpx?

idle owl
#

@slender iron Have a good evening!

solar whale
#

ah - mu editor is dead πŸ˜‰

#

nevermind - just a hidden window!!

#

@opaque patrol it seems OK - it was confusing because it opened a window to select a file for load but it was hidden behind active window and would not respond unitl I brought it forward.

#

also hlep to use the correct keyboard πŸ˜‰

#

@opaque patrol I have to exit REPL and Reneter REPL but then it is OK - open file seems happy. If I try to re-open it - it tells me it is already open.

solar atlas
#

sry for disappearing. Mia needed me.

idle owl
#

@solar atlas Excellent reason

opaque patrol
#

It locks me out completely on windows, If I reset the cpx while mu repl is open....I couldn't do anything through tera term or putty, it took disconnecting the cpx and resetting it a couple times before I was able to get it to respond. I am not sure if that was the fix or maybe the original connection in mu timed out

solar whale
#

If MU has REPL tehn on linux I cannot use screen to connect. Only one program can have the device at at time

solar atlas
#

I give up. I can't seam to get this thing to work.

#

Thanks @idle owl

opaque patrol
#

right, but it appears that the connection is getting held open when the reset occurs

solar whale
#

It also has the annoying habit of switching the comm port on linux between ttyACMO an ttyACM1

idle owl
#

@solar atlas It's very new and still in beta. Sorry we couldn't get it sorted.

solar whale
#

but taht is not mu - always happens when resetting M0 boards

opaque patrol
#

@solar atlas You could try restarting the computer.... you may also want to try running the pip command again to install mu-editor only with the --upgrade option to ensure all the packages it is using are up to date.

solar atlas
#

That's ok, I have no doubt that you guys will get it all sorted out. πŸ˜ƒ

#

I'm going to try the next code in ur guild & see how that one behaves in it.

opaque patrol
#

@solar whale it I reset it with putty, It closes the connection and I have to restart putty, on tera term it picks it back up seamlessly. But mu seems to be locking it and it stays that way for a minute or so

idle owl
#

@solar atlas Once you get Putty setup and the config saved, it's opening another program next to Atom, and running it. It's an extra step, but if you take a screenshot or write it down, Mia will get it memorised in a few tries I'm sure. I'm happy to help you though setting it up if you'd like to give it a try.

solar whale
#

@opaque patrol I am very new to mu - so just poking at it. There was an update today that made it recognize some devices I could not use before. Not sure if updating would help. I am using 1.0.0beta.12

solar atlas
#

with this code:

from adafruit_circuitplayground.express import cpx
 
cpx.play_tone(440, 1)

isnt that supposed to just randomly play a tone without touching anything?

idle owl
#

Yes, for 1 second, the first time the code runs.

solar atlas
#

Hmm, no luck.

idle owl
#

Hmm. You had it going yesterday right? Is Mu still open?

solar whale
#

works for me...

idle owl
#

Because there is a state the REPL can be in that will not run code.

opaque patrol
#

@solar whale same here, I haven't really used it before today. I wasn't able to get it to work

idle owl
#

So if the REPL is stuck in that state, your code will not automatically run.

#

So if Mu is causing issues with the REPL, it could be interfering with code running as well.

solar whale
#

sorry - I just typed into REPL - not code.py

opaque patrol
#

@idle owl I can edit code.py and it picks up the save no problem. I just can't connect to repl

idle owl
#

@opaque patrol And that's how it should work but I'm wondering if it's part of the issue @solar atlas is having.

opaque patrol
#

@idle owl I think it is related.

idle owl
#

I'm wondering if the REPL is connecting weird, or enteriing the >>> REPL state and not exiting it when you exit the REPL in Mu.

solar whale
#

I just put that into code.py (in mu) then saved and did soft reboot in REPL and it played the tone

idle owl
#

My thought is that the REPL failure in Mu is interfering with code running on Dao's CPX.

#

I'm guessing though.

opaque patrol
#

it shouldn't interfere with the code running, but if there is an error then it is hard to tell without the repl, I know the led blinks can give error information, but that isn't easy

idle owl
#

Right

solar whale
#

also now presing RESET button play tone. @idle owl I agree - sounds like the REPL issues and save issues are related

idle owl
#

That's what it should do on reset with that code, yeah

#

Oh! I built the new M4 build and forgot about it in looking into this, lol. Time to test!

solar whale
#

@idle owl good luck - make sure you have a complet e copy of your FS first !

idle owl
#

Complete, huh.... I just grabbed the files. Oops!

#

Worked though!

solar atlas
#

I open code witer & uploaded the codes, still didn't work until I closed Mu, the codes worked like a charm.

solar whale
#

@idle owl no worries - latest bundle works fine! also I tried the "py" bundle - also works fine.

idle owl
#

Just added the files back and my rainbow is off and running again. @solar whale Awesome good to know!

#

@solar atlas Yeah, I think the REPL issues in Mu are causing issues with running your code.

solar whale
#

nice to have some room to play!

solar atlas
#

Makes sense @idle owl

#

How do I get one of the other programs that will let us see the repl?

idle owl
#

@solar atlas Ok! Let's do it πŸ˜ƒ

#

I'll grab the link again and then help you through it

solar atlas
#

I know u said I'd be better off using one of those like 8 hours ago, but what can I say, I'm stubburn.

idle owl
#

No, Mu would have been much better! It made a lot of sense to try

solar atlas
#

He, He, he, he,

idle owl
#

This will involve a little bit of a learning curve, and the more steps we add, the less appealing it becomes. Like I said, though, it's just a matter of it becoming a habit to add to your routine with CircuitPython

opaque patrol
#

mu is still in beta,

idle owl
#

Exactly!

#

Early testing always involves finding issues

#

@solar atlas You will not need the drivers first mentioned in that section as you are on Windows 10

solar atlas
#

O ya absolutely. you guys shld have heard of all of the bugs they had to work out to get Quixtar web sight up & running. Like I said, I have no doubt you guys got the skillz to get it runnin smooth as silk.

#

whr shld I start? Determine Your Serial Port?

idle owl
#

We're all helping by finding issues but it's @plucky flint who has the skills. He designed and wrote it.

#

@solar atlas Yes

solar atlas
#

Dnt think I've talked with him yet.

solar whale
#

@opaque patrol perhaps alpha+

idle owl
#

@solar atlas Probably not, he's in a much different timezone than us and he's been busy with writing both a book and the new editor.

solar atlas
#

ok, found the port easy enough, it's not named anything specific, just com 8 but it's the only one there so.

idle owl
#

COM8 is what Putty will want then.

#

Mine is called USB Serial Device

solar whale
#

@idle owl @solar atlas @opaque patrol I ddi not mean to be negative at all regarding mu - it is a great tool and has come a long way very quickly due to the efforts of @plucky flint -- the beta release is really nice.

solar atlas
#

This stuff that I'm doing, will all of this have to done everytime? or am I able to do some stuff once only?

idle owl
#

Some of it once, some of it possibly each time

solar atlas
#

The everytime stuff, is it easy enough that Mia will be able to do too?

idle owl
#

I would say so, she seems quite gifted. It'll just be a matter of following a couple of steps.

solar atlas
#

I didn't think u were bashing it @solar whale , you were just commenting. No worries. πŸ˜ƒ

#

ok cool. Thanks @idle owl

idle owl
#

You can save the configuration in Putty so she can click on it, but if the port changes, she'll need to know how to find it.

#

I just checked to make sure it's loadable in a way that can be changed before opening it, and it is.

solar atlas
#

I'll brb tho. I is a wantn me some lemonade. lol

#

ok cool, finding a port isn't too difficult.

opaque patrol
#

If you can get it to work in Putty, then you can go and try mu again... that seems to make it work for me

solar atlas
#

Nice ok @opaque patrol

opaque patrol
#

@solar atlas close putty first though

jovial steppe
#

I had trouble getting putty to talk to my Metro M0 Express's REPL. I switched to Tera Term and it worked immediately.

#

It's even smart enough to find the COM port for you.

#

Or it's magic.

#

Or it's the wine.

idle owl
#

@solar whale I figured the alpha comment was related to the fact that he might still add features. As that was drilled into me as the difference between alpha and beta is that beta has all the features, and is just testing πŸ˜„

#

@jovial steppe All good options.

solar whale
#

@idle owl I have to admit, I have never tried editing a code.py in "real time" like this - I have been just playing with changing the tone - it is fun! I'm easy to entertain πŸ˜‰

idle owl
#

@solar whale That's great! Fun on all counts. And think about what I went through! I wrote the project! Just stopping in the middle of doing other things to play a bunch of notes for no reason because it was sitting there...

solar whale
#

good night all!

idle owl
#

@solar whale Have a good one!

tulip sleet
#

@slender iron I tried terminus on Windows. No serial (COM) support that I could see! Maybe there's a plugin somewhere. Pretty heavy-weight.

hollow tartan
#

@idle owl Please could you tell me how to run a .py repeatedly with no internal loop_forever and without doing a soft-reset, Ctrl-D ```>>> import piezo_music

#finished

solar atlas
#

That didn't seam to be too bad. πŸ˜ƒ

idle owl
#

@solar atlas Awesome!

#

@hollow tartan So you don't want a while True: in your code?

hollow tartan
#

@idle owl no,, just to rerun the same .py

idle owl
#

I don't know then. I don't think I've ever tried.

tulip sleet
#

@hollow tartan there's no easy way; you'd think you could re-import it, but import doesn't work that way

hollow tartan
#

I try and it just returns the REPL prompt but does not DO anything. @brave cipher yes, I assumed it would allow a reimport. is the a GOTO top instruction?

#

in REPL

#

So it I import a different little .py with a different name , it will run it okay?

tulip sleet
#

once something is imported, Python knows it and won't bother to re-import

hollow tartan
#

then there must be an un-import instruction?

#

Ctrl -D πŸ˜ƒ

solar atlas
#

Ok? I put Putty on and now Code Writer doesn't wont save my code.py file

tulip sleet
#

well, sorta. I'm poking around in the micropython forum. You might try this:

def reload(mod):
    import sys
    z = __import__(mod)
    del z
    del sys.modules[mod]
    return __import__(mod)

Don't know whether it works in circuitpython.

>>> import foo
hello world
>>> reload('foo')
hello world
idle owl
#

@solar atlas Oi... It should. Maybe try restarting the connections again to start fresh after dealing with everything else before. You should be able to start Putty, and then edit away.

tulip sleet
#

where foo.py contains print("hello world")

solar atlas
#

Do I edit in putty too? or is that just for the repl?

hollow tartan
#

thanks @tulip sleet and @idle owl

idle owl
#

@solar atlas Nope, Putty just runs the streaming serial REPL.

solar atlas
#

ok

idle owl
#

You'll edit in a separate editor.

solar atlas
#

wasn't sure if that I was editing in another program was the problem.

idle owl
#

Nope πŸ˜ƒ

solar atlas
tulip sleet
#

@hollow tartan reload works! At least for my simple example. If you create i/o objects and such, then you may get in trouble, since the pins will be assigned, etc. There a ctrl-D makes more sense

idle owl
#

@solar atlas Hmm. I've never used Code Writer, but I don't think using Code Writer is the issue.

#

@solar atlas Also that code is missing the import, but that's not relevant yet if you can't even save it.

solar atlas
#

I'm trying to find Atom to try that instead.

hollow tartan
#

@tulip sleet YES, I got it to work. Super!

idle owl
#

Is there already a "code.py" on the board? Right click on it from the File Explorer and choose "Open with Atom" or whatever the specific wording is

tulip sleet
#

@solar atlas looks like a corrupted filesystem. If you unplug it and plug it back in, then Windows (at least Windows 10) will complain and ask if you want to fix it. Say yes, and see if it recovers. It could be more damaged and you might need to wipe it.

idle owl
#

Just so you know you're trying to edit the correct file.

#

@tulip sleet Hmm, hadn't considered that. It was saving ok until we got Putty connected to the serial connection.

#

I think anyway

solar atlas
#

I've already tried that

tulip sleet
#

Try to edit with notepad and see if it also has trouble.

solar atlas
#

I can't figure it out, it was working fine before I installed putty. Cld Putty be bogarting the port, not letting anything else access it? Tho I don't even have Putty open right now & it's still doing it.

idle owl
#

And you ejected and reset the board?

solar atlas
#

yup

#

couple times.

idle owl
#

You can open code.py from the drive in the File Explorer? As in you can access the CIRCUITPY drive from Windows?

#

Putty doesn't do anything if it's not open. So that shouldn't be it.

solar atlas
#

wait do you have to eject the CPX before unplugging it? Cld that mess it up if u dnt?

idle owl
#

Yes absolutely

#

It's a very simple system

#

Like an SD card plugged into your computer. If it gets unplugged, it can get borked.

solar atlas
#

what is borked?

idle owl
#

You'll want to double-tap reset to get to the bootloader, and then copy the circuitpython-circuitplaygroundexpress-2.1.0 file to the CPLAYBOOT drive.

solar atlas
#

it's like a porked borg

idle owl
#

Hah! No, sorry, it means broken, but what I really mean is that the system can get corrupted.

solar atlas
#

ok, so it is fixable then?

tulip sleet
#

gotta run the flash eraser first

idle owl
#

Oh yes completely

#

OH! Right, thank you Dan.

#

@solar atlas Hold on a second, it's easy. Let me find it.

tulip sleet
#

You have that link memorized, probably

solar atlas
#

whats a flash eraser

#

ok

idle owl
#

Ok, step 1: Double-tap reset to put it into the bootloader, you should see the CPLAYBOOT drive pop up in Windows and the lights on the board should be all green after flashing red.

idle owl
#

@solar atlas Step 2: download this file. Copy it to the CPLAYBOOT drive.

hollow tartan
#

@tulip sleet Is this the correct way to package this? ```# reload

(CircuitPython)

this REPL supplemental command was designed for use

with the Metro Express Explorers Guide on Learn.Adafruit.com

by Dan Halbert for Adafruit Industries.

def reload(mod):
import sys
z = import(mod)
del z
del sys.modules[mod]
return import(mod)```

solar atlas
#

Ok? I just pulled up the circuitpy drive & everything looks ok?

tulip sleet
#

@hollow tartan well I didn't write it. I just stole it from the Micropython forum.

idle owl
#

Hmm. It could also be ok even after getting removed.

#

It doesn't always get corrupted when removed without ejecting, just sometimes if it's in the middle of trying to write a file. Sometimes it can show up CIRCUITPY, and look fine, and still be unhappy though.

#

@solar atlas Try editing code.py again to check

solar atlas
#

Ya I'm thinking it's the later. I just tried opening the code.py file & it said corrupted.

tulip sleet
#

The problem is that on Windows, and to a lesser extent on Linux, the file data can get written quickly, but writing the info about where the file is can be delayed for 10's of seconds. Doing an Eject forces that info out.

idle owl
#

Ok yeah. So download the file I linked, double tap reset, and copy the file to the CPLAYBOOT drive.

#

@tulip sleet We had @solar atlas reset it so many times trying to get it to work earlier that I'm not surprised that it's unhappy now.

solar atlas
#

Lol, I upset it's lil rumbly tumbly...

idle owl
#

@solar atlas Once you copy that file, it'll flash blue for a bit, and then it should flash green.

#

@solar atlas Exactly!

solar atlas
#

K. It's flashing green now

idle owl
#

Nice!

#

Now double-tap reset again, and then copy circuitpython-circuitplaygroundexpress-2.1.0 (it's not exacly that, but you should know which one I'm talking aobut) to the CPLAYBOOT drive

tulip sleet
#

'night all

idle owl
#

@tulip sleet Goodnight!

solar atlas
#

Gnight @tulip sleet

#

It's not showing the drive

idle owl
#

Hmm, try the double-tap again, sometimes the rhythm is weird.

#

Takes me a few tries every so often. I'll get it on the first try a bunch and then it's 5 times to get it to work.

solar atlas
#

O wait didn't dan say that I had to run an erraser or something first?

idle owl
#

Oh.

#

That was the file I linked

#

That's the flash eraser

solar atlas
#

Cuz Cplayboot shows fine but the reg drive still doesn't show.

idle owl
#

The thing that should have made it flash blue and then green.

solar atlas
#

It did

idle owl
#

Ok good, you did that correctly.

#

And you've double-tapped reset to get your CPLAYBOOT to show up?

solar atlas
#

Ok no.

idle owl
#

AH ok!

#

That's good, rather it be something simple. Download that file and copy it to CPLAYBOOT.

solar atlas
#

The one that I puyt on was the eraser. now I'll do the other

idle owl
#

Excellent!

solar atlas
idle owl
#

Gah! You created a new file and tried to save it?

solar atlas
#

yup

#

it was acting ok. I thought it was ok.

idle owl
#

Open it in Notepad and try to save it from there.

#

Actually hold on

hollow tartan
#

@tulip sleet Okay. thanks but I would like to put 'reload' in a .py file . I could not get it to be persistant - in residence. I even tried prefixing it into the music.py. He's gone. I will wait for tomorrow. unless, @idle owl?

idle owl
#

@solar atlas That way we should be eliminating the potential for issues with an editor.

#

I have no idea what those issues might be, but I'm running out of ideas. The only thing I can think of is that everything is starting to conflict because we had so many things open and closed repeatedly. Have you rebooted the computer itself?

solar atlas
#

ok I did that. should it do anything?

idle owl
#

@hollow tartan No idea, sorry

#

@solar atlas Touch the touchpads, does it make noise?

#

And light up?

hollow tartan
#

it is alright, it can wait. g'nite

solar atlas
#

nope nothing

idle owl
#

@hollow tartan g'night!

#

@solar atlas Ok, reboot the computer if you can. Let's try to start fresher than we are right now with everything we did.

solar atlas
#

reboot my pc, or u mean the cpx?

idle owl
#

@solar atlas I've got a few minutes left but it's late here, so we'll try this and if it doesn't work, I can help again tomorrow, but I need to head out for the night. Reboot the PC

solar atlas
#

ok

tidal kiln
#

@unique turret correction to previous code:

def set_thermometer_pixels(n, color):
    NP.fill(0)
    NP[0:n] = (color,)*n
    NP.show()
solar atlas
#

ok I'm back up

idle owl
#

Ok

solar atlas
#

What can I do to save this thing? This was Mias bday present.

idle owl
#

I'm really sorry it's given you so much trouble.

solar atlas
#

after I erased it & put curcuit py back on it what did I dod wrong?

idle owl
#

From what you're saying, you did everything right. It still won't let you save to it?

solar atlas
#

I don't care about that, I just want to fix it.

#

no not a code.py file, but those other two files saved to it fine?

#

the eraser & the new CP

idle owl
#

Which two? Oh... it's different how those work, they're installers, not files. But if it let you do that, the board is ok, it's something else going on. Even just copying a file to it isn't working using file explorer? Hmm.

#

Open Notepad, create a new file. Put in it: ```python
from adafruit_circuitplayground.express import cpx

cpx.pixels[0] = ((0, 0, 3))```

#

Save it as main.txt

solar atlas
#

what about rying like an audio file or something?

idle owl
#

And try to save that to the CIRCUITPY drive

#

I want to try to save any file to it at all, to see it works, but it needs to be suitably small.

solar atlas
#

I can't find the blessed notepad

idle owl
#

Oh hmm I mean the one built into Windows... You should be able to type "notepad" into the little search bar at the bottom of the Windows menu...

solar atlas
#

ok, it saved & I was able to open it back up

idle owl
#

Ok, can you save it to the CIRCUITPY drive?

#

OH...

solar atlas
#

yup

idle owl
#

Oh I'm so sorry

#

You have to put the library back onto the board too!

solar atlas
#

saved & opened from there

idle owl
#

That's why the code isn't working.

#

Well, ok, that's one reason, this may not fix everything.

solar atlas
#

Huh?

idle owl
#

I walked Mia through this. Create a new folder on the CIRCUITPY drive called "lib".

solar atlas
#

u lost me

idle owl
#

Then somewhere on your computer right now is a downloaded folder called "lib", so probably in downloads. I had Mia download it when I walked her through it.

#

If you can't find it, I'll link it again

#

Inside that folder is a folder called "adafruit_circuitplayground", and you need to drag it from the downloaded folder (which has a ton of other folders in it), into the new "lib" folder that you created on the CIRCUITPY drive.

solar atlas
#

yes but its not on this computer

idle owl
#

Ok got you, hold on

#

Step 1: download that file. Step 2. Create a folder on CIRCUITPY called "lib" (if you didn't already). Step 3: Unzip the file you downloaded, it's going to be a folder called "lib". Step 4: Open the downloaded lib folder, find "adafruit_circuitplayground" and copy that whole folder to the lib folder you created on CIRCUITPY.

solar atlas
#

ok irts workinig

idle owl
#

Ok!

solar atlas
#

ok

idle owl
#

Now touch A1, does it make a tone and light up? 🀞

#

Did it copy ok is a better first question

#

OH

solar atlas
#

no

idle owl
#

Make sure the slide switch is to the right I think

#

otherwise it's muted

#

and doesn't run

solar atlas
#

it liuves

idle owl
#

Yeah!!!!

solar atlas
#

lives

#

Thank u soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo infitely much!!!!

idle owl
#

Ok! I need to go to bed! We'll try to figure out the REPL again tomorrow!

#

You're so welcome, @solar atlas

#

You can also delete main.txt

solar atlas
#

ok sweet dreams!!! & thank u again!!!

#

ok I will

slender iron
#

@tulip sleet I realize it doesn't have the serial side of it. Cross platform is my main concern.

tulip sleet
#

@slender iron so you want to add serial support, is that right?

slender iron
#

@tulip sleet thinking about it. most of the good cross platform apps I know of are electron

idle owl
#

Email from AdaBot! πŸ’œ

manic glacierBOT
slender iron
#

@idle owl yup, the bundle autorelease worked last night πŸ˜ƒ

idle owl
#

@slender iron I see that! Great job!

manic glacierBOT
manic glacierBOT
#

Code snippets for failure 1:

# Function that manages mounting and unmounting the SD card
def mount_sd_card():
    global sd_card
    global vfs
    # Check to make sure an SD card is present
    if sd_cd.value:
        if sd_card:
            del sd_card
        sd_card = adafruit_sdcard.SDCard(spi, sd_cs)
        vfs = storage.VfsFat(sd_card)
        storage.mount(vfs, SD_MOUNT_PATH)  # Mount SD card
        print("SD Card Mounted")
        return True
    else:
   ...
slender iron
#

@tulip sleet I hacked Hyper to talk to a serial port instead of a terminal

tulip sleet
#

@slender iron alright!

slender iron
#

now if I could get it to open one tab per serial device...

timber lion
#

i went down a similar path a bit already with my rewrite of mu as an electron app earlier and IMHO just going for a raw VT100 emulation javascript and electron serial access libraries is a good option: https://github.com/dtinth/vt

#

all the other web terminal apps i saw weren't interested in serial port access

#

and more focused on fancy console graphics

#

that vt library is really nice and easy to use, just chuck bytes at it and point it at an HTML object to render the terminal inside

#

also don't forget todd did a very similar thing as an electron app with the pi finder

#

electron app as SSH shell, but not hard to swap in node's serial access supporti bet

#

the trouble is as soon as you mix serial port access with node / JS life gets complicated.. most require native extensions which are a real pain on windows

#

people can't just NPM install without visual studio setup, they need a binary

#

something i wanted to look at was a little go-based thing that ran a local web server and websocket relay to serial ports, it could serve a nice HTML terminal and all be distributed as a single statically linked executable

#

electron is really tricky when you get native code involved i found

#

if you are going down that path though my suggestion is develop on windows, it is by far the biggest headache platform for node.. better to hit those issues early

slender iron
#

@timber lion I'm taking a stab at hacking hyper to do it

#

they have their toolchain all set up

timber lion
#

i had it setup in a vm because it was so fussy having multiple VS versions installed

#

you really need 2015 and not something later :/

slender iron
#

why does it need to compile the extension again? doesn't it just download comething that is precompiled?

timber lion
#

nope npm doesn't do binaries

#

node-gyp is supposed to make compiling native node code easier

#

but it still needs build tools

slender iron
#

it looks like hyper can provide a setup exe

timber lion
#

yeah to build that you'll need to get a windows environment setup with node gyp etc.

#

like i said there's a lot of unexpected complexity with windows, it's why i would develop first on it

slender iron
#

I'm seeing if appveyor will do it for me 🀞

timber lion
#

appveryor helps but it was python focused last i looked

#

i don't think it did node-gyp

slender iron
timber lion
#

that might be different though

#

ah nice perhaps they added an electron specific environment

slender iron
#

Β―_(ツ)_/Β―

#

I'm just inheriting everything the hyper folks have done

timber lion
#

yeah just wanted to warn be ready for windows fun, it's all toolchain pain and caught me by surprise

idle owl
#

Toolchain Pain is the name of my next band.

slender iron
#

haha, it didn't like the errors I introduced

#

will fix them after the gym

#

talk with you all later!

solar whale
#

sheesh - this conversation is terrifying πŸ˜‰

idle owl
#

@split ocean Question: which version of the bundle are you using?

split ocean
#

I'll check on that machine in a minute, but it was the 2.1 release IIRC

idle owl
#

Thanks

slender iron
#

@tulip sleet you around?

worn birch
#

I'm in trouble ... just spent way too much at adafruit ... lol ... got a few Feather M0 Express' on the way... plus way too many other fun stuff ... hooked ... lol ... I think I got a few of the uni staff hooked too ... they really think the purple snake is so cute ... hehe good logo

slender iron
#

its super experimental

idle owl
#

@worn birch That's great!

worn birch
#

@slender iron what is it and what am trying?

slender iron
#

its a terminal app that shoudl auto connect to a circuitpython connection

#

(really a serial port for any adafruit board.)

#

so plug in a circuitpython board and then run the hacked hyper

#

I don't have time to try it on windows at the moment myself

#

it works on mac πŸ˜ƒ

worn birch
#

downloaded it ... but just realised I left the one board I currently (many coming in the mail) have at uni ... but I can try test it tmrw

slender iron
tulip sleet
#

@slender iron back in a few minutes

slender iron
#

@idle owl there is a dmg for mac

#

kk @tulip sleet is your windows box separate?

idle owl
#

@slender iron Oh nice.

slender iron
#

its super hacky but I just used it for something else πŸ˜ƒ

idle owl
#

Wait where's the dmg

slender iron
#

on discord?

#

named Hyper

idle owl
#

Oh... my. Oi. πŸ˜„

tulip sleet
#

@slender iron I have six separate windows boxes

idle owl
#

I was looking at the links and missed you posting the file.

slender iron
#

πŸ˜ƒ

#

I share my monitor with my windows box so I can't try it at the moment

tulip sleet
#

do you want to drop a test here?

slender iron
#

I think 56 MB is too large for me to attach directly

tulip sleet
#

downloading...

slender iron
#

🀞

idle owl
#

I have a window with 3 tabs. That doesn't seem to do anything. πŸ˜„

slender iron
#

hit enter in them

#

(do you have three adafruit boards connected?)

idle owl
#

Yes. I do.

#

And enter didn't help.

slender iron
#

hrm bummer

idle owl
#

I'm going to restart the app again

slender iron
#

if you got multiple tabs it then found the boards

idle owl
#

Good start then

#

Wait a sec, let me reset the boards. Might still have the serial connected.

slender iron
#

you should be able to interact with the serial connect in each tab

tulip sleet
#

is this derived from terminus or vice versa? Same weird startup animation

slender iron
#

ah, that might happen if something else is already connected to the serial

#

its electron like terminus but is a different project

#

I swapped the pty stuff for a serialport connection πŸ˜ƒ

idle owl
#

It worked!

slender iron
#

nice!

#

what do the tabs say?

idle owl
#

Shell

slender iron
#

hrm ok

tulip sleet
#

works!

slender iron
#

it'd be cool if it was the board name

idle owl
#

Agreed

slender iron
#

excellent @tulip sleet !

tulip sleet
#

does it just look for the first com port above 3 or something?

slender iron
#

proof of concept βœ…

idle owl
#

@slender iron Well done!

slender iron
#

nah, it actually looks at the usb vendor ID

#

if its adafruit's then it connects πŸ˜ƒ

idle owl
#

Really terribly working on IR, so 2 CPXs plugged in and the M4.

worn birch
#

@slender iron so I gather it wouldn't work on a arduino uno then?

slender iron
#

not in this hacked state

tulip sleet
#

I tried swapping the background and foreground colors to make it light, and the title bar disappeared.

slender iron
#

it'd be easy to fix

idle owl
#

I thought it was running really slowly but no, that's my code being weird. Or both, but my code is definitely not right either. πŸ˜„

slender iron
#

so whats the verdict? is it an interesting idea?

idle owl
#

Definitely

tulip sleet
#

the multi-platform thing is what' appealing: you said that. It's a big download. Does the mu repl window do the terminal emulation, like supporting readline cursor movement, etc.?

idle owl
#

It's not any easier to keep track of multiple boards with "shell" for a title than it is with current methods (I usually have to ctrl+d a few times to see where the traceback is to figure it out if I don't have print statements), but I love the autoconnecting.

timber lion
#

my take is go further for a full IDE like mu, I did that version of mu in electron a while back and it might be worth revisiting

slender iron
#

I honestly don't know how mu does it

timber lion
#

mu does VT100 emulation itself

#

it looks for the control chars and parses them

#

for my version i used one of those JS libs i mentioned

slender iron
#

I think hyper is using xterm.js or something

timber lion
#

they're really nice, just throw the bytes you get from the board at them and they do all the magic of moving cursor etc

tulip sleet
#

if you could make it not exit when the board disconnects that would be great. That's the primary virtue of Tera Term: it restarts the connection nicely when it comes back (unlike Putty).

timber lion
#

VT100 emulation is kinda non-trivial, i thought of doing it myself but the control chars are variable length

slender iron
#

@timber lion thats my take on it too

timber lion
#

so whereever possible, use a library for it IMHO

#

yeah

slender iron
#

thats why I was looking at existing terminals I could rip the core out of

timber lion
#

ultimately you're going to want a nice UI to select serial ports, boards, etc. I think

#

and at that point, might as well add a simple text editor pane to save files .. like mu πŸ˜ƒ

slender iron
#

I'm trying to avoid that, other terminal programs give you lots of options

timber lion
#

yeah i looked a lot but none do serial

#

alternatively... what about repurposing arduino

#

it's familiar and has all kinds of UI and logic for serial access

#

java, but they integrate the java runtime now

#

IMHO it might be easier to rip out the compile step from arduino vs. make a whole new thing

slender iron
#

its not familiar to people who haven't used arduino

timber lion
#

just need file saving

slender iron
#

don't people know how to edit text files already?

timber lion
#

it's no diff from mu, editor + serial port.. which is what we want cross plat ideally

idle owl
#

I haven't used Arduino.

slender iron
#

@timber lion meeting is starting

timber lion
#

you also get serial plotter, library system etc

ruby lake
#

TOny, is there a decent example of writing variables to an SSD1306? The stuff I've read doesn't go into that

timber lion
#

foo = 28.2567
print('Value: {0:0.2f}'.format(foo))

#

for example to print a float with 2 digits after decimal

#

or you can save to a string
foo_string = 'Value: {0:0.2f}'.format(foo)

#

then send that string anywhere like SSD1306 text function

ruby lake
#

I'll tinker with it, thanks

unique turret
#

Can someone point me to the directions @timber lion made to prevent a mac from adding extra files on a CircuitPython board

#

?

idle owl
#

Should be able to, let me find it

unique turret
#

I was looking at it yesterday, but can't remeber where it is

idle owl
timber lion
ruby lake
#

I will have to figure out how to arbitrate A/D conversions, those seem to be blocking and slowing down MIDI reponse

stuck elbow
#

no paralllelizm in circuitpython

ruby lake
#

right, I will just have to have it do them under certain conditions

slender iron
#

@ruby lake the AudioOut stuff can do it in the background

ruby lake
#

@slender iron I figured there was something πŸ˜‰

slender iron
#

πŸ˜ƒ

#

not supported on the m4 yet

ruby lake
#

well I have enough to do while the m4 is in the works

#

I used to do this stuff on a 4MHz Z-80. A 48Mhz M0 w/circuitpython is still faster

slender iron
#

πŸ˜„

ruby lake
#

The uart is really fast even on single-character reads

slender iron
#

πŸ‘

ruby lake
#

is there a circuitpython dac library for things like MCP4822?

slender iron
#

not that I know off the top of my head

ruby lake
#

I'll just wing it as usual

slender iron
#

πŸ˜ƒ we can help you write one

slender iron
#

@idle owl this should label the tabs

idle owl
#

@slender iron Nice! Hah, M4 is unknown board. But two CircuitPlayground Express!

slender iron
#

yeah, I decided not to leak the upcoming boards

idle owl
#

Makes tons of sense.

tawny creek
#

🦌 M4 oooh ~

slender iron
#

@tawny creek have you done electron?

tawny creek
#

@slender iron I have not but I know it touches a lot of web stuff πŸ˜ƒ

slender iron
#

yeah, its node, js and html

tawny creek
#

@slender iron familiar with the last 2 the most but i live with someone that works with node js more than i do

#

@slender iron what are you using it for?

slender iron
#

trying to make a super simple serial app thats cross platform

#

open it and you get the serial connections immediately

#

I hacked up hyper to do it

#

I should probably rename it

idle owl
#

Seems like a good idea.

tawny creek
#

that's a great idea!

slender iron
#

I posted some early builds above

#

(not sure what os you are on)

tawny creek
#

@slender iron on osx rn, what do you need to get it going?

slender iron
#

I posted a dmg above

tawny creek
#

downloads

slender iron
#

πŸ˜ƒ

#

not sure what it does when no boards are plugged in

tawny creek
#

@slender iron just a blank screen

#

@slender iron then updates to the screen with serial πŸ˜„

slender iron
#

yeah, I think its a bit slow

tawny creek
#

plugged in a trinket m0 and its now outputting a buncha numbers (first time plugging the trinket hehe)

slender iron
#

thats the demo, you should be able to ctrl-c it

tawny creek
#

yep, seems pretty responsive πŸ˜ƒ

#

should i try plugging in more than one board?

slender iron
#

sure!

#

you'll need to restart it after

tawny creek
#

@slender iron nice tabs :)!

slender iron
#

yay! I love simple

tawny creek
#

@slender iron anything you want me to test?

slender iron
#

thats pretty much it

tawny creek
#

this already feels like it will save me a lot of time @slender iron , been using just terminal and screen /dev/foreverchangingusbname -

cunning crypt
#

@slender iron This thing will be amazing.

slender iron
#

yeah, thats what I was thinking

#

what would be a good name for it? I don't want to release it as Hyper

idle owl
#

Hmm

slender iron
#

@tawny creek it would be epic if it could detect a new device and open a new tab

tawny creek
slender iron
#

bonus points for a new logo too

idle owl
#

SimpleSerial. Susie: Super Simple Serial.

slender iron
#

Haha Susie is great!

tawny creek
slender iron
#

I'm using serialport to do a list at start up

#

it'd just be a matter of doing it periodically

tawny creek
#

@slender iron yeah that'd be nice

slender iron
#

k, gotta head out. night all!

idle owl
#

@slender iron Night! Have a good one

opaque patrol
#

@slender iron update your hyper repo with your changes

slender iron
#

@opaque patrol I think it’s up to date on the canary branch

opaque patrol
#

@slender iron Ok, thanks...trying to build it on windows and Yarn is having issues

slender iron
#

I built on Mac and used appveyor to build for windows

stoic gazelle
jovial steppe
#

So is this channel supposed to be for CP developers or CP users w/questions (or both)?

idle owl
#

Both.

jovial steppe
#

I've got a regular RGB led and I want to color blend, but when I try to pulseio.PWMOut on more than two channels, I get "Runtime error: all timers in use". Is the limit two PWM channels in use at the same time (!?!?).

idle owl
#

As well as Python, and CircuitPython related hardware questions. And more. None of the channels are really limited. You just might get a better answer in one or another depending on the question.

#

I've only just started using PWM, so I don't have a clue, unfortunately.

jovial steppe
#

I didn't want to ask user questions if this channel were primarily for devs, otherwise I could stalk the projecthelp channel

#

I don't see any mention of timer channel limits in the pulseio docpage.

idle owl
#

Oh no, this is absolutely for users as well.

jovial steppe
#

Excellent. Consider yourself annoyed by me then.

idle owl
#

Done πŸ˜‰

#

I don't understand pulseio well enough to help. The only thing I've done with it started yesterday and that's tearing apart someone else's IR code to try to figure out how it works.

#

Are you on ReadTheDocs? I'm sure anything I'm looking at you've already seen.

jovial steppe
#

Yeah, I saw something in pulseio about generating carrier frequencies. That would certainly be useful for IR.

#

Yeah, i'm on RTD.

idle owl
#

Ok, yeah. That's where I was looking as well.

jovial steppe
#

Don't assume that I've seen everything. I'm making my first pass through RTD and porting an Arduino app which uses a lot of the "standard Arduino library".

idle owl
#

Ok, I'll give it a scan too then. Sec.

jovial steppe
#

Nah, I thought I'd ask first because I'm going to have to totally rework my app if I can only PWM two pins at a time. That seems seriously wrong, hence the question.

idle owl
#

Yeah I don't see anything jumping out at me either. I wouldn't rework it yet. There's not always a pattern to when people are around, but tonight is quiet. The other option is the forums, which I know you know.

jovial steppe
#

I'll check there now. Thanks. As you were.

idle owl
#

@jovial steppe Anytime πŸ˜ƒ (that I'm around anyway...)

jovial steppe
#

Well, pretty much nil about "PWMOut", "pulseio" or "all timers in use" in the forums. I'll see if I can find the code for PWMout and see what the code/comments say.

idle owl
cunning crypt
#

@jovial steppe This channel seems to be users that become helpers and/or devs....

pastel panther
#

heya @slender iron , I finally got my pwm blinky working on my m4 board

slender iron
#

@jovial steppe more than two should work if you leave variable_frequency as flase

manic glacierBOT
jovial steppe
#

@slender iron I did, I took the constructor defaults. I posted the details to the forum. The test case I supplied is the degenerate one.

#

Topic "after first two PWMOuts, "RuntimeError: All timers in use""

slender iron
#

@jovial steppe I got back to you on the forums last night

#

@pastel panther great job on the M4!

opaque patrol
#

@slender iron I finally got hyper to build and run in dev mode on Windows, I also found an issue with the productId using uppercase. Easy to fix, I will do a pull request if you want

unique turret
#

@tidal kiln The function you wrote for my themometer works great. My code is almost complete. Last thing is to log the time and temp to a file.

slender iron
#

@opaque patrol that would be great!

opaque patrol
#

@slender iron I am still learning git as well. I did a clone of your repo. Do I need to fork it to do a pull request?

slender iron
#

yup, fork and then add it as a remote to your local copy

#

I'm happy to help you learn git so feel free to ask questions

tidal kiln
#

@unique turret awesome. did you see that second version i posted way later? i assume so as the first version should've thrown an error msg.

unique turret
#

Yes, also I want to understand the code better, what does this line do (color,)*n that is the , and the *

tidal kiln
#

creates a tuple of length n with all values being color

#

when you specify a range of neopixels, like with a slice, it expects a same sized range of colors

unique turret
#

Cool!

tidal kiln
#

that's what i messed up on the first version, i just had = color

#

also, you can use that * trick in other ways, ex:

>>> print("-"*70)
----------------------------------------------------------------------
>>> 
unique turret
#

Cool trick @tidal kiln!

#

So this is a general question. Before I can save to a file on the internal storage of my Feather M0 Express, I have to mount the drive. Do I create a boot.py file like this one by Dan Conley? ```import digitalio
import board
import storage

switch = digitalio.DigitalInOut(board.D0)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP

If the D0 is connected to ground with a wire

CircuitPython can write to the drive

storage.remount("/", switch.value)```

#

Also I want to reverse the logic and use the button that is already on the thermometer

opaque patrol
#
>>> bits = bytes([0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80])
>>> rbits = bits[::-1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotImplementedError: only slices with step=1 (aka None) are supported
#

How can I reverse an array in CP?

slender iron
#

@opaque patrol try reversed()

opaque patrol
#

@slender iron I tried that first, but it isn't defined. Should it be? Or do I need to import something?

slender iron
#

I thought it was built in but sometimes we turn them off to save space

#

@unique turret thats a good trick to do if you want to write to the internal flash sometimes

#

boot.py will run once before usb is started

tidal kiln
#

@opaque patrol

Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> data = [1,2,3]
>>> data.reverse()
>>> data
[3, 2, 1]
>>>
opaque patrol
#

@tidal kiln Thanks, (I was using it wrong) I was trying reverse(bits)

slender iron
#

did you try it as reversed too?

glacial bronze
#

Reversed is slightly different

tidal kiln
#

looks like reversed returns an iterator

glacial bronze
#
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> data = [1, 2, 3]
>>> reversed(data)
<list_reverseiterator object at 0x7f7831d727f0>
>>> list(reversed(data))
[3, 2, 1]
>>>```
slender iron
#

ah

glacial bronze
#

also

#
>>> data[::-1]
[3, 2, 1]```
opaque patrol
#

@slender iron Okay, for hyper...I forked the repo and redid the clone from there, did a remote add upstream to your repo and made the change. Now do I push the change to my repo and do a pull request?

glacial bronze
#

gotta love slicing

slender iron
#

@opaque patrol yup!

#

@glacial bronze circuitpython doesn't do all the fancy slicing

glacial bronze
#

oh, nerts

tidal kiln
#

yet...

Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> data = [1,2,3]
>>> data[::-1]
[3, 2, 1]
>>>
glacial bronze
#

What, no, it works fine

#
Adafruit CircuitPython 2.1.0-14-g065a319 on 2017-11-14; Adafruit CircuitPlayground Express with samd21g18
>>> data = [1,2,3]
>>> data[1]
2
>>> data[1:]
[2, 3]
>>> data[::-1]
[3, 2, 1]
>>>
tidal kiln
#

@opaque patrol what version cp are you running?

opaque patrol
#

@tidal kiln 2.1.0

tidal kiln
#

can you get the simple slice example above to work?

glacial bronze
#

btw, fyi, the slice notation is list[start:stop:step], where the defaults for any omitted arguments are list[start (i.e. 0):end:1]

#
>>> data = [1,2,3,4,5]
>>> data[::2]
[1, 3, 5]
>>> data[1::2]
[2, 4]```
slender iron
#

@glacial bronze try on a trinket

glacial bronze
#

I don't have an M0 :/

tidal kiln
#

@slender iron

Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> data = [1,2,3]
>>> data[::-1]
[3, 2, 1]
>>> 
opaque patrol
#

@glacial bronze yes, your example works

#

@tidal kiln I mean your example

slender iron
#

hrm, maybe I turned it on later

#

Β―_(ツ)_/Β―

tidal kiln
#

@opaque patrol either one.....but?? how'd you get that NotImplementedError ???

opaque patrol
#

I think it has to do with the original array being bytes

tidal kiln
#

ah

opaque patrol
#
bits = bytes([0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80]) 
#

if I try to reverse this, I get an error,

tidal kiln
#

yep. same here.

glacial bronze
#

Oh, that makes sense

#

All these reverse things work on lists, but bits is no longer a list

opaque patrol
#

I also notice there is an at symbol inserted before the x80 when i print it out...I suspect x20 and x40 are the at symbol

glacial bronze
#

I see the same

tidal kiln
#

@opaque patrol yep. confusing. i actually commented on that a few days ago.

glacial bronze
#

so, how to easily reverse that....

#

oh, simple.... list(bits) turns it back into a list

#
>>> list(bits)
[1, 2, 4, 8, 16, 32, 64, 128]
>>> bytes(reversed(list(bits)))
b'\x80@ \x10\x08\x04\x02\x01'```
stuck elbow
#

bytes(reversed(b'abc'))
b'cba'

#

works for me?

glacial bronze
#

that also works for me

#

let me double check on CP

opaque patrol
#

that worked, rbits = list(bits)[::-1]

glacial bronze
#

bytes(reversed(bits)) works on CP-on-CPX

#

also @ becomes @

#

er

#

space then atmark becomes atmark then space

#

which makes sense

#

because 0x20 in space in ASCII

opaque patrol
#

yep, x20 = space

glacial bronze
#

and yep, x40 is @

tidal kiln
#

what i posted previsouly....

#

interesting behavior when printing byte arrays:

>>> bytearray([0x01,0x02,0x03,0x1f,0xff])
bytearray(b'\x01\x02\x03\x1f\xff')
>>> bytearray([0x48,0x45,0x4c,0x4c,0x4f])
bytearray(b'HELLO')

makes it confusing when the values are mixed printable / non-printable:

>>> bytearray([0x28,0x02,0x5c,0x1f,0xff])
bytearray(b'(\x02\\\x1f\xff')
opaque patrol
#

@slender iron do I do a pull request from your repo or mine or does it matter?

slender iron
#

it should work as long as mine appears as the base

unique turret
#

I don't think my boot.py file is working. Hmmm ```import digitalio
import board
import storage

switch = digitalio.DigitalInOut(board.D11)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP

If the D0 is connected to ground with a wire

CircuitPython can write to the drive

storage.remount("/", not switch.value)```

slender iron
#

why don't you think its working?

unique turret
#

The drive mounts whether I pust the button or not

slender iron
#

is it always writeable? it should mount read only when its writeable from python

unique turret
#

Oh so it will still mount, but just not be writable?

#

It is working

#

My problem then is in my syntax for an error code in the guide

#
        with open("/temperature.txt", "a") as fp:
          while True:
            fp.write('{}-{}-{} {:02}:{:02}:{:02}, {}\n'.format(current.tm_year, current.tm_mon, current.tm_mday, current.tm_hour, current.tm_min, current.tm_sec, tempf))
            fp.flush()
            led.value = not led.value
            time.sleep(1)
          except OSError as e:
            delay = 0.5
            if e.args[0] == 28:
              delay = 0.25
            while True:
              led.value = not led.value
              time.sleep(delay)```
slender iron
#

indentation looks suspect, whats the error?

unique turret
#

Traceback (most recent call last): File "main.py", line 79 SyntaxError: invalid syntax which is except OSError as e:

#

I will look at the guide to match the indents

slender iron
#

yeah, I think the except should be indented the sames the try

unique turret
#

Yes, that was it. Thanks @slender iron . For some reason now my lib folder is gone

slender iron
#

hrm

unique turret
#

I will put it back and see what happens

unique turret
#

Instead of my feather being called CIRCUITPY it is now called NO NAME

slender iron
#

uh oh, sounds like the file system is unhappy and needs an erase

#

it can happen if you reset the board without safely removing it or ejecting it from the main OS

unique turret
#

I did a force eject

slender iron
#

force eject is also bad

#

you shouldn't need to force it

unique turret
#

I just reloaded the .uf2 but I guess that the damage to the file system is beond that

#

Did I ruin my board? sparky

idle owl
#

Nope!

unique turret
#

Thank goodness πŸ˜„

idle owl
#

The filesystem is corrupted, and you'll need to do a few steps here, but it's not ruined.

#

Which board?

stuck elbow
#

it's very hard to break the adafruit boards

opaque patrol
#

@unique turret Is there actually blue smoke coming from your board, because that might change the answer

unique turret
#

No blue smoke, luckily πŸ˜ƒ

idle owl
#

@unique turret Which board are you using?

unique turret
#

Feather M0 Express

idle owl
#

And copy it to your FEATHERBOOT drive.

#

It'll flash blue for a bit, longer than the usual uf2 flashing takes, and eventually it should start pulsing green.

unique turret
#

Yes, very short green pulses now

idle owl
#

Excellent.

#

Now double-tap reset again to get back into the bootloader, and drag the CircuitPython Feather M0 Express uf2 to the FEATHERBOOT drive.

unique turret
#

Hooray, I have the CIRCUITPY back

idle owl
#

Now you need to put the libraries and the code files back onto the Feather and you'll be good to go.

unique turret
#

Awesome! Thank you @idle owl

idle owl
#

And we're working on a Troubleshooting page to incorporate all of this into every M0 board guide, so it'll be easier to find

#

@unique turret You're welcome!

unique turret
#

So to avoid this probelm, does anybody know why my computer says programs may be using the drive

#

I guess I will just shut down my machine to eject to be safe.

idle owl
#

Oh.

#

@unique turret There are many reasons why it might say that. Serial connection, open to the drive in file explorer, the editor hasn't closed completely in the background... I either unplug it (which as long as it's done writing the file it's kind of ok, but you still risk corrupting the board), or I open Activity Monitor (Task Manager on Windows) and see what processes look like they might be hanging onto it, and kill those processes.

#

Shutting down the machine will certainly do the same, but it's worth trying these things first because it's much less effort.

stuck elbow
#

On mac and linux you can also use lsof to see the processes that have a file open.

unique turret
#

@idle owl I will try that next time

#

@stuck elbow There are lots of things that are open I guess after running lsof

stuck elbow
#

You can filter by path, not at computer right now, can't check how

wraith tiger
#

Hi all. My feather m0 express & joy wing arrived in the mail today. This will be my foray into CircuitPython. Does anyone have suggestions as to "start here" introductory guides & tutorials?

idle owl
#

You can also find tons of other guides with tutorials and projects if you search the Learn System.

wraith tiger
#

Thanks. Yes, I saw that one but I was thinking more in terms of gereral inroduction to CircuitPython itself.

idle owl
#

Ah ok. Let me see.

#

There's a ton of CircuitPython guides in the learn system, but they're specific to different hardware. They would definitely give you some places to start though. As well theres the more detailed section of the Circuit Playground Express guide, which while specific to the CPX board, has a lot of examples that can help you get started. https://learn.adafruit.com/adafruit-circuit-playground-express/adafruit2-circuitpython

Make faster and easier than ever with MakeCode, CircuitPython or Arduino!

#

Specific hardware meaning different sensors and so on, not boards different from the Feather.

wraith tiger
#

OK, thanks. I poke around in the guides a bit.

unique turret
#

My code is finished!!!! This community made it possible ❀

idle owl
#

@unique turret Congrats! And thank you!

unique turret
stuck elbow
#

@wraith tiger the joy wing is a bit new and doesn't yet have a guide for CircuitPython, unfortunately

ruby lake
idle owl
#

Nice!

ruby lake
#

M0 FeatherX will be fun, but with M4 can do Z-plane filters and etc

stuck elbow
#

what's that round thing in the corner? a din socket?

ruby lake
#

DIN5 for MIDI

stuck elbow
#

I thought that all midi is usb-based these days

ruby lake
#

it depends, many live set players use classic midi

stuck elbow
#

I guess that lowers the latency

slender iron
manic glacierBOT
tidal kiln
slender iron
#

I don't but @tulip sleet might

tulip sleet
#

@tidal kiln are they meant to be available to outside users, or are they just used inside the class?