#circuitpython-dev
1 messages Β· Page 117 of 1
yep
@umbral dagger I was there a few months ago, so it's still pretty clear for me π
Though I point people to MakeCode to start with
@pastel panther Your absolutly correct.
I learned writing DOS programs which was decent, but there is something extra special about holding a thing in your hand and making it blink cause you told it to
It's a bit more tactile than a web app or even command line program
@umbral dagger I looked at MakeCode and was more confused by it, and Arduino seemed like jibberish to me, so I insisted on going straight for Python.
But I've been teaching a friend who just got a CPX a few weeks ago, and she's never coded anything. So I've been learning MakeCode as well as we go.
Yea, I took one look at make code, tried to drag some obvious things around and it didn't work so I gave up
There is a good oppourtunity there though, I think the app just needs some more love
MakeCode is for beginners, but way too cumbersome for cutting actual code. I tried it just out of curiousity. I would prefer smart flowcharts instead.
@idle owl You'tre not 10 years old, though. I think (cavaet, I haven't been 10 years old is around 40 years) MakeCode is more approachable that writing text into a file.
@umbral dagger I agree with that.
@lofty topaz Exactly. It's a great place for youngins' to learn some basics.
the idea is to provide a spectrum of options, of increasing complexity
MakeCode -> CircuitPython -> Arduino -> gcc and make files
@tidal kiln yup
@umbral dagger Yeah I think she's learning so much more using MakeCode than she would be using CircuitPython even with the CPX API.
I almost think you can leave arduino out of that. Almost
Arduino gives you the C/C++ language. I'd say keep it. For sure.
Arduino provides a gentle approach to using C/C++.
I suppose so
Then you can switch over to something more "industrial". I tend to use platformio for that type of thing.
The Arduino IDE is horrible to edit code in.
How on earth do you get platformio to just have a simple avr project without arduino? I couldn't figure it out
keeping all these options. it's not like any one is seen as a replacement for any of the others.
I can do it on the command line but integrating it with atom/platformio was less easy than I would have liked
Exactly, it's a progression: increasing power, at the cost of increasing complexity.
What's going to happen is the migration will be from MakeCode to CircuitPython to CircuitPython with List Comprehensions, Regular Expressions, Iterators, Mutators, etc... ><>
start the journey where ever you want. go as far as you want.
@pastel panther Ya, I use platform IO from cmd line. Emacs to edit.
wait, what? I only liked it for the IDE
@umbral dagger it must do something that I'm missing. organizing project types, compilers and libs?
@pastel panther I'm close to dropping platformio in favor of makefiles.
@pastel panther As most of the stuff I find myself doing at tthat level is for custom hardware.
@umbral dagger Are you just using it like a makefile or something else?
@pastel panther platformio run is pretty much all I use... with auto-upload.
@lofty topaz if someone using CircuitPython progresses to the point of being a list comprehension ninja, then moving to full Python on a RPi might be the next best step
@tidal kiln Precisely, and on to become great Data Scientists. Because that's where the work is growing. And Python is the perfect language for it.
@tidal kiln Yes, it depends on where your interests lie. You have options at each step. Which is the awesome thing.
Once you move to Pi, you're on Linux which means all the other languages are an option, and you can easily move to pretty much any hardware.
@lofty topaz Well, Python is the popular language for it.
Will the day ever come when Operating Systems go the way of the Manual Transmission???
@lofty topaz which is another motivating factor for me to get some python skills: AI & ML.
@lofty topaz Meaning only people that enjoy using their computer for fun want them? I think computers will always need an OS
@umbral dagger Good show, never stop learning...
well, maybe not.
@lofty topaz yes & no. Ask a typical Mac (or even windows) user about there operating system. Compare that to a typical linux user.
Depends on your definition of OS
@lofty topaz the more I think about your question the quicker it dives into philosophy. Now I'm at: "Do humans have an OS?"
CP is like what Basic on the early micros was. Turn it on & type in some code, run it.
@pastel panther If ya go to far down that rabbit hole, let me know, I'll drop you a line. π
The big difference (other than needing to hook it to a "real" computer) is that for $20 or so you get a machine an order (or more) of magnitude more powerful.
@slender iron I notices a small problem with struct documentation. the calcsize method is missing form the readtodocs. There is documentation in the struct/init.c but it looks like there are extra spaces at the beginning of the lines .//| Supported size/byte order prefixes: @, <, >, !.
//|
//| Supported format codes: b, B, h, H, i, I, l, L, q, Q,
//| s, P, f, d (the latter 2 depending on the floating-point support).
//| .. function:: calcsize(fmt)
//|
//| Return the number of bytes needed to store the given fmt.
//|
@umbral dagger Application, it's all about the Application.
@slender iron should i report and fix?
I'm embedded and staying here.
@lofty topaz the Application or the application?
@pastel panther The application, as in, how the computer is applied.
@lofty topaz which requires an application ;P
The documentation is in the .c file, but is indented.
@lofty topaz @pastel panther Agreed. The application. That's partly why I don't agree with the "all kids/people need to learn to code" line. They need to learn how to apply technology to solve real-world problems. That will generally (but not always) involve writing some code. This is where the stuff we're doing (we being folks working on things like CP and related hardware, micro:bit, etc) is game-changing.
@pastel panther Actually, I may beg to differ. You see, I was an Application Developer. But I use to be a computer Programmer. So what's the dif, right? Well, I like to say a programmer is like a carpenter, they will build you a house or a program, but a developer willo build you a skytscraper or a computer application. It's all about size, resources, platform, etc...
I use to Build the executable. Now we Compile, Link, and Bind. All as a Build process.
But I stay in the embedded world.
@lofty topaz I dunno. I think those distinctions are seldom useful, especially if self applied
@lofty topaz The concepts you mentioned can be ment by those works but the words don't always decode the same way for everybody
I was on a team that built an application that was over one million lines long. A windows app that is. That sort of coding is way too stressful for me anymore.
I built an Andriod app and spent more time on the content then the code.
@lofty topaz For example I always thought "Software Architech" is a person who cares more about titles than code. There are people that architect code but that label seems lame to me.
@pastel panther Those people are necessary when developing huge apps. Developers don't design a skyscraper, an architec does.
out-dented calcsize() docu
@lofty topaz Of course they are but are you're not going to hire person A over person B just because A's resume says Software Architectβ’ and person B's says Software Developer
Archetech don't implement, developers do that.
So architects can't develop? Developers can't architect? I don't get where that seemingly arbitrary line comes from
blah, I'm sure somewhere at the end of a long conversation we probably agree but I ain't got time for that now
perhaps some other time
Ah, ok, listen up. I didn't say can't. If I were to stay in the field instead of retiring, I may have moved up or into and architech position to design apps using UML. Let the grunts code it for me.
Issue: struct.calcsize() is missing from readthedocs #379
There's a line od succesion here. I would never hire an architech who had never coded. Yet I will hire a developer who has never architecheded.
I think this is a interesting discussion for a different channel
@pastel panther As a software architect I always hated the term "software engineering" because I don't think engineering is a very good analogy. But I think architect is much closer. But I'm a hands' on architect, so I code too.
haha
Oh, now I'm the guy breaking the rules because we all simul-posted!
no worries
π
It's all my fault. I started it. So sorry... ><>
The channel was dead for a while and /i made the comment "food for thought".
I think "dead for a while" is relative...
No problem brocephus
no worries @lofty topaz
If there is another acceptable way to test the aliveness of the device, I'll be happy to implement it in i2c_device.py.
@marble talon Like, < 50 msgs/hr?
Yeah, this channel can get a little nuts!
you can partially blame me π
Scott and I discussed whether to fix the original bug in a different way besides excluding buffers of size zero. I will look at it.
@pastel panther Done! π
oof
Only by request!
It makes a better product to have more people involved, so it's to be expected that everyone has to ramp up.
ok I tried just doing a read from it and that seems to work.
i2c.readfrom_into(0x5a,junk)
works with a device at 0x5a
throws OSError 19 with an invalid address
@tulip sleet @formal plover the gcc installed on the Raspberry Pi by apt-get is gcc 4.9.3 - the ARMinARM is 4.8.2. so I am not going to invest the time in building it. If I get really bored I'll try to figure out why the latest build of the toolchain fails, but it won't be at the top of my list π Hopefully some guru will provide a working toolchain soon.
Interesting to note that the RPi Arduino build use arn-none-eabi-gcc v4.8.3
same on MacOS and Linux
I tried the following change in i2c_device.py and it works OK with a simple test with a mpr121 installed and an si7021 not inttalled. If this is "i2c safe" it's a simple change.
56,57c56
< bytesread=bytearray(1)
< i2c.readfrom_into(device_address, bytesread)
---
> i2c.write...
@meager fog Got around to playing with the BMP280 lib. Runnign the example, had to tweak the import to import adafruit_bmp280 and it worked.
@umbral dagger the exaple assumes that adafuit_bmp280.py is in a folder named adafruit_bmp280
@meager fog It's reporting an altitude ~50m higher than the official elevation. Temperature agrees with the thermostat. Barametric pressure matches the official numbers for right now.
@solar whale @meager fog Oh.. right.. I just grabbed the py file
I did the same
@solar whale I'm still getting the hang of imports in Python.
@umbral dagger I have not even begun to get the hang of it π
@solar whale I'm at the same time getting the hang of imports in Haskell which use the same word, but are a bit different.
I am alwasy amused by references to Haskell - My home town was named Haskell - not a hotbed of programming.....
@solar whale Well, good thing it wasn't named after your home town, then.
yay - DHT22 working on a Trinket M0!!!
Reverts adafruit/circuitpython#378
@tulip sleet ok ima try and add bmp280 to the bundle
@meager fog sure. do the git submodule add, then run update-submodules.sh, then create a tag, and then build-bundles.py`. Create the tag in advance so build-bundles will label the file with the tag (tags are yyyymmdd)
hmm ok
build-bundles.py will ask you if you created the tag
ok i did a git submodule add
@slender iron gah I did a rebase on the circuitpython pull request and now it won't fast-forward in my personal repo
im on linux tho, so should i commit and let someone update the bundle later?
its no rush, i have some other libs
Oh sure, then just commit and push and we'll make a new bundle later. Just run update-submodules.sh` before you do to get everything up to date.
before i do what, commit?
yeah
that script is just four git commands
do you have msys-git running a shell? That woudl work
@tulip sleet yeah, thats why I'm tempted to switch back to merges
@slender iron I tried reverting and doing a squash and it didn't help
@meager fog yah; if I've got the workflow wrong I can fix it later; no prob
I reverted via github, which created a new PR, and I did a squash commit on github with that. I could revert that one and do a merge.
maybe safest to revert on github and squash locally
why did you revert on github?
cause there was a button to do that; I thought it woudl roll back cleanly
π
I'd worry about the github copy more than local
I'll clean up locally and do a new PR. It did the revert with a pairf of undo commits, not a reset --hard
kk
4232a0a Sync with https://github.com/adafruit/asf4/pull/3 - dhalbert
f0a12d9 Check INTERNAL_LIBM make flag in a safer way. - dhalbert
2487226 Read serial input as a background task so we ca... - dhalbert
7f88ba3 Revert "Allow main.py to be interrupted by ctrl... - dhalbert
10b3a90 Check INTERNAL_LIBM make flag in a safer way. - dhalbert
@slender iron bunch of stupid commits, but it was fast-forwardable (and should be for your too). Was worried squashing wouldn't work. Live and learn.
<@&356864093652516868> this latest commit to master allows you to ctrl-C main.py. It won't necessarily fix the other issues, and you may still see dropped REPL's or odd issues with MSC, esp on Linux.
@tulip sleet nice, thanks!
@tulip sleet appears to work on Linux and MacOS
@tulip sleet is this re: m4? i can try reloading
@meager fog This is 3.0 for both M0 and M4. I tested on M0; @solar whale tested on M4 (I believe)
yes - I tested on M4
@slender iron is working on improving the USB descriptors, which may fix some other lingering issues
π€
I got worried becaus my CPU temperature went up - but it's doing a backup!! no udevd activity - whew!
It probably won't be until tomorrow when I can check. I'm sure it's good though. @solar whale and I had the same symptoms
So if it's fixed for him, it's probably fixed for me
its only checking for the second drive every few seconds
it was pretty much constant before π
@slender iron Haha gotcha
off to dinner; cyl
enjoy!
Ditto @tulip sleet
Ooh new build to make
@meager fog - FYI _ tried a vl53l0x on the M4 today (ardunio samd51) worked great!
bye @tulip sleet
Hmm, this is new. Bootloader shows up twice in Finder, but it's only mounted once in /Volumes/ on MacOS.
I'm not seeing that - on MacOS
Loaded new firmware, reset into bootloader, shows up once in Finder now. shrug
Loaded the firmware fine even when 2 showed up. No idea what was going on with that. I didn't think it was a real issue, I figured something on my end.
Got to the REPL just fine with main.py running!
Repeated the entire process multiple times. Consistently working perfectly!
just think of all the M4's that will be running blinky tonight....
@tulip sleet my backup finished and CPU cooled down - nice to see - no impact from M4 being connected.
@solar whale @tulip sleet I can confirm that as well. My cores are all purring along at under 5%.
π
Is there a statusboard somewhere on what's working/supported on CP3/M4 ?
@tulip sleet latest CP3 works for me as well on M4. main.py runs, ctrl-c to repl works. (on linux)
@umbral dagger As I'm not even sure what you're referring to, I have no answer. But I would like to know what you're asking about. What do you mean by statusboard?
@tidal kiln Nice!
Hello world 10.
Hello world 11.
Hello world 12.
Hello world 13.
Hello world 14.
Traceback (most recent call last):
File "main.py", line 8, in <module>
KeyboardInterrupt:
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 3.0.0-alpha.0-182-g949a8f5 on 2017-10-27; Metro M4 Express with samd51j19
>>> print("hello REPL!")
hello REPL!
>>>
@umbral dagger As far as I can tell the 3.0 milestone on git is as close as we have to a record of what is/isn't working:
https://github.com/adafruit/circuitpython/milestone/6
Oh now I get what he was asking. I was thinking a statusboard was a specific tool.
this is super cute
that said it's more in 'developer-speak' than normal mortal speak
Blinka by @deshipu on @hackadayio is a minimal CircuitPython board: https://t.co/6miqKBNwoO cc @adafruit @tannewt @tdicola
it's delightful
So true!
thanks, I should have a new version on Monday, without the hole in the neck and with a led in the eye
Fact: there needs to be a blinky Blinka running CP
so awsome
I ordered purple leds for the purpose
weeee
but for now will use an orange one, until they arrive
@river quest Throw @stuck elbow some $$$ and put these in the store!
I'd buy at least one
I got enough stuff from adafruit already, but the design of course is open source β I suspect @river quest could make something better on the backside than what I did
@pastel panther https://oshpark.com/shared_projects/s41LfLbB
you can order copies from oshpark
@tidal kiln Sure I can but @stuck elbow put some hard work into it and I would love to support him
we'll work something out together!
@stuck elbow once you're happy with the final design let us know
@river quest will do, thanks
keep up the good work, that was delightful to see today
it just had to be done, with osphark's colors
it is unavoidble
@slender iron heya do you have a min?
yup yup @meager fog
im running out of memory importing a non-mpy version of this
watit i didnt commit
hold on
do you see anything that i am doing that is super memory-bad. its running out on import
or should ij ust mpycross and be done with it
nothing jumps out at me
k i think its just a ton of math - but cant be helped
these sensors are very mathy
so theres a ton o code
yeah, it'd be interesting to look at the heap chart for it at some point
(shrug) ok ill mpy
By the way, I noticed that using slots in the classes saves a ton of memory
@meager fog seems to import ok for me:
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> import adafruit_bme280
>>>
perhaps we should start doing it for the drivers
@slender iron I thought you just had typing that figured out, I didn't realise it was built in. lol.
π
I mean __slots__
slots aren't in cp
oh dont forget to use
import board
import digitalio
import busio
import time
import adafruitbme280
since you need those
ahhhhhh
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> import adafruit_bme280
>>> import board
>>> import digitalio
>>> import busio
>>> import time
>>>
@stuck elbow really? hmmm. dan and i were talking about that a few days ago. didn't seem to work.
maybe it's a placebo effect
@meager fog still works, i think. maybe?
@idle owl I mean the status of various thing: SPI Flash, I2C, SPI, etc
@umbral dagger I figured out what you meant when siddacious responded.
@umbral dagger Did you see the 3.0 milestone?
@umbral dagger Thank you though. I was wondering π
@pastel panther open issues.. that pretty much covers it.
there is a 3.0 beta milestone as well
I think thats what I meant
wait. no. weird. @meager fog import order matters. :(
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> import board
>>> import digitalio
>>> import busio
>>> import time
>>> import adafruit_bme280
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError:
>>>
Hey everybody... So... I'm all about learning some circuitpython... I swear I am. However.. tomorrow being trick-or-treat... I'm kind of under the gun. How can I "un-circuit python" my gemma M0? I can't seem to get the arduino IDE to load to it (I think it's because it's mounting as a drive.)
"If it wasn't for the last minute... nothing would get done."
that is weird
so. uhhh. just import it first?
@thin badge https://learn.adafruit.com/adafruit-gemma-m0/using-with-arduino-ide#manually-bootloading
Thanks... I did some searching (I swear), but was in a panic.
@stuck elbow @digital urchin I'd buy it. It'd be awesome to hand out to people who are curious. CircuitPython on a PythonCircuit.
Having lots of fun with my CPX. With all that hardware included, it's simply "Code-n-Go". Gotta love embedded. ><>
What can this thing do?
@stuck elbow we were talking about using __slots__ as a way to prevent accidentally creating a new member variable due to a typo
using python3:
>>> class C:
... __slots__ = ('a', 'b')
...
>>> c = C()
>>> c.a = 23
>>> c.a = 42
>>> c.c = 3.14
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'C' object has no attribute 'c'
>>>
but on cp:
>>> class C:
... __slots__ = ('a', 'b')
...
...
...
>>> c = C()
>>> c.a = 23
>>> c.b = 42
>>> c.c = 3.14
but it does seem to use less memory
maybe it's still using a dict, but setting the default size differently?
interesting. we weren't looking at that aspect.
@pastel panther you around?
@slender iron Yup
I actually also removed inheritance, so that might have been it
I know this is very unscientific, sorry
@slender iron Will do; I'm about to head home so I'll report back in 15 minutes or so
kk thanks!
@thin badge did that work?
Im going through it right now. (Grabbed dinner quick)
Im all about re-visiting the python aspect, just time got away from me and... well you know the rest of the story Im sure.
you should be able to go back and forth anytime you want
π
I've got another 4 gemma M0 waiting... I went WAY too overboard with halloween this year. lol
only danger is loosing any python programs you've stored on a non-express device when going to arduino.
My profession has been focused around SCM for the last 15 years (now admin'ing a github enterprise instance.) If I lose code, I deserve to be publically flogged and/or shamed... π
BOOM! working great. You guys kick all sorts of butt... Thank you so much. π
excellent
@thin badge That's great!
Back from dinner. Appears that @slender iron has been busy
@thin badge when you want to go back the other way: https://learn.adafruit.com/adafruit-gemma-m0/circuitpython#reinstalling-and-updating-circuitpython
@tidal kiln happy to be in the same page as everyone now?
@tidal kiln FANtastic... π
M4 Flashed with current firmware and whatnot
@tidal kiln I'd say you're with us.
maybe i just missed all the early adopter fun
Hours of fumbling. Not sure how much I even learned. It did mean a lot of repetitive commands... so that helped.
This is still early adopter fun. Can't purchase the board yet, thats pretty cool in itself
oh nice... not having to hit the bootloader button on the M0 is a much welcome improvement... π
thanks again guys... going back to the "hard part" (assembly)...
@thin badge Have fun!
@thin badge good luck π
@slender iron No dice:
USBMSC Identifier (non-unique): 0x00000000 0x239a 0x8021 0x100, 1
0 0 AppleUSBCDCACMControl: getFunctionalDescriptors - Descriptors are incorrect, checking...
0 1 AppleUSBCDCACMData: start - Find CDC driver for ACM data interface failed
0 1 AppleUSBCDCECMData: start - Find CDC driver for ECM data interface failed
AppleUSBCDC: Version number - 4.3.2b1
hah
hello caps
Loudly. π
I mean, seems appropriate
well, that is how your keyboard sounds
true
π
@slender iron let me know if you need more data
kk, I'll keep poking next week. I'm done for now. just waiting for mario to come π
@slender iron If I try to use my m4 with arduino, will it bork the bootloader you gave me?
nope! they should work together
@pastel panther you do have to manually enter the Bootloader every time you want to upload a new sketch in Arduino. Otherwise it works fine.
@solar whale thanks
Assuming you installed the adafruit samd51 support for arduino
yea, working through it now
On Linux or mac
mac
anyone here wanna try my BME280 driver??
Humidity: 53.6 %
Pressure: 1016.2 hPa
Altitude = -25.09 meters
yes - pressure is a tad high
whats the weather station say?
@solar whale the instructions say dragging the CMSIS Device folder from the zip to the same in the Arduino Library will cause them to merge but OSX wants to replace the original. Should I replace it or find the diffs and apply them?
@pastel panther go ahead and replace
@meager fog bmp280 says 1017.2 - bme280 is 1016.3 - weather station a few miles away ia 1018.2
temp amd humidity look OK
You're welcom - thanks for the drivers!
@pastel panther on linux I found it best to delete the old folder and replace!
I should have just mv'd it but I think finder did the same
yup
we have blinks!
@pastel panther Nice!
now I just need something to do to amaze myself with how fast the M4 is
thanks for the help @solar whale
Hmmm.. BME280 looks nice. I was planning to add a BMP280 to my sdesign that already has an Si7021. BME 280 looks like a nice alternative. A touch more $ overall, but simpler board design and lower part count. I feel a largish order coming on.
Question pulse green on the 16bit neopixel what does that mean?
@normal mica Do you have any context? I'm guessing it means a neopixel should be expected to glow increasingly then decreasingly green
or rather glow green with increasing then decreasing brightness, probably in a cycle
@normal mica in CircuitPython?
Yes
@formal plover 's got your back
@normal mica Can you post your code please?
This is from a John Park project isn't it?
put it in back ticks ` for good formatting
Yes
These: https://youtu.be/-CNIp6EtVY8
Build your own: https://learn.adafruit.com/gemma_m0_clockwork_goggles/overview Goggles are a great accessory for dressing up your costume -- be it for Hallow...
Sorry, just posting the references
Speaking of those goggles, I think Rezz uses a pair
@idle owl you rock
Ooh did that fix it?
@normal mica That's great!
wew!
Niceeeeeee!!!
p.s this my first project on python

congrats!
Well that's awesome @normal mica
@normal mica Yeah! Great job!
@normal mica Nice. I'm not far behind you in that respect.
Now that it's working you can learn more about things like loops and if/else statements to animate the rings
π
Though I think there are some built in animations in the neopixel library
@normal mica yay! So glad youβve got them working β Iβm honored!
@split ocean im excited yayyyyyyy sorry bg kid 
how can i make the pattern go a bit faster?
Looking at the code.
def brass_cycle(wait, patternL, patternR):
# patterns do different things, try:
# 1 blink
# 24 chase w pause
# 64 chase
# 96 parial chase
# 128 half turn
# 230 quarter turn w blink
# 256 quarter turn
for j in range(255):
for i in range(len(stripLeft)):
idxL = int ((i * patternL / len(stripLeft)) + j)
stripLeft[i] = cog(idxL & 64) #sets the second (brass) color
idxR = int ((i * patternR / len(stripRight)) + j)
stripRight[i] = cog(idxR & 64) #sets the second (brass) color
stripLeft.show()
stripRight.show()
time.sleep(wait)
while True:
brass_cycle(.00001, 1, 1) # brass color cycle with 1ms delay per step
# patternL, patternR
You changed the right thing. Changing the first number after brass_cycle should have sped it up.
When you paste code, surround it with three backticks - the one in the upper left corner of your keyboard. A single backtick makes it inline code and surrounding it by three backticks on either side makes it a codeblock
# patterns do different things, try:
# 1 blink
# 24 chase w pause
# 64 chase
# 96 parial chase
# 128 half turn
# 230 quarter turn w blink
# 256 quarter turn
for j in range(255):
for i in range(len(stripLeft)):
idxL = int ((i * patternL / len(stripLeft)) + j)
stripLeft[i] = cog(idxL & 64) #sets the second (brass) color
idxR = int ((i * patternR / len(stripRight)) + j)
stripRight[i] = cog(idxR & 64) #sets the second (brass) color
stripLeft.show()
stripRight.show()
time.sleep(wait)
while True:
brass_cycle(.00001, 1, 1) # brass color cycle with 1ms delay per step
# patternL, patternR
Yeah! Nice!
oh cool i wondering what was you talking about but i got it π
code.py (code.txt and main.py also work)
@normal mica As will main.txt
import board
import neopixel
import time
try:
import urandom as random # for v1.0 API support
except ImportError:
import random
numpix = 24 # Number of NeoPixels
pixpin = board.D0 # Pin where NeoPixels are connected
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.3)
mode = 0 # Current animation effect
offset = 0 # Position of spinner animation
color = [255, 0, 0] # RGB color - red
prevtime = time.monotonic() # Time of last animation mode switch
while True: # Loop forever...
if mode == 0: # Random sparkles - lights just one LED at a time
i = random.randint(0, numpix - 1) # Choose random pixel
strip[i] = color # Set it to current color
strip.write() # Refresh LED states
# Set same pixel to "off" color now but DON'T refresh...
# it stays on for now...bot this and the next random
# pixel will be refreshed on the next pass.
strip[i] = [0,0,0]
time.sleep(0.008) # 8 millisecond delay
elif mode == 1: # Spinny wheels
# A little trick here: pixels are processed in groups of 8
# (with 2 of 8 on at a time), NeoPixel rings are 24 pixels
# (8*3) and 16 pixels (8*2), so we can issue the same data
# to both rings and it appears correct and contiguous
# (also, the pixel order is different between the two ring
# types, so we get the reversed motion on #2 for free).
for i in range(numpix): # For each LED...
if ((offset + i) & 7) < 2: # 2 pixels out of 8...
strip[i] = color # are set to current color
else:
strip[i] = [0,0,0] # other pixels are off
strip.write() # Refresh LED states
time.sleep(0.04) # 40 millisecond delay
offset += 1 # Shift animation by 1 pixel on next frame
if offset >= 8: offset = 0
i would like to add a second neopixel ring how can i do it ???
You would need to create a second NeoPixel object. E.g. copy and past the declarations for the first one and do something like pixpin2 = board.D1 # Pin where NeoPixels are connected strip2 = neopixel.NeoPixel(pixpin2, numpix, brightness=0.3)
@normal mica @glacial bronze Or you could chain the rings together (Dout of first to Din of the second) and make numpix twice as big. The first half of strip will be the first ring, the second half will be the second ring. This is one of the joys of neopixels (and dotstars)
This also break rgb.py in adafruit_rgb_display:
>>> import tft_m0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tft_m0.py", line 32, in <module>
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 93, in fill
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 82, in fill_rectangle
File "...
woohoo! - thanks @umbral dagger ```
Adafruit CircuitPython 2.1.0-3-gbd7abcd on 2017-10-28; Hacked Feather M0 Express with 8Mbyte SPI flash with samd21g18
/dev/sdc1 8155 185 7970 3% /media/jerryneedell/CIRCUITPY
@solar whale time to hook up every sensor you own. Haha
@solar whale @formal plover It doesnβt help with ram, though π¦
@umbral dagger that's true
no - but it makes my feather m0 special
@solar whale @formal plover Which is why Iβm really hoping to see a board with a SAMD51x20 for the full 256k ram.
also nice for datalogging
@solar whale not so much π I have 2 at the moment. One to test it out, and another since I neglected to take pics while I made the first one.
@umbral dagger well then you need the other top secret board.
@solar whale Also great for const data: sounds, images, neural net link weights π
Feather code name wompus
@formal plover just wait until 3.0/M4 supports SPI flash π
@umbral dagger Haha that's true
Iβm wondering how much work it would be to add some of the quad spi flash. @tulip sleet sounds like he might be familiar.
be careful if you buld 2.x from current master - it breaks many i2c and SPI drivers. I have a workaroud for i2c, but not SPI yet
I have to make sure I have the bootloader ready to go for the M4. It only takes a couple mins to drive up the CPU on my Pi till its locked up
Grab the file and go lol
@formal plover @solar whale The other advantage to using an x20 chip is a full Meg of flash onchip. Given that these boards are aimed at smallish, single purpose use a meg should be plenty (other than needing a ton of data)
So I was looking at the Adafruit Blog feed... Most recent post is about Mu Python editor: https://codewith.mu/ @plucky flint and Carrie Anne Philbin
The idea makes sense for beginners. Which is also why the Arduino IDE is good: simple, basic, no bells & whistles. Just enough to get the job done.
Which is also why I can't stand it π
Haha yeah, awesome that there's something available like this for beginners though
Exactly
It's all about lowering the barrier to entry, but having a path to follow as you gain experience.
@formal plover if/when you want to try arduino on the M4 - I have modified the guide ladyada made for the Mac to include a few notes for linux. You also need an updated Pi version of bossac which I can provide if you need it or you can build it from the link in the readme (just make sure you build the arduino branch) - the modified instructions are at https://github.com/jerryneedell/ArduinoCore-samd/blob/samd51/README.md
@solar whale I am looking forward to that. So. Much. Room.
@solar whale I mean, I made a smarthome sensor node with a handfull of sensors, and an RF mesh network, Led and Neopixel output, all on a ATMEGA328. Imagine what more I can do on an ATSAMD51! Audio I/O and a people detector using the AMG8833... for starters.
Iβm really curious about how much of that I can do in CP.
Thanks @solar whale. I have to spin up a new Pi first, then I'll probably give it a try

might be worth detecting this kinda thing at the 'end' of the list of files we run - windows tries to be 'smart' and not show extensions!
@solar whale plz submit a PR with your fixes π
@meager fog I'll submit the linux update now - still working on the Pi permissions so I add that when I figure it out. The installation is the same as Linux.
@solar whale I had a lot of problems getting boards to communicate in Linux due to security. I think I was using Mint or elementary. When I use Arduino on the Pi I didn't have any issues.
@formal plover the only prblem I am seeing is that Arduino claims it does not have permission to access /dev/ttyACM0 I did not have this probem before the update so it may be related. - I can force it by setting the permission manually before I try an uplaod, but I'd like to find a cleaner fix. user pi should be a member of group dialout and /dev/ttyACM0 should ahave group write permission for dialout, but something does not get set up correctly.
@formal plover did you add these udev rules? https://learn.adafruit.com/adafruit-arduino-ide-setup/linux-setup#udev-rules
That will fix permission problems.
@tulip sleet sure did. Always ran into issues. I would have to apply the rules multiple times or launch the app as root. This was quite some time ago
I just made the comment because it looks like @solar whale is having similar issues
@tulip sleet No! had not seen tht - I'll give it a try - thanks
@tulip sleet I have never had permission issues before so I had not looked into it.
It should fix the problem @solar whale. This was back when I was really into tinkering with Linux and I'm sure my experiments interfered
Lol
I found I had to use the second set of commands to enable the rules without rebooting.
@meager fog How do you want to get the linux bossac out there. Can I make aPR to add it to the release page?
If you haven't noticed, I have a lazy factor and tend to try to do everything on the same box. I have like 6 Raspberry Pis, but do everything on just one.
@meager fog linux bossac may be more complicated - I tried executing my Ubuntu bossac on a CentOS system and it failed to find some dynamic libs - Let me see if I can build a static version or else users can just clone BOSSA and build it locally
But thank you @tulip sleet for having that link handy for @solar whale
@formal plover yw. I was at my son's swim practice and had 5 mins to jump in.
Has anyone here gotten MicroPython building on Linux? Not a cross compiled CP, but MP to run on linux.
Cool.. I think I see my issue. mpy-cross has to be built separately?
@umbral dagger yeah you have to build it explicitly, for some reason.
spi
Hello @bronze geyser
Ugh... sorry @idle owl I'm back to attempting writing a SPI library for circuitpython (ESP826). So...um...I type SPI...i guess i think that should write the lib all by itself :-)...anywho, i recall a link at one time to a github that would make my life swimmingly easier for spi lib creation...do you happen to know the link?
I don't, unfortunately. I can try to help look for it though. Do you have any more specifics?
Are you going to try to port it from Arduino or are you looking for one in Python?
Something like this maybe? https://github.com/doceme/py-spidev
Oh..I don't want to be a bother. Awhile back Scott posted a link I can't find it...it's a port from Arduino. I'm looking at TonyD's for an I2C that was in the learning section...just thought there might be a specific for SPI. ...perhaps that is the link. I'll check but I though spidev was for like Raspberry Pi...of course, I am clueless. Which can be a problem at times...
It's no bother! It could be for RPi, I'm not sure, I only scanned it. spidev rang a bell for me from somewhere, so I grabbed it. I could be remembering it from working with RPis.
you are kind. Thank you. i've been looking at this https://learn.adafruit.com/porting-an-arduino-library-to-circuitpython-vl6180x-distance-sensor/overview
and started looking at this. https://github.com/adafruit/Adafruit_CircuitPython_MAX31855
Ah, ok, nice!
oops...i apologize...it is challenging getting older.
It's understandable! The bot can be finnicky sometimes.
My library writing knowledge is limited, and my Arduino knowledge is none. So other than general searches, I'm not sure what else to look for. If you're still struggling by Monday, check back in here. It's usually pretty quiet over the weekends.
Further adventures in the MP compiler π This will be quite a rabbithole.
again, thank you for your kindness. i am pretty sure i can get stuff working at this point.
Ok, that's great!
@bronze geyser If you do find the link you're thinking of, let me know so I have it for future reference. Sounds like a good thing to have. π
@umbral dagger Anything specific today? Or just more diving
@idle owl will do. Please have a most excellent weekend and find many things to smile about.
@bronze geyser Thank you! You too!
@idle owl I'm fiddling with the idea of adding a debugger.
Oh nice
So really, more digging into the runtime than the compiler. But it's all related
Gotcha
OK, I've figured out how to add a builtin function to MP.
@umbral dagger Nice!
Simple, yet convoluted.
Loads of preprocessor magic. Horrible, but it does let you do a lot at compile time, and this environment understandably focused on runtime efficiency.
That's really neat. This is definitely way outside my skill set but I understand what you're getting at
@umbral dagger how 'bout them QSTR macros - there are special expansions for non-identifier characters (we didn't invent all that)
@tulip sleet Thatβs some crazy stuff.
Now to dig into the runtime itself. Scopes, closures, etc.
actually, i realize a lot of the qstr stuff is in the in the py/*.py preprocessor files.
we have had to do essentially nothing to fix any python language problems: that part is quite robust and stable
That's handy
@tulip sleet It looks it.
My goal is to use SPI on circuitpython to send a byte containing the register address and receive the contents of the address. here is my SPI config: spi.configure(baudrate=200000,phase=0,polarity=1) In Arduino, I can also say MSBFirst -> SPISettings settings(200000, MSBFIRST, SPI_MODE2); I don't seem to be able to setup the SPI config in circuitpython to take into account data order. What am i missing?
do you really need to change the data order?
if so, you might need to reverse the bits in the bytes you are sending yourself
HI @stuck elbow I don't know. I'm getting 0xff's back from the read...so I was trying a few things. I'm challenged right now because I don't have a logic analyzer with me...
while not spi.try_lock():
pass
try:
spi.configure(baudrate=200000,phase=0,polarity=1)
cs.value = False
usleep(10)
ATM90_SysStatus = const(0x01)
spi.write(bytearray([ATM90_SysStatus]))
usleep(4)
result = bytearray(2)
spi.readinto(result)
cs.value = True
finally:
spi.unlock()
print(result)
0xff at polarity 1 means the wire is just low all thetime
are you sure you don't have to wiggle the cs to acknowledge the transfer?
i'm clueless on what "wiggle the cs" means to do.
release it and assert again
switch to high and then to low
by the way, 0xff with reversed bit order is still 0xff...
thanks. So wiggling didn't do anything (assuming I am correct in understanding by wiggling you're thinking every time i read/write I turn from hi/lo /reset the CS pin)
spi.write(bytearray([ATM90_SysStatus]))
usleep(4)
cs.value = True
cs.value = False
result = bytearray(2)
spi.readinto(result)
i'm also used to in arduino goo to use xfer instead of write then read. I was wondering why there was no xfer in circuitpython's SPI library?
if you need to do a read at the same time as write, there is write_value parameter for the readinto
ok. Thank you. I will give that a go. Perhaps I am "stuck" until I can get to my logic analyzer...
re: write_value ... I don't see this in the docs? http://circuitpython.readthedocs.io/en/programming_guide/shared-bindings/bitbangio/SPI.html?highlight=readinto#bitbangio.SPI.readinto
@bronze geyser I hope you've managed to make some headway with your project! π When you paste code, if you surround it with backticks (the one in the top left corner of your keyboard), it'll format it as code. One backtick on either side makes it inline code and three on either side makes it a codeblockIt helps with readability
result = bytearray(2) spi.readinto(result, start=0, end=len(result), write_value=ATM90_SysStatus) usleep(4)
@bronze geyser Yeah!
ok. I hope to remember. Thank you.
It took me weeks to figure that out... π So I try to share it when I can.
@bronze geyser You're welcome. How goes the project?
oh. thanks for asking. Didn't get it to work. I'd like to use a logic analyzer. i won't be able to until Tuesday. So i'm pretty much wasting time at this point...
Oh, yeah, having the right tools can mean everything. I know that feeling though, half the time I still keep poking at it thinking something will change even though I know it won't.
yah - and then at the end of it all i feel kinda sleezy....as if i ate alot of oily food. but no, it's just because i'm fixated...knowing nothing is going to change...but still doing it...um...wait a second...that is EVERY DAY OF MY LIFE π
π I totally get it. Getting hyperfocused into something.
This is NEW (as in recently updated - OCT 2017). https://cdn-learn.adafruit.com/downloads/pdf/building-and-running-micropython-on-the-esp8266.pdf
@slender iron are you aware of the problem of gcc compile script doing some weird things to micropython.exe.exe on windows. Seems to be an issue.
@hollow tartan I don't know what micropython.exe is
@idle owl @bronze geyser I'm around for a bit if you have questions. I'm not sure where you are at on the SPI stuff
we don't have transfer yet because its rarely used. we do need it for an upcomign product though so we will be adding it. there is a bug with a 2.x milestone for it
@slender iron finally had some time to fire up the nrf52840 Dev Kit --- demos are working fine and I'm trying to wrap my head around the SDK - so far made a blinky!!
Yeah I dunno what micropython exe is either @hollow tartan
@slender iron thanks for the shout out. My challenge is I need to send the register value then read the two bytes. Is it possible for you to write a small bit of code that tells the chip to send the two bytes within register 0x01?
@slender iron I am looking for the link. xtensa-lx106 gets blown away at the end of the compile because of some environment variable(s) that messes the installation up.
@slender iron here's what i'm doing: `import board
import busio
import digitalio
import time
usleep = lambda x: time.sleep(x/1000000.0)
#ATM90_SysStatus = const(0x01)
cs = digitalio.DigitalInOut(board.GPIO0)
cs.direction = digitalio.Direction.OUTPUT
cs.value = True
spi = busio.SPI(clock=board.SCK,MISO=board.MISO,MOSI=board.MOSI)
while not spi.try_lock():
pass
try:
spi.configure(baudrate=200000,phase=0,polarity=1)
cs.value = False
usleep(10)
ATM90_SysStatus = const(0x01)
spi.write(bytearray([ATM90_SysStatus]), start=0, end=1)
result = bytearray(2)
spi.readinto(result)
usleep(4)
cs.value = True
finally:
spi.unlock()
print(result)
`
I am currently on my 5th go around on the installation of ubuntu et al.
@slender iron @formal plover this is it: https://github.com/micropython/micropython/issues/3361
I need some ideas for work around. I could make a archive of the /ports/esp8266 folder and some other folders within linux. Or I could have VirtualBox make a backup of the entire BOX.
@hollow tartan so you're actually trying to build micropython?
@Kurt Yes, I am. Although, I would rather be racking my brain against the M4 Metro.
@hollow tartan I don't understand why you are using mingw if you are doing the build in an Ubuntu VirtualBox. Did you give up on the vagrant installation?
@solar whale Ok. maybe it is not mingw, but the error is the VERY similar.
yes, I have and am following the learn.adafruit instructions for compiling micropython using Ubuntu VirtualBox. No, I have not given up - yet. But, if it crashes on me again, I probably will.
@hollow tartan I did enter a "feedback" note regarding the rro about the new ports/ directory , but I think you are aware of that. Can you provide some detaisl about what step is failing - did make axtls work OK - is it failing in make?
@ jerryn I am glad you did that. Yes, the "make axtls" is exactly where it runs into problems. What is the link for that github feedback? I would like to follow their responses.
@hollow tartan you are running make axtls in ~/micropython/ports/esp8266 -- correct?
yes.
@hollow tartan there is a feedback link on every learn guide - scroll down left side to last link. https://learn.adafruit.com/building-and-running-micropython-on-the-esp8266
I was thinking what I could do to help that . maybe $cp -r ./ports/esp8266 ./
@solar whale Ah cool. I can use that guide! I just got the ESP8266 breakout.
why do you need to do anything - just leave it as is
@hollow tartan you don't have to fix anything - just cd to micropython/ports/esp8266 and run make axtls
I want to save myself the time of rebuilding the files again and again. and I know axtls is going to break it.
My exploration of the MP/CP runtime continues. What features would yβall like in a debugger?
I don't understnad - you dont have to. You only do the make axtls once anyway
@hollow tartan once installed I just run make clenn then make in ports/esp8266
nothing has to be rebuilt
@solar whale and if I modify some of the micropython source to test "the ignored arguments" issue - do I not have to run the axtls part again?
@hollow tartan If you ony moidufy things in the esp8266 code then I don't see why you would need to - I don;t know what you are changing - I am running an install myself now
@solar whale the trouble with axtls did not come into play until I wanted to install vagrant 2.0 so I would have Ubuntu 16.x
@hollow tartan I just ran a clean install in an Ubuntu Virtual Box and it all warkes as inthe guide - the only change is the cd to ports/esp8266 for the make axtls and the final make of the esp8266 image.
where did you have to choose vagrant2.0 doesnt it get instelled by the steps in the guide?
@solar whale you got a clean .bin under Windows ubuntu VB? and which Vagrant did you install?
in the archive of older Vagrant releases.
I am not using windows, but the virtual box should be system independent.
what do you mean which Vagrant? - I installed teh one in the guide git clone https://github.com/adafruit/esp8266-micropython-vagrant.git cd esp8266-micropython-vagrant
You may have spotted my bad assumption right there.
??
I down loaded from the hashicorp website . vagrant_1.9.7_x86_64.msi
https://releases.hashicorp.com/vagrant/1.9.7/vagrant_1.9
or the 2.0 one in ADDITION TO git clone ....
@hollow tartan ah - I recommend atarting over and doing it just as in the guide - (win the extra ports/ ) It does not take very long.
@hollow tartan I have to go for awhile -- good luck - belive me - it really works!!
Darn it all.
I need to go ride my bike and loose some of this pressure I have put on myself.
Don't give up - just take a break - It'll go much more smoothly next time.
@bronze geyser that seems like it should work to me.
spi device here is meant to make it easier: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
@hollow tartan keep trying, getting a vagrant VM up and running will be good for the M0 and M4 as well. In fact, you can try building the samd variant even though you don't have a board yet
@solar whale will be getting a big HUG for helping me with my personnal vagrant challenge.
π @solar whale is awesome
@slender iron Stupid question: can/should bossac be used to flash .bins spit out by arm-non-eabi-gcc when compiling ASF4 example code?
the only thing to make sure of is the offset in your linker script
m0 = 8k, m4 = 16k
That specifies the offset in memory to avoid the bootloader?
Hm. no clear 8k specification in the .ld file but I should see something in the docs
aaaaaah, I got it (I think). Just read the samd21x18-bootloader.ld and realized that 0x2000 in hex = 8k
so adding shifting the rx/rom start by 0x2000/8k leaves 8k for the bootloader at the start of the rom
Once again I learn things by reading the code of folks smarter than me
yup, exactly @pastel panther
@slender iron well, i got it compiled and flashed seemingly successfully but the code does not seem to work π
with arm-gcc directly?
ya, with the makefile that came with the example. It's one of the START examples. Supposed to be a blinky but it doesn't blink. Suspiciously the D13 led pulses instead.
I fixed the pin mapping to match the metro but no bueno
is it on an m4 or m0?
hrm, the led fading is the bootloader still
like it's not getting to the code for some reason?
yeah
the bootloader will check the validity of the reset vector location and not jump to if its out of range
What would I look for to confirm that? Is it something in the linker script?
yeah, I think its usually the linker script isn't right
That wouldn't surprise me; I modified the script that came with the example and subbed in the MEMORY section from the samd21x18-bootloader.ld from the CP repo
I wonder if the change threw off some math elsewhere
whats the top of the file look like?
its also worth triple checking thats the file used
The top of the linker script I compiled with?
yup
ooh, just saw a warning
./samd21a/gcc/gcc/samd21j18a_flash.ld:119: warning: memory region `ram' not declared
seems not great?
FLASH (rx) : ORIGIN = 0x00000000 + 0x2000, LENGTH = 0x00040000 - 0x2000 thats the bit you want
here's the top: ```OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions /
MEMORY
{
/ Leave 8KiB for the bootloader, and 64k for the flash file system. /
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000 - 0x2000 - 0x010000
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x008000 / 32 KiB */
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(stack_size) ? stack_size : 0x2000;
It might look familiar :p
what was it originally?
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ah ok, so its the names on the left that matter
aaaaaah
you just need origin 0x2000 and length - 0x2000
(the length doesn't matter unless you have a bunch of code
of course they are. This is what I get for copy-pasting
you don't need the - 0x1000... because thats for the internal filesystem
π
Dude, you don't even know. I've been trying to get to this point for almost a month. Given, I haven't been trying that hard/smart but none the less...
π glad you got it going! feel free to ask me more about it
I'm sure I will but now I'm probably going to a) have a beer (I'll pour one out for you) b) look at some of the more useful examples to finally get some experience with some of the sweet peripherals
I feel like I have two ends of a bridge now, one side is the simple blinky and basic code examples and the other side is the 3.0/ASF4 CP code and hopefully I'll be able to close the gap before too long
don't be afraid to jump into circuitpython either
I'm not all that much but I feel like I need a slightly better idea of what's going on so I can know what a reasonable visible change would be. Does that make sense? Like I can compile and flash CP fine, but I wouldn't know what to change to know that I had done something that made a difference, useful or not. My one idea was changing the text on the REPL but that's not an option just yet
if you have any ideas let me know and I can point you the right places
the issue list is a good starting point too
no problem, good work!
<@&356864093652516868> We're on for our normal meeting time tomorrow (Monday) at 11am PT / 2pm ET. We'll do the normal State of CircuitPython, Hug Reports, Status Update and then open discussion. Thanks!
Is this chan strictly for citcuitpython/python help or can I ask for coding help on Arduino IDE?
@rain charm I would suggest just posting in #help-with-projects for Arduino help.
@slender iron I plan to attend todayβs meeting as long as batteries hold out. No power due to storm last night.
+1 what @formal plover said, @rain charm
@drowsy geyser yeah @rain charm posted there right after I mentioned it.
You might have an answer to the question.
@slender iron @tulip sleet i tried adafruit_lis3dh (from bundle 2.1) on a 3.0 CPX build. I got an " module ustruct does not exist" error message. I was surprised since bundle 2.1 was built after I made the struct to ustruct changes. I did a little research and saw that 2.1 was built with tag 0.1.2, which was created on jun 19, i.e., older code. i assume this was intentional.
Not to nag (really), but what's the status on the busio port to 3.0? Just curious; I have a couple of sensors I want to test but am blocked on busio (and don't have the chops to port it myself). π
@drowsy geyser dan was starting to look into busio. my focus is getting usb solid still
and I don't believe you when you say you don't have the chops to do it π
Thanks, @slender iron. Appreciate the information! And the confidence!
@slender iron I won't be available for CircuitPython the weekly πΏ
@formal plover thanks for all of your help anyway! I'll record it as always
Hug report: Hugs for, I be giving out hugs like Oprah.
I'm happy that the M4 high CPU usage has been resolved. π 
Thank you @slender iron!
@formal plover are you still having trouble with a bootloader?
I just got another Pi imaged, I haven't flashed the new bootloader yet, I was just judging it was resolved based off of what @solar whale has reported
yeah, in circuitpython I fixed it with linux
I didn't know a bootloader was having trouble though
Is it? Lol
When did I say that?
If I reported it, it had to of been on an older version of the bootloader, not the current
Any Linux issues have been in line with Pi issues. I haven't seen any Raspberry Pi specific issues yet.
So if the bootloader is good with Linux, it's good with the Pi. So far at least Haha.
ok perfect!
π
@formal plover @slender iron Sorry for kibitzing but this discusion brings back memories of meetings with whiteboards and flowcharts and code snippets and version discussions etc. Now it's done this way with Discord. If you guy's only knew how good you got it. Keep up the good work. My CPX projects are doing fine thanks to your porting. Make a good day. :)
<>
lol, from the forums: "Aha! Success! Just in case anyone else needs this, I had to change the third line -> neopixel.NeoPixel (capital N)
Also: 255 is BRIGHT"
yup yup @lofty topaz! I never thought I'd be a project manager
glad you are enjoying it
Has anyone tried getting REPL on an Android device?
Python on my phone? Sure, why not? It's a computer, right? Can't help ya tho. Sorry.
I'm poking at it now, seeing what sort of apps are good for it
@cunning crypt I think @timber lion has tried it but the terminal apps on android are sad
Just wondering if anyone had tried
Testing this to see if I can fix it another way. I'm using an SHT31 humidity sensor at I2C 0x44 (no library, but it doesn't matter).
import board,busio
i2c = busio.I2C(board.SCL, board.SDA)
i2c.try_lock()
b0 = bytearray(0)
i2c.readfrom_into(0x44, b0)
hard-crashes only the first time the device is referenced. If I press reset without power-cycling, I get an OSError the second time. I have to power-cycle the SHT31 to cause a hard crash.
I am.... not surprised
@formal plover @slender iron the only lingering issue I am aware of with the Bootloader is that arduino requires manual Bootloader entry for every load. That fix is still pending.
@solar whale yeah, dean and I discussed it last week. he was using a different magic number in the bootloader than we are in circuitpython to tell the bootloader to not launch the app
we'll sort it out
No rush, works fine
Well, I kinda got it. If it's in bootloader mode, the various serial terminals will see it and "connect" to it
but if it's in CP mode, none of them see it as a USB device that can be conneted to
It shows up in the file manager under USB so you can do normal CP files with it, but no REPL
yeah android terminal apps are really bad i've found
they have to package in their own drivers so it's a real mess if one app supports a FTDI chip vs. SiLabs etc
and they're all just barebones apps that are effectively a reskin of a sample program google made
but with very confusing options etc
it's been about 6 months since i looked at them though
so perhaps someone has made the 'one true serial terminal app' to rule them all
but don't expect something polished like inbox, facebook, etc :/
Hey! Tony, how ya doin? Can you please tell me when your webcasts are? I keep looking for them on Friday nights. What am I missing?
hey, yeah I haven't done them in a while.. life got busy and folks have other priorities for me π
hopefully coming back soon
Ah, no wonder! Ok, thanks for the info. Do what ya gotta do, right. But please come back soon. Code is my forte, hardware is just a medium to execute it with.
@lofty topaz You are pretty much my opposite
@cunning crypt π
Code and I.... Well, I can get it to work, but beyond that I'm not the greatest. Hardware, on the other hand, I can pretend I'm not terrible at.
@cunning crypt Looks like the guys are having their meeting. Yeah, I've been a hardware/software guy since 1977. Built Z80 based micros in the 80's and 90's then went strictly software for Windows, the Web, and Tablets and Smartphones, and then I dropped it all, retired, and went back to hardware with the Arduino. I love it. Now, CircuitPython is the name of the game. It's great.
I've always been tinkering with things. Very few of the electronic toys that my parents got me when I was younger survived completely, because I always ended up taking them apart. And then trying to modify them
i would happy to do this one. "read_into" is mo' python-like, no?
Bingo, hacking at its best. Now I just play with my projects. The hardware is practicly Plug-n-Play and then you just have to Code-n-Go. And best of all, with Arduino and CircuitPython, NO OS. That's why I will have nothing to do with Raspberry Pi. I got one, played with it. Command line? Seriously? Forget it. No thanks.
Heh
I have many pis. I do little with them.
On the other hand, I have boxes full of prototype PCBs. Just.... circuit boards on ciruit boards
Most don't even have any components on them. I only needed one board to test, but it's cheaper and easier to get 5 or 10
@fading solstice adafruit_lis3dh 0.1.2 was put in the bundle because that's the last release with a tag. The commits after that haven't been tagged. So we need a release.
<@&356864093652516868> starting the meeting!
mic issues again1?!?!?!
HR to Scott for helping me with getting my ASF4 code flashed and for putting in work to get my (not so) ancient mac working with the M4.
On chickens and pigs: https://www.mountaingoatsoftware.com/agile/scrum/roles/the-chicken-and-the-pig
re: CircuitPython, I'm an interested party but I don't have "skin in the game" like the rest of you on the call who are actually hacking on CP!
Iβve been dorking around with my LED matrix and re-found the Adafruit::GFX Arduino lib. Would it be worth porting? If so would it make sense to do it as pure CP or to try and leave some parts in C?
Otherwise Iβm doing ASF4 tomfoolery trying to become more familiar with the framework. With luck Iβll be able to work on some simpler CP commits before too long.
hah
yay! GJ @timber lion
@pastel panther CPMM, Copy, Paste, Meld, Morph. Copy what you need, Paste it where you need it, Meld the data, then Morph the code. Build, Test, Commit. Bingo, bango bongo, as we used to say!
@pastel panther https://learn.adafruit.com/micropython-displays-drawing-shapes/software
https://github.com/adafruit/micropython-adafruit-gfx/
hey im late but here in text!
i was just looking at some tiny flash chips https://www.digikey.com/product-detail/en/winbond-electronics/W25X40CLUXIG-TR/W25X40CLUXIGTR-ND/5155064
i could make a trinket m0 express
we're talking about updating libraries in bundles with new versions smoothly
i was going to maybe route something like that today. see if i can make it fit. will be a few $ more than trinket m0
thats my only news
awesomesauce
Do I smell a solid state hard drive addon board in the future?
basically next step is SATA
π
@slender iron I like the idea but I as much as I like CP I don't know that I could set aside the money for a ticket to get there
Gonna drop off...
@marble talon Glad you could join us!
Hungry!
thanks @marble talon
Thanks, guys!
I just noticed that this feature was missing on the non-express builds as I tried migrating some code to a smaller board. I'd love to see it there. If ultimately not, would it be possible to update the error message?
Currently it was something along the lines of Error: bytearray index assignment not supported. (paraphrased, my uc isn't connected at the moment). This was confusing as this isn't index assignment, it is slice assignment. But even improving the error message would consume...
@timber mango A trinket M0 express would be amazing
I have a module, errors.py in which several global constants are defined (note: I understand that Python doesn't have constants, but I've defined them by convention using UPPERCASE).
"""Indicates ...
I have a module, errors.py in which several global constants are defined (note: I understand that Python doesn't have constants, but I've defined them by convention using UPPERCASE).
"""Indicates ...
The decode method for converting from bytes to str is missing in non-Express builds. This makes it awkward to take data from I/O and print it. It seems like this should exist, obviously the codec is ignored on a microcontroller but being able to switch immutable data types from one that iterates as ints to one that is printable and iterates as one character strings is desirable. Depending on the micropython gc internals both could share the same data buffer behind the scenes (I haven't loo...
<@&356864093652516868> Video from today's weekly meeting is here: https://youtu.be/zzgbjAjIaEc
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
Thanks @slender iron!
no problem!
@slender iron Hah! On a hunch, I checked. pixels.brightness already works. cpx.pixels.brightness works. So only need to update the doc examples to include it.
π
Thanks @slender iron!
Hope <@&356864093652516868> & company had a good CircuitPython weekly!
yup, went well
Dan, please take a look. There are a couple more things to do but it should be close enough to have a review.
I still need to:
- [ ] Double check Travis works.
- [ ] Change writeable to writable.
Good deal. I'll take a listen to the recording later tonight
I looked at flash_set_usb_writeable, and if the arg is true then it sets the writable bit. So I'm confused by this change.
Can we use a better name, since the meaning is unclear except due to the comment? filesystem_default_writable_by_python or filesystem_default_python_writable, or something similar?
OK, I see writable below. Writable internally vs USB.
@split ocean Brightness level works. Inside your loop include cpx.pixels.brightness = and the same numbers between 0-1 that you would include in pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=#) and you can set the brightness level.
Grazie! @idle owl
@split ocean Prego!
Don't forget to submodule update asf4 to bring in your PR on that repo.
@pastel panther ping me when you are around. I'll have a test build for you
@slender iron I was going to change the NeoPixel example in the API to include brightness. Sound good? I figure that would be the best way to do it since it's not a parameter. Also does :alt: NeoPixel order diagram need to be included in the rest of the API docs? Or was it carryover from copy/pasting the NeoPixel doc for formatting purposes.
Sounds good to change the example. The alt text should describe the image in case someone can't see the picture
Ahhhh ok. So it was definitely something copied. I'll update all of those as well.
thanks! you rock
Thanks! π As do you!
π
Just documenting base error: ASF3 does not handle an i2c read request of length zero. CPy/Mpy passes in a zero length bytearray as a buffer starting at 0x0, with length 0. The read request eventually gets passed into asf/sam0/drivers/serceom/i2c/i2c_sam0/i2c_master.c, routine _i2c_master_read_packet. There is some handling of a zero length request, but critically at the end of the while read loop, there is this code:
/* Save last data to buffer. */
_i2c_master_wait_for_sync(m...
@slender iron I.... forgot how to build sphinx. I'm getting command not found with sphinx-build -b html . _build/html
make sure you have the venv enabled
ohhh right. Thank you!
well drat @tulip sleet I just had a cexp running 2.1 erase itself when plugging in battery :/
it always happens when i'm getting a project ready to show people it seems
bad luck
@timber lion Ugh! So maybe it's saggy voltage on the connect. Was the battery freshly charged or weak?
@timber lion has cursed LiPos
freshly charged actually
yeah it always takes a second to plug in the JST
i wonder if in that time it's getting eratic voltages
maybe i'm just bad at plugging in π
@timber lion could be, they can be a pain to plug in
Maybe some kind of like brown out causing problems
maybe we should wait a bit (a second or two) before erasing the fs. That would give time for the contact to be firmed up. Could also check operating voltage before erasing.
not a bad idea
maybe two bugs here. I can trying plugging in a few times and see what happens
probably difficult to reproduce / correlate, but maybe that would help?
yeah those would work but it doesn't fit in a lot of projects
overcomplicates this glove π
i do notice this cplay express has a really tight JST connector recepticle
take a very planted and firm push to get the connector in
easy to waffle around a second
@tidal kiln I have one of those on/off cables, so I'll try with and without that
@timber lion thanks for the report! Please follow up on the issue. @tulip sleet don't let this distract you
time to climb. byeee!
@slender iron have fun!
@slender iron Later!
Byeeeee
on belay!
yeah I'll put a bug in 2.1 for this issue, i think it's worth looking at for 2.1 if it really is a simple fix to delay before erase FS
and if folks want to try slowly or badly pluggin in a JST to a cplay express to repro π
@timber lion you can reopen #280
So this goes back to the previous issues of losing the entire SPI flash filesystem on express boards in low power conditions. With the latest 2.1 firmware I've noticed it unfortunately still occurs, just now I plugged in a JST battery to a cplay express with 2.1 and it erased the entire filesystem (was left with a blank root and boot_out.txt file). Talking in chat one possible explanation is that jittery power on startup could cause a filesystem erase from brownout conditions. This fits my...
@timber lion Repro'd.
I had to lightly touch the connector to the jack repeatedly before plugging it in to get it to repro. The status LED and D13 flashed each time I did that, and then when I plugged it in completely, it had erased.
oh nice good you can repro
i think the priority of this one is a little higher then
it's super easy to misplug in a battery
This has been confirmed with another independent repro, from Kattni:
"@tdicola Repro'd.
I had to lightly touch the connector to the jack repeatedly before plugging it in to get it to repro. The status LED and D13 flashed each time I did that, and then when I plugged it in completely, it had erased."
Priority-wise I think this is worth looking at for the next 2.1 release. It's super easy to misplug in a battery and could frustrate a lot of folks (losing all your code unexpectedly).
Continue to disallow reading buffers of length zero for I2C and reading/writing empty buffers for SPI. In particular, reading a buffer of length zero exercises a buggy edge case in ASF3.
If I plug it straight in, I can't reproduce it. But if I repeat the steps above, it's reproduced. I tested a few more times.
280 might be a separate thing, that was originally when the battery died while it was running and the FS erased on next boot
i'm pretty sure it wasn't from a jittery plug-in power then.. i remember the two times i've had jittery plugins (now and a previous one with circuit walker sneakers)
the power reactor on show and tell is the classic battery ran out and FS erased thing
which i think is fixed in 2.1 but will play more to see
this one i think is the jittery power on startup so probably makes sense as a separate issue
Hi guys!
I'm struggling to get the PDM mic working on a cpx.
When I run (REPL) or load the readthedocs example (https://circuitpython.readthedocs.io/en/latest/shared-bindings/audiobusio/PDMIn.html)
I get a fatal error and the cpx either hard resets or jumps into safe mode.
Any suggestions? I'm struggling to debug without a debugger
@timber lion I don't think anyone can say they are good at plugging in jst connectors.
Hi @sturdy furnace, can you post your code? Use ` in the beginning and end of your code so it displays here properly, or use something like paste bin.
Yep!
`import array
import audiobusio
import board
Prep a buffer to record into
b = bytearray(200)
with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
mic.record(b, len(b))`
Note: I have it working in Arduino
Also I've tried the circuitpython uf2 2.0 and 2.1 versions
@sturdy furnace I get the same result. I don't think the demo code is written to work with the CPX. I'd have to dig a bit more to figure out why, but you're not missing anything. It doesn't work.
Or at least I'm getting the same reboot into safe mode.
Ok that's good to know, I'll jump in as well.
There is an open issue (#156) but from what @slender iron posted I assumed it wasn't broken.
Can you link that issue please?
there's some test code I ran.
Thank you
import audioio
import audiobusio
import digitalio
import time
import array
import math
buf = bytearray(8000)
print(3)
time.sleep(1)
print(2)
time.sleep(1)
print(1)
time.sleep(1)
print("recording", time.monotonic())
trigger = digitalio.DigitalInOut(board.A1)
trigger.switch_to_output(value = True)
with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
mic.record(buf, len(buf))
trigger.value = False
print("done recording", time.monotonic())
for i in buf[:10]:
print(i)
print(min(buf), max(buf))
time.sleep(0.1)
speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.switch_to_output(value = True)
trigger.value = True
length = 16000 // 440
b = array.array("H", [0] * length)
for i in range(length):
b[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15 - 1) + (2 ** 15))
print(b)
with audioio.AudioOut(board.SPEAKER, b) as sample:
sample.play(loop=True)
time.sleep(1)
sample.stop()
trigger.value = False
time.sleep(1)
trigger.value = True
print("playback", time.monotonic())
with audioio.AudioOut(board.SPEAKER, buf) as speaker:
speaker.frequency = 8000
speaker.play()
while speaker.playing:
pass
trigger.value = False```
Try that, I tested it and measured the analog output (A0) on my oscilloscope and I just get an 8kHz sine wave.
@sturdy furnace If you surround your code with 3 backticks, it makes it a codeblock - It's easier for longer code snippets.
b = array.array("H", [0] * length)
for i in range(length):
b[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15 - 1) + (2 ** 15))``` This creates a sine wave. I've used it previously to make tones with the onboard speaker.
Oh didn't realise markdown worked in discord. Thanks
Yeah! I forget to just call it markdown, most of that time that doesn't mean much, but it would be much easier to mention that first. You can edit your messages too.
can also add code type for syntax highlighting
It seems like the code is supposed to take the recorded sample and play it back, but it looks like it generates a tone and tries to play that back instead?
I haven't done anything with recording yet so I'm trying to understand it based on other things I've done which isn't always the most efficient way, heh
You're right that the issue doesn't seem to imply it shouldn't work.
@idle owl I ran this and nothing broke!
import audioio
import audiobusio
import digitalio
import time
import array
import math
buf = bytearray(8000)
print("recording", time.monotonic())
trigger = digitalio.DigitalInOut(board.A1)
trigger.switch_to_output(value = True)
with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
mic.record(buf, len(buf))```
Nice!
Seems that the trigger is necessary. Not sure why though?
Yeah I'm not sure either.
(btw this is @slender iron s test code in issue #156)
It means that it needs board.A1 to be output, but I don't get why that would be either.
(Yeah I noticed π )
I can run the test code in it's entirety and nothing breaks. It returns a tone and a static silence type sound.
@idle owl hmm, There seems to be a DC offset, maybe needs some amplification too?
I'll do some quick and dirty DSP and see if I can improve the signal.
But it is only 8 bit right? I can't imagine the quality is going to be amazing
ok nvm, I have no idea how to do any DSP in python without numpy or scipy π’
@sturdy furnace At 8 bit, no, it probably won't be.
Oh no! I've never dealt with it so I wouldn't have known to mention the lack.
I'll jump down to Arduino, It seems there is the same offset problem at least
@sturdy furnace I believe the trigger code in the @slender iron's example was just there to trigger his scope or logic analyzer, so he could capture the inputs and outputs without a lot of blank space on either side. There's nothing in the schematic that turns on the microphone based on A1.
@tulip sleet Thansk for the heads up. I tried the readthedocs example again, this time with a buffer of 8000. no issue.
import audiobusio
import board
b = bytearray(8000)
with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
mic.record(b, len(b))
A buffer overflow was the culprit then?
Nice catch!
@sturdy furnace if it crashed with a buffer size of 200, could you post an issue about that? https://github.com/adafruit/circuitpython/issues We should guard against stuff like that? Tnx.
Will do
@pastel panther new usb descriptor m4 express
here's a stupid question. i finally got the smaller cable for the mini j-link . The metro M4 board connector has a notch in it, so it is clear how the connector fits, but on the j-link board, the connector can go either way. How do I correctly connect the mini j-link to the cable?
@fading solstice I don't have the mini jlink but I think its a matter of lining the red stripe on the cable to the pin 1 location
its should be labeled
@sturdy furnace thanks for finding that bug!
There's a diamond on the M4 board and a "1" printed on the mini JLink. You just make sure those are lined up.
red = 1
@slender iron
Adafruit CircuitPython 3.0.0-alpha.0-1037-g996130f05-dirty on 2017-10-30; Metro M4 Express with samd51j19
>>> print("It works!")
It works!
>>>```
Thanks guuys!
Are the changes chip-specific or could the same changes be build for the m0?
it should be agnostic
but for some reason the mass storage was broken by my descriptor changes
Strange
yup, one part was the cache settings
I changed the endpoints so there must be some place the other value is still used
Let me know when you get that sorted and I'll test my m0 as well
@fading solstice that's not a stupid question.
yes that looks like mine now!
unfortunately, the j link commander program does not connect
Mine shoud show up wednesday! wew
thanks for the help @pastel panther !
@slender iron no problemo
does not connect to board? or does not connect to jlink?
the j-link> con command
J19 ?
i don't know what, i guess
Frequency should be 1000 I believe
ok
mine's a ATSAMD51J19, but i think that's just a package difference
how are you powering the metro?
@pastel panther m0 build incoming
So frequency 1000
Device ATSAMD51J19
SWD
metro m0 3.x test
@formal plover I needed to use SWD not JTAG. now it look happy
@fading solstice Yay!
Adafruit CircuitPython 3.0.0-alpha.0-1037-g996130f05-dirty on 2017-10-30; Adafruit Metro M0 Express with samd21g18
>>> print("This works too!")
This works too!
>>>
π that means I can take a break from USB
@fading solstice yay!
weeee
I renames this to filesystem_writable_by_python.
@fading solstice you have the firmware and bootloader files you need?
i was just about to ask for that
can i use boosac.exe to install the .bin file? or this jlink stuff?
@slender iron I'm sorry, can you just plop them here? For @fading solstice
what do ya need?
I'd fetch them, but I'm on my phone, not the PC
@slender iron i want the bootloader so that I can drop .uf2 files onto a metroM4 board
@formal plover Use FastHub for Github
self-updater for UF2 on metro m4
π
Plus I know things are current, in case he's working on something
Get you...
whats the dif between self-updater and non self-updater (bootloader.bin)?
the self-updater will unlock, flash and lock the bootloader
and can be loaded by the bootloader itself
the .bin is loaded directly
but you first need a bootloader that will accept it, right?
yeah, the metro m4s should have a bossac bootloader to start
This is ready to go. I rebased it into a single commit since I had a couple of feedback commits.
ah. that's what it was.
so with a bossac bootloader, use bossac to load update-bootloader.bin, and it will reprogram bootloader to uf2?
@slender iron Yah, baby, that's the way its suppose work!
This should actually be fixed now by f738996164fc270015fdb53ee38b24f7823cbbd8. Thanks @dhalbert !
@tidal kiln That's what i did. Then I got a METROBOOT drive. Then drop the last .uf2 file
shout to circuitpython on the amp hour: https://theamphour.com/364-the-endless-y2k/ 1:11:30 at the end
This should be as easy as enabling a define in mpconfigport.h
Woot woot shout outs
Running the following code from readthedocs causes a hard reset, and the CPX to run in safemode (not always).
import board
# Prep a buffer to record into
b = bytearray(200)
with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
mic.record(b, len(b)) ```
Increasing the buffer size to 8000 ('b = bytearray(8000)') fixes the issue.
This ASF4 change fixed this: https://github.com/adafruit/asf4/commit/8e3e471f481effddd5c23da2342e1e4aab618e1f
Before, ASF4 would respond as if the second drive existed even when we returned null as the inquiry result. Now, it responds with NOT_FOUND.
70e100b atmel-samd: Add empty line for RST docs - tannewt