#circuitpython-dev

1 messages ยท Page 149 of 1

slender iron
#

got a link?

pastel panther
#

lemee see if I can find it amongst the forest of bookmarks

manic glacierBOT
slender iron
#

ah yeah, thats the basics ๐Ÿ˜ƒ

pastel panther
#
slender iron
#

I wonder if we can clock this qspi at 120 mhz ๐Ÿ˜„

pastel panther
#

Awwwwwe yea

#

It supports something like DDR, right?

slender iron
#

the peripheral does but the flash doesn't from what I can see

pastel panther
#

Which chip did she use? I thought the winbond ones supported it

slender iron
#

gigadevice I believe

#

I'll keep it in mind

#

looks like we can do 120mhz sdr or 100mhz ddr

#

unless we overclock a gclk to 240

pastel panther
#

Do you know which footprint she used? If the pins are broken out or tappable, I made a breakout board for the winbond chips a while back

#

mmmm....240

slender iron
#

soc-8 or whatever

#

my proto actually has a spansion chip on it

#

point being, we have multiple chips we use

pastel panther
#

right

#

If you think it might be useful, I can send you one of my m4 board which has a winbond qspi chip in addition to the regular spi flash, though it's a> a prototype with one or two issues, and b> different enough from the metro as to probably be not useful.

#

None the less, I'll send you one if you want

slender iron
#

nah, I'll just make it configurable

#

spansion max read rate is 108mhz ๐Ÿ˜•

pastel panther
#

boo-urns

manic glacierBOT
slender iron
#

108 sdr or...

#

54 ddr

#

I was thinking a 96mhz clock would be good to add

#

for everything that can only run up to 100mhz

tulip sleet
#

sounds good: up the 2 MHz clock or the 48 MHz clock?

pastel panther
#
The W25Q16JV supports the standard Serial Peripheral Interface (SPI), and a high performance Dual/Quad
output as well as Dual/Quad I/O SPI: Serial Clock, Chip Select, Serial Data I/O0 (DI), I/O1 (DO), I/O2, and
I/O3. SPI clock frequencies of up to 133MHz are supported allowing equivalent clock rates of 266MHz
(133MHz x 2) for Dual I/O and 532MHz (133MHz x 4) for Quad I/O when using the Fast Read Dual/Quad
I/O instructions. Th
slender iron
#

not sure, dividing the 120 down might actually be easier

#

@pastel panther the datasheet for that doesn't say it does DDR

pastel panther
#

It does mention reading on one edge and writing on another but I don't know if that counts

tulip sleet
#

I have clock changes from the uart stuff and asf4 changes, maybe I should PR that without the rest of uart

slender iron
#

I think thats normal

#

DDR is reading on both clock edges

#

@tulip sleet did you move them around?

pastel panther
#

that makes sense

tulip sleet
#

isn't that the D of DDR?

slender iron
#

yeah

pastel panther
#

hah, yea

#

facepalm

slender iron
#

I think "dual spi" is confusing

tulip sleet
#

not moved around, just better comments in the gclk_config.h (and maybe some updates in the constants). I tried to make the Atmel START setup actually match the clock setup we were using.

slender iron
#

kk

pastel panther
#

time to fetch groceries! ttyl

slender iron
#

byeeee!

pastel panther
#

I'll be on later as I try and figure out my SPI issue again

#

(i'm guessing PEBCAK)

slender iron
#

I might be on. may try to work on qspi later

manic glacierBOT
manic glacierBOT
manic glacierBOT
normal mica
#

question, my daugther and i made the "sire" from makecode and it doesnt wants to run on my CPE and i updated the lib and cpx

#

and nothin

#

when i try to look at the code on notepad, the text are " ร  ยฟHh + ร‘ยฝK "

manic glacierBOT
tulip sleet
#

@normal mica did you write the program in MakeCode or Python? I'm a little confused

#

If you wrote it in MakeCode, copy the .uf2 file to CPLAYBOOT.

#

The .uf2 download from MakeCode is a whole program in its own right that does not use CircuitPython to run.

normal mica
#

makecode

#

@tulip sleet thank you it wrk i guess thing has change since my last makecode project

pastel panther
#

finally got around to making a code.py blinky work on my m4 board

#

does a happydance

#

working on internal flash for now; I'll look at the external flash after I get SPI verified working

raven canopy
#

listening to async discussion. welcome @quick oyster! will be awsome to see it come to life.

#

i was totally going to jam out on my 2 open projects tomorrow since i have off. but now i have to type slow b/c i'm down a pinky...silly backyard football.

pastel panther
#

jammed digits are no fun

raven canopy
#

i'm hoping its just jammed. pretty swoled at the first knuckle... ice + time is the only thing with fingers though. and occasional motrin...

pastel panther
#

elevation also; keep it above your heart

#

I broke my ankle last year so I'm recently famillar with such things

raven canopy
#

yep. immediately after it happened, iced it and had my hand resting on top of my head.

#

i've broken both pinkys...and have a lot of other misc injuries. "adds character" as my dad used to say. ๐Ÿ˜„

pastel panther
#

right; I just messed up my knee last week jumping over a fence while playing disc golf. I think I'm officially getting old

raven canopy
#

lol. sucks, doesn't it?

pastel panther
#

indeed.

manic glacierBOT
ruby lake
#

@slender iron setting the timeout=1 on the serial port fixed my issue

slender iron
#

๐Ÿ‘

ruby lake
#

zonk time, later folks

pastel panther
#

hello

#

not bad, you?

#

nope, not me

#

maybe don't have it in your name then? Or post it?

manic glacierBOT
#

FYI - just for fun I tried loading via the On Board J-Link "directly"

make BOARD=feather52840 SD=s140  sd

That worked fine, but then I found that ampy does not work via /dev/ttyACM0 (the IF MCU port)

When I load via the serial boot loader (reload boot-flash, then dfu-gen/dfu-flash. I can then also run ampy via /dev/ttyACM0. Does this make sense? Not a problem, just showing my ignorance, I expect.

BTW - I did finally get a successful dfh-flash to execute on the Mac. I'm no...

manic glacierBOT
#

@jerryneedell Just as a visual indicator, it should be obvious when you have successfully entered DFU/Serial Bootloader mode ... you'll get a distinctive fast blinky pattern on LED1. When you are doing an actual firmware update, the DFU Blinky will get even faster. No fast blinky means you aren't in DFU mode.

I'm not sure what's up with the J-Link flashing causing a conflict with ampy, but it's not something I've tried yet since the only design goal on my side with this BSP was serial, but...

tulip sleet
#

@slender iron a couple of elementary q's I can't seem to find the answer to: in a interrupt handler, can I find out which interrupt called me (e.g., which slot?). If I write a general handler I need to know which SERCOM, etc. Also, is our NVIC vector relocated to RAM or is it in flash somewhere?

slender iron
#

@tulip sleet each sercom usually has a handler of its own that can pass an index to the general one

#

I don't think its relocated. its at the start of flash

tulip sleet
#

so it's all by the initial handler - there's no register to retrieve the interrupt number?

slender iron
#

not that I know of

tulip sleet
#

yeah, I couldn't find one. but if it's at start of flash, is that not where bootloader is?

slender iron
#

its the start of our section

#

the startup code tells the cpu where it is I think

tulip sleet
#

ah ok, so it's relocated but in flash, not copied to ram. there is a relocation register. default is to put vector at 0x0 (assumes no bootloader, I guess).

slender iron
#

right

#

the bootloader must have a table as well

tulip sleet
#

good poitn

slender iron
tulip sleet
#

usart_async code keeps track of which sercom by setting a global to the ASF4 descriptor for the usart functionality

#

thanks, very helpful

slender iron
#

EIC is more interesting because the M0 has one irq for all lines

#

don't forget to clear the interrupt in the handler otherwise you'll infinite loop

tulip sleet
#

thanks - trying to reuse ASF4 code but i think I need to change the API to pass in more info

slender iron
#

all of the handlers are weakly defined so you just need to provide a function with the expected name

tulip sleet
#

that's what I thought -- they hardwire the sercom interrupt handler to the (fixed) one in hpl_sercom.c, based on the bindings you set up in Atmel START. I have to undo that.

slender iron
#

ah, yeah that'd do it

tulip sleet
#

i don't mind using their code in general because it has a lot of knowledge of the SERCOM registers. USART SERCOMs are quite featureful and complicated. So if I can get away with patches rather than a rewrite it might be better.

slender iron
#

I find the datasheet is better documented than asf4 is

#

each section usually includes init instructions and how to do common tasks

tulip sleet
#

did see that - i liked the old asf3 application notes too but they don't exist for asf4. Also until reading your code last night I was blind to the fact that the CMSIS-style peripheral register access was available for ASF4. I thought it was only via hri_

#

we'll see how far I get with modifying asf4 or give up in frustration and go to reg-leve access

manic glacierBOT
slender iron
#

kk, I've given up but am fine if you want to use asf4 more

#

as far as I could tell hri only provides locking hooks on top of the cmsis-style manipulation

manic glacierBOT
slender iron
#

@tulip sleet any other questions? I'm gonna go run errands for an hour or so

tulip sleet
#

suppose I ctrl-C out of the main.py loop? Is state reset?

slender iron
#

yeah

#

should be

tulip sleet
#

hmmm, still not sure that's a great idea; we can talk after you return

slender iron
#

have time to talk now? I can leave in an hour if need be

tulip sleet
#

k

manic glacierBOT
pastel panther
#

@slender iron and @tulip sleet Thanks for having that interrupt/usart/sercom chat here in #circuitpython-dev; it was very interesting and informative

manic glacierBOT
idle owl
#

@pastel panther Did you see we recorded and posted the asyncio discussion?

pastel panther
#

@idle owl yea, thanks! I'll listen to it tonight probably

idle owl
#

Ok keen

pastel panther
#

It shall sooth me as I do more SPI and now pulseio testing tonight ๐Ÿ˜‰

slender iron
#

@pastel panther I'm back

pastel panther
#

buh, just finished putting out a fire, I think

slender iron
#

๐Ÿ‘

pastel panther
#

gimmie a minute to check for embers

slender iron
#

k

manic glacierBOT
analog drift
#

Are there any stackable short headers on adafruit?

stuck elbow
#

you mean with a short female part, but long male part?

analog drift
#

Yes

stuck elbow
#

I don't know about anything like that

analog drift
#

Awww

#

Will there be anything like that? ๐Ÿ˜‰

stuck elbow
#

For the Trinket M0 I had some luck using those: https://www.aliexpress.com/item/2-54mm-Female-Header-Single-Row-5PIn-short-version-plasticheight-3-5mm-straight-180o/622209657.html โ€” they are even shorter than the Adafruit ones, and since Trinket's PCB is so thin, they actually stick out on the other side enough to stack them.

#

but that won't work for the feather

analog drift
#

I have the larger stackable headers from adafruit, but the pins are so long they are easy to bend

#

Not to mention the actual size

stuck elbow
#

you can always cut them shorter

steel copper
analog drift
#

@steel copper yea

#

Do they have something like this available on DigiKey? I'm not a wizard, so using that site is a bit... challenging.

#

@stuck elbow Unfortunately, I cannot cut them shorter, the female section of the header is too deep to work with cut male pins

steel copper
analog drift
#

@steel copper Yea, that but shorter length

steel copper
#

Or does that suffer from the same issue of too deep a female?

analog drift
#

That is essentially what I currently have

steel copper
#

It does seem that any header that extends the male also extends the female section. Not seen any with the small female / extended male combo that you are looking for.
Its probably a material strength issue.

analog drift
#

Yea. I've been trying to crawl my way through DigiKey to see if they have any custom headers that match my needs

#

Navigating though DigiKey is such a pain

steel copper
#

do you have a potential path using just standard male header, without the female section at the bottom of the board?

stuck elbow
#

You can use the long male headers, and have female headers on both the shields

#

I had to do that sometimes

analog drift
#

@steel copper Oh my god. You wont believe this. You can shove both the male and female connectors into the same socket.

#

I mean. It is a bit hackish in a way. But it looks like it works.

#

It is going to make me want to cry come solder time.

#

But it fits: it ships!

#

May the electrical engineering gods have mercy on my soul.

stuck elbow
#

you want to move the plastic on the male headers way back to the edge

#

and push it back when you finish soldering

analog drift
#

Thats a really great idea

stuck elbow
#

careful not to scar the board when you do so

analog drift
#

I just need to be careful to lineup the placement during adjustment so this thing doesn't look like a bucktooth pin board

stuck elbow
#

also, getting them straight is going to be a challenge

steel copper
#

Yuck, ugly.
If it's ugly but it works... it's still ugly

stuck elbow
#

start by soldering a single pin, then you can adjust it easily

analog drift
#

I actually have a solution for that

stuck elbow
#

only solder the others when it's straight

analog drift
#

I have an alignment board that I can use

steel copper
#

You could also sacrifice 1 set of male headers for a second spacer bar to help keep alignment.

analog drift
#

This is what the stacked short headers look like.

#

I can get this to work on the M0 Express, but the other M0 w/ WiFi that I have will not fit the two headers. Even though the solder through holes look the same size

opaque patrol
#

What is the function to call to get an approximation of memory available?

idle owl
#

@opaque patrol import gc then gc.mem_free()

opaque patrol
#

thanks

pastel panther
#

@analog drift 10 points to griffindor for ingenious hackery

analog drift
#

hahaha

worn birch
#

@analog drift Good to see you are getting into the CircuitPython ... I am yet to setup my work station in my new place ...

raven canopy
#

@slender iron I know you're "off the clock", but pylint refuses to allow me to use a [] as a default argument on Trellis.... seems this is a CPython no-no as well (being mutable and all). Answer can wait. I hate to steal weekend time from peoples. I'm off Monday, so available all day.

slender iron
#

ah! then using None is fine like you had previously

#

I didn't know that

raven canopy
#

๐Ÿ‘

stuck elbow
#

the problem with using mutable types as default values is that they get created at the function definition time, not every time the function is called

#

which is confusing for many people

slender iron
#

ah! makes sense

timber mango
#

Alright I have a reasonable means to shape pulse width.

pastel panther
#

yay!

#

testing pulseio?

timber mango
#

ah, not that advanced yett. Just counted loops and time.sleep().

#

Trying to find the limit of that method. Seems to be an order slower than I'd like.

pastel panther
#

I feel like that might not be as reliable timing wise

#

(and slower)

#

There is also likely going to be an upper limit on frequency; see what you get if you just loop with no sleep and toggle the pin every loop

timber mango
#

That's what I'm doing this afternoon. Just toggling pin 13.

pastel panther
#

Do you have a scope or logic analyzer?

timber mango
#

(D29 and D30 aren't mapped in CircuitPython). I just have a frequency measurement on the Extech EX330 multimeter (haven't checked to see what kind of range it has; I'd suppose 400 kHz is probably a limit or maybe lower).

#
 47 # sclk = digitalio.DigitalInOut(board.D30)
 48 a0   = digitalio.DigitalInOut(board.D9)
 49 rst  = digitalio.DigitalInOut(board.D6)
 50 cs   = digitalio.DigitalInOut(board.D5)
#

aka MOSI and SCK

#

10 MHz res. 0.01 MHz

#

I have a pretty good timer/counter setup for Arduino IDE so I should be able to calibrate the meter against real world conditions.

#

Still, it ain't no o-scope. ;)

pastel panther
#

๐Ÿ‘

timber mango
#

Alright so the 1250 Hz the meter gave for the frequency of the toggled GPIO pin was spot-on.

#
def pulse():
    a0.value = 0
    time.sleep(0.001); # 1 ms
    a0.value = 1
    time.sleep(0.001);

def loops():
    for i in range(0, (1250 * 10)):
        pulse()

print(time.monotonic())
loops()
print(time.monotonic())

main.py output:
260.538 269.959

#

If I have this right, I need to ramp that up to 200 KHz to get a 5 usec pulse. ;)

#

Might be time for some science.

tulip sleet
#

@timber mango EX330 goes to 10 MHz (I just got one).

timber mango
#

Yeah so 200 KHz should be well within the range it'll display. ;)

#

siddacious was right - pulseio is looking good for this job.

barren peak
#

HI there! I have cloned https://github.com/adafruit/uf2-samd21 but for some reason files such as /lib/uf2/utils/uf2conv.py don't clone . I even tried getting just downloading the .zip from the github webpage does not contain these files either. Any thoughts? thanks.

#

very peculiar

inner raft
#

@barren peak that uf2 subfolder is included as a git submodule

#

after you clone the repo, do the following:

git submodule init
git submodule update
#

that should pull in the submodules

barren peak
#

@inner raft Thank you! that did the trick.

manic glacierBOT
graceful tusk
#

Hello! I am trying to replicate some i2c work that works fine in the Arduino IDE in C, but I'm not having success in circuitpython.

raven canopy
#

@graceful tusk are you getting any specific errors? or just a general "doesn't work"?

graceful tusk
#

more info coming. mostly, I'm getting an empty result instead of data back.

#

so, what works in the C using Wire is this:

#

and what I tried in circuitpython was this:

#

So, I am just getting zeros back in circuitpython implementation, but in the arduino c code using wire, I get real data back.

raven canopy
#

the only real difference i see is that you're reading from register 0x6 in the C version, and not in the circuitpython version.

#

give me a sec while i check something though...

graceful tusk
#

right, that just is a size of data returned register (which is instead set by the bytearray size in the circuitpython)

inner raft
graceful tusk
#

I did try that; no change

inner raft
#

aww foo

raven canopy
#

are you using the 8-bit address, or the 7-bit? I2CDevice only accepts 7-bit.

graceful tusk
#

It's the 7 bit address

raven canopy
#

ok

graceful tusk
#

if I change the address, it throws a no i2c device at address error (built into the I2CDevice class)

raven canopy
#

yeah, i though it should catch it...but nothing is perfect. ๐Ÿ˜„

#

what device are you communicating with?

graceful tusk
#

I think that maybe the device cares more about the order here, and I may have to read that size register explicitly before reading out the data?

raven canopy
#

yeah, that why i ask. was going to peak at the datasheet. some chips require a pointer before reading a register...

graceful tusk
#

it's a thermal camera (Flir lepton) I have the IDD for it, and the working C code, but I was wanting to port it to circuitpython as an exercise.

raven canopy
#

i would change the bytearray to 33, and set the first byte to 0x6, then send the readinto

graceful tusk
#

ok...

#

hmm

#

doesn't make sense to me; the bytearray is just a buffer to read into from the slave; it won't know what is in it.

#

readinto just calls i2c.readfrom_into( in a nice package

#

and the "from" there is just a device address, not a register address.

raven canopy
#

yeah....i was thinking write. man.. ๐Ÿ™ƒ

#

so send a write to the address, then read. (this is required in the library i just wrote in circuitpython)

tidal kiln
#

try doing it all in one context manager

    lepton = I2CDevice(i2c, 0x2a)
    buf = bytearray(32)
    with lepton as l:
        buf[0] = 0x00
        buf[1] = 0x04
        buf[2] = 0x48
        buf[3] = 0x1C
        l.write(buf, end=3, stop=True)
        l.readinto(buf)
    print(buf)        

EDIT: missed one of the output bytes
EDIT2: also an off-by-one for the end=

graceful tusk
#

Yeah, still not getting what I'm expecting.

#

Thanks, I'll try to make sure I'm doing things in exactly the same order of steps as the working C code, but I was wondering if there was something I was missing with how it was to be done, since the syntax is quite different from the "requestfrom(devaddress, bytes); read();" way of doing it in C

tidal kiln
#

oh wait. i missed your Wire.requestFrom(0x2A, lepton_readReg(0x6)); line

#

you have more i2c transactions going on in lepton_readReg() ? is that a basic register read function?

graceful tusk
#
  uint16_t reading;
  lepton_setReg(reg);
  Wire.requestFrom(0x2A, 2);
  reading = Wire.read();
  reading = reading << 8;
  reading |= Wire.read();
  return reading;
}```
#
  Wire.beginTransmission(0x2A);
  Wire.write(reg >> 8 & 0xff);
  Wire.write(reg & 0xff);
  Wire.endTransmission();
}```
#

So, I think I glossed over a couple of sends hidden in there.

#

not sure why it's all bitshifted and masked.

idle owl
#

@graceful tusk If you want to format your code, you can put three backticks on both sides of the text you want to be a code block (the one on the upper left of a US English keyboard on the same key as the tilde, next to the 1 key) like this

#

Or if you want inline code use one backtick on either side of the text you want to be formatted

tidal kiln
#

```python

code goes here

raven canopy
#

would have to see the protocol. could be a MSB First vs LSB First thing...

idle owl
#

@graceful tusk Nice!

tidal kiln
#

this:

  Wire.write(reg >> 8 & 0xff);
  Wire.write(reg & 0xff);

looks more like it's setup for a uint16_t

graceful tusk
#

yeah, that makes sense

tidal kiln
#

not sure why you'd right shift a byte by 8

graceful tusk
#

me neither, but I think we're on the right path to what I was missing.

#

everything is 16 bits in the registers

#

It seems to me that the first line (Wire.write(reg >> 8 & 0xff);) is effectively the same as Wire.write(0x00)

tidal kiln
#

did you write that lepton_setReg() func?

graceful tusk
#

nope

raven canopy
#

there's a couple on github

graceful tusk
#

maxritter thermocam is the source

#

no matter what byte value you have for reg, right shifting it 8 is going to zero it out. crazy code. I'm sure there was a reason it made sense at some point.

#

Does discord do threads?

tidal kiln
#

my guess is there are no registers above 0xff, so it works, even though it's a bug

timber mango
#

No.

#

I'll see if I can look this up. I just worked with this.

graceful tusk
#

My guess is it was originally set up to pass a unint16 and that bit shifting and masking is in place to chop it into MSB and LSB, but here we're passing in a byte value for reg anyway.

raven canopy
#

if reg == 6

Wire.write(reg >> 8 & 0xff);  == 0
Wire.write(reg & 0xff); == 6
tidal kiln
#

agree. should be passing a uint16_t. all the registers are 16 bit.

#

but i'm not seeing any above 0x00ff

raven canopy
#

does the code turn off the camera after every capture? seems that 0x0000 will turn the camera on, if its off (IDD paragraph 2.1.4)

graceful tusk
#

not even doing a capture. the camera is on. captures have to be done over spi; I'm just trying to get some of the id stuff from this i2c control bus

raven canopy
#

as i scroll down this document, i understand why they went with 16bit...they packed all kinds of stuff into this thing. ๐Ÿ‘€

tidal kiln
#
    lepton = I2CDevice(i2c, 0x2a)
    buf = bytearray(33)
    with lepton as l:
        buf[0] = 0x00  # command register MSB
        buf[1] = 0x04  #    "       "     LSB
        buf[2] = 0x48  # command MSB
        buf[3] = 0x1C  #    "    LSB
        l.write(buf, end=4, stop=True)
        # read data length register
        buf[0] = 0x00  # data length register MSB
        buf[1] = 0x06  #   "    "       "     LSB
        l.write(buf, end=2, stop=True)
        l.readinto(buf, end=2)
        data_length = buf[0] << 8 | buf[1]
        # read the data
        l.readinto(buf, end=data_length)
    print(buf) 
#

@graceful tusk still just guessing, but try that?

timber mango
#

The >> 8 business is to convert a 16 bit value to two 8 bit bytes.

#
 25 def scale16():
 26     global hiDutyCy
 27     global loDutyCy
 28     hiDutyCy = dutyCy >> 8
 29     loDutyCy = dutyCy & 0xFF

graceful tusk
#

yeah, but the function that it was in was getting passed in a single byte value.

timber mango
#

I guess it depends on if you trust the skill of the original coder. ;)

tidal kiln
#

looks like highest register is at 0x0026, so bug never hits

#

it's expecting 16bit addresses, so just need to pump out 0's for the MSB

#

Wire.write(reg >> 8 & 0xff); == 0 will do that ๐Ÿ˜ƒ

timber mango
#

I usually remove code elements that don't make sense to me, to see if the situation deteriorates without the odd stuff. It often does, so I put it back without perhaps understanding why it was required or what exactly it does.

#

I don't understand how appending '== 0' even compiles, after that semicolon. ;)

tidal kiln
#

i think that was just commentary

timber mango
#

I have no idea how that is a comment

tidal kiln
#

from @raven canopy 's comment above

#

not meant to be code, just pointing out what's going on

raven canopy
#

i debated on putting the //....seemed extraneous at the time. ๐Ÿ˜„

timber mango
#

oh boy

#

I had no idea you could even do that. Nobody does that. ;)

tidal kiln
#

@graceful tusk did you try that latest?

graceful tusk
#

@tidal kiln yeah, but no juice. currently porting it as line-by-line as I feel is possible. implemented the functions as functions, going to give it a spin.

tidal kiln
#

did it run and just return no data? or did it have a run time error of some kind?

graceful tusk
#

there was a typo I fixed, then all zeros still.

tidal kiln
#

what was typo? (yah, i'm not testing, just throwing up code)

graceful tusk
#

It didn't like the end=datalength parameter; that function takes its data length only from the size of the byte array it's given

#

gave a number of arguments error

tidal kiln
#

yep. my bad. i fixed that. but you must've copied code before i did.

#

or did you just remove it?

graceful tusk
#

I removed it

tidal kiln
#

let's see if we can even just read that register, try this:

    lepton = I2CDevice(i2c, 0x2a)
    buf = bytearray(33)
    with lepton as l:
        buf[0] = 0x00  # command register MSB
        buf[1] = 0x04  #    "       "     LSB
        buf[2] = 0x48  # command MSB
        buf[3] = 0x1C  #    "    LSB
        l.write(buf, end=4, stop=True)
        # read data length register
        buf[0] = 0x00  # data length register MSB
        buf[1] = 0x06  #   "    "       "     LSB
        l.write(buf, end=2, stop=True)
        l.readinto(buf, end=2)
        data_length = buf[0] << 8 | buf[1]
        print(data_length)
graceful tusk
#

prints 0

tidal kiln
#

ok, try changing that last l.write line to this:

        l.write(buf, end=2, stop=False)
graceful tusk
#

good news is that I changed it to the status register and it printed the value there (111=7)

tidal kiln
#

hmmm. so it's not the stop

#

so BUSY bit is set. what's it doing?

graceful tusk
#

not sure, but I think that might be the root of the problem. I'm waiting an appropriate boot time

tidal kiln
#

but it works with the C code?

graceful tusk
#

The weird bitshifting was copied from a different codebase where it was an an unsigned int, just got changed to a byte in the maxritter codebase. I'm making an uncluttered copy of the c code to verify that it still works. ๐Ÿ˜ƒ

timber mango
#

Well, once it works, you can forget all about how it works. ;)

#

I'm quite convinced coders are pathological about making things as ornate as the language allows.

tidal kiln
#

the bitshifting isn't really weird, makes sense for this 16bit case
the weird part is:

void lepton_setReg(byte reg) {

instead of:

void lepton_setReg(uint16_t reg) {
graceful tusk
#

yes, that's what I meant. The bitshifting itself is made weird by passing in a byte

tidal kiln
#

sorry, i gotta run. good luck with this.

graceful tusk
#

Thanks. What worked before is no longer working. So... that might explain some of it not working.

#

I think maybe I accidentally turned it off somehow, and it needed resetting.

#

anyway, I've got the C code working again.

#

I'll see if I can get the python to behave similarly.

timber mango
#

github is your friend. ;)

timber lion
#

hah wow i've been digging into advanced unicode stuff with micropython and the REPL doesn't support entering big characters

#

like ้‹ผ

#

but a main.py is just fine and it works great

#

print('Ord is {0}'.format(ord('้‹ผ')))

#

Ord is 37628

#

which is right ๐Ÿ˜ƒ

#

so that's pretty sweet, micropython actually does unicode pretty well internally

#

i bet the REPL just doesn't handle inputting those wide UTF-8 characters

#

i'm guessing buried in its code is an ASCII assumption

#

i'm super close to getting chinese character rendering though

#

i have a really nice super space efficient way to store the characters

#

18 bytes per character.. it's basically as small as you can get to stuff an 11x11 bitmap and the unicode character point in memory

#

only wastes 3 bits of alignment, not bad

#

to find the chars i'm not bothering with an index... just storing them sorted and binary search

#

if i can free up about 20k more of firmware space i can fit a solid 3k chinese characters and that's enough for most communication it seems

stuck elbow
#

I think you could do 16 bytes per character with a bit of a more complicated code

#

unless the two bytes are for metadata?

manic glacierBOT
pastel panther
#

@slender iron how is the QSPI-ing coming?

slender iron
#

@pastel panther it works for my test metro board

#

not using dma yet though

pastel panther
#

cool

#

is it checked in on your fork?

#

uses his eyeballs instead

#

hmm.. don't see much activity on your fork

slender iron
#

yeah, qspi branch

pastel panther
#

is blind?

slender iron
#

its how I back up my code ๐Ÿ˜ƒ

pastel panther
#

somehow I missed that, thanks ๐Ÿ˜›

slender iron
#

np

#

I need to test the m0 before I make a PR

#

and I want to follow up with DMA

stuck elbow
#

will the DMA also work with normal SPI?

#

or is it used already?

#

(I mean, with SPI called from inside CP)

slender iron
#

in 2.x it did but the current 3.x implementation doesn't use dma

#

I'll probably DMA all the things when I do the audio APIs

stuck elbow
#

I see, thanks

timber mango
#

I have sporadic all-dots-filled on ST7565 in CircuitPython. No idea if that is an occasional followed protocol (the basics have not been repeatable except for this).

#

I'm going to try peppering my code with `time.sleep(0.001) to slow it all down to a uniform time base.

#

This codebase has no more finesse than turning port pins on and off as GPIO (no comm libs used).

tulip sleet
#

@stuck elbow current spi does not use dma, expediency on my part to get the flash spi chips up and running

stuck elbow
#

you mean current 3.0

tulip sleet
#

yes

stuck elbow
#

to be honest I didn't notice much difference in speed

tulip sleet
#

I know! I was surprised

stuck elbow
#

between 2.0 and 3.0

#

I guess the SPI clock is the bottleneck

slender iron
#

I only notice when using the saleae to watch the spi lines. ๐Ÿ˜ƒ

indigo sparrow
#

I'm new to python and I'm having trouble doing something I would think is very basic

#

can someone help me understand what I'm doing wrong or where to go to learn more

#

I usually code in javascript, C/C++, and Java

tulip sleet
#

go ahead

#

@indigo sparrow go ahead

indigo sparrow
#

@tulip sleet

r = 0
g = 0
b = 0

Helper to give us a nice color swirl

def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
r = 0
g = 0
b = 0
return [r, g, b]
if (pos < 85):
r = int(pos * 3)
g = int(255 - (pos3))
b = 0
return [r, g, b]
elif (pos < 170):
pos -= 85
r = int(255 - (pos
3))
g = 0
b = int(pos * 3)
return [r, g, b]
else:
pos -= 170
r = 0
g = int(pos * 3)
b = int(255 - (pos*3))
return [r, g, b]

#

r,g,b values don't seem to be updated globally

#

they'll work when wheel(i) is called, but I can't refer to r, g, b and have their values be anything other than 0

tulip sleet
#

@indigo sparrow The r,g,b inside the def are local variables to the def. You'd have to say global a,b,c to refer to the outside variables. This is so new variables inside the function can't accidentally smash variables outside.
Simpler example:

>>> a = 2
>>> def f():
...     a
>>> def f(x):
...     a = x
...     print(a)
...     
...     
... 
>>> f(3)
3
>>> a
2
>>> 
#

notice that the function returns [r,g,b] so you can see the inside values if you want them

#

Since Python doesn't have variable declarations, variables are assumed to be local unless otherwise specified by global. Compare with Javascript:

$ node
> 
> a = 2
2
> f = function(x) { a = x; }
[Function: f]
> f(3)
undefined
> a
3
> f = function(x) { var a = x; }
[Function: f]
> f(4)
undefined
> a
3
> 
indigo sparrow
#

thank you @tulip sleet

tulip sleet
#

And it's a little more complicated than that:

>>> a = 2
>>> def f(x):
...     print(a)
...     
...     
... 
>>> a
2
>>> f(3)
2
indigo sparrow
#

so if I wanted to update the global r, g, b how would I do that?

#

I want to make sure that the global values are updated instead of the local

tulip sleet
#

because a is not assigned inside f, so it uses the outer a.

indigo sparrow
#

if (pos < 0) or (pos > 255):
global r = 0
global g = 0
global b = 0
return [r, g, b]

tulip sleet
#
>>> a = 2
>>> def f(x):
...     print(a)
...     a = x
...     
...     
... 
>>> a
2
>>> f(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
NameError: local variable referenced before assignment
#

a is assigned, so it's assumed to be local.

#

you can declare them global with global a,b,c:

>>> a
2
>>> f(3)
2
>>> a = 2
>>> def f(x):
...     global a
...     a = x
...     print(a)
...     
...     
... 
>>> a
2
>>> f(3)
3
>>> a
3
indigo sparrow
#

ok so I just need to be explicit that my r is not local but global within the context of the def

tulip sleet
#

But it's considered mostly poor form to use global. Instead, do:

r, g, b = wheel(pos)
indigo sparrow
#

oh cool, I can do that?

tulip sleet
#

since wheel() is returning the values anyway. Then you don't need to use global and you know when you're assigning the variables. ...
Yes,

a, b, c = (3, 2, 1)

exchange a and b:

a, b = b, a
indigo sparrow
#

ok just for my own knowledge

#

if wheel returned an array with 4 elements [r, g, b, x]
if I did

r, g, b = wheel(pos) would it r, g, b just be the first 3 elements of the returned array?

tulip sleet
#

@indigo sparrow No, you get an error:

>>> a,b,c = [1,2,3,4]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack (expected 3)

So you need to do something like:

a, b, c, junk = [1,2,3,4]

Canonical way to indicate unused data is with the _ variable name:

a, b, c, _ = [1,2,3,4]
#

You could also do: a,b,c = wheel(pos)[:3] to take a 3-element slice of the return value.

indigo sparrow
#

thank you @tulip sleet I'll look into learning python more!

slender iron
#

pyoven lives!

stuck elbow
#

reflow oven?

slender iron
#

the board at least

#

I have more testing to do on it

#

but did figure out my power issue

raven canopy
#

there's no oven, microwave, or stove emoticon...what gives discord? ๐Ÿ˜„

slender iron
#

<@&356864093652516868> This week's meeting will happen on Tuesday (NOT Monday) due to President's Day here in the US. Have a good weekend!

raven canopy
#

haha. i was looking forward to attending from home this week. but, agree it's a good move.

slender iron
#

oops ๐Ÿ˜ƒ

stuck elbow
#

@slender iron by the way, you have atmel studio installed, right?

slender iron
#

on my windows box, which I never use

stuck elbow
#

I see

raven canopy
#

do they have a linux/mac version?

cunning crypt
#

Bah! I'll be leaving my house at about 6am Tuesday. And won't be back until probably 11pm or later. As opposed to tomorrow, when I'll be home all day...

stuck elbow
#

I'm reading the application note for usb msc on atsamd11, and it just says "to get the source code, install atmel studio and search in examples"

slender iron
#

๐Ÿ™„

stuck elbow
#

thanks, I will try

raven canopy
#

haha. its like xmas/new years all over again. ๐Ÿ˜„

slender iron
#

sorry @cunning crypt ! I didn't think it'd be good two switch our holiday policy

stuck elbow
#

hmm, no msc for d11 there

slender iron
#

๐Ÿ˜•

cunning crypt
#

@slender iron It makes sense

slender iron
#

did you find asf3 for it? I think examples are in there

cunning crypt
#

It just happens that I have off tomorrow and Tuesdays are Nerd Night

#

Also seeing Black Panther after work Tuesday...

slender iron
#

sounds like fun @cunning crypt !

#

I'm off, pottery time in an hour. pyoven will have to wait

idle owl
#

Have fun @slender iron !

stuck elbow
#

gotta love web 3.0

#

anybody wants a discount code?

timber mango
#

@timber mango wow thats neat

stuck elbow
#

found it, the example is in there, thanks for the moral support

idle owl
#

Anytime ๐Ÿ˜ƒ

timber lion
#

oh @stuck elbow yeah 16 bits is tough for character data, it needs a 16-bit unicode encoding / codepoint and a 4-bit pixel width (it's a variable width font so an I character is just 3 pixels wide vs. a big glyph that's 11 pixels wide) so i do 2 bytes for the 16-bit encoding value, then 16 bytes for the 11x11 bitmap data and there are 7 bits left over (to get up to an even 128 bits total and be on a byte boundary alignment) which is great because i can stick the 4-bit pixel width there and even have a few bits left for potential future use

#

every bit counts ๐Ÿ˜ƒ

graceful tusk
#

Ran into a not implemented error in micropython today.

#

wanted to switch a list [a,b,c,d,e,f,g,h,...] to [b,a,d,c,f,e,h,g,...], and came across this neat slicing: l[1::2], l[::2] = l[::2], l[1::2]

#

ended up just writing a quick for loop: for i in range(int(len(result)/2)): result2[2*i] = result[2*i+1] result2[2*i+1] = result[2*i]

raven canopy
#

@graceful tusk list.reverse

#
>>> k
[1, 2, 3]
>>> k.reverse()
>>> k
[3, 2, 1]
>>>
graceful tusk
#

NotImplementedError: only slices with step=1 (aka None) are supported

raven canopy
#

oh..i misread what you were doing.

#

that's two days in a row i've done that to you...

graceful tusk
#

the weird thing is that individual slices worked in the REPL, (i.e. r[1::2])

#

got it figured. it does work for lists, does not work for bytearrays.

raven canopy
#

wow. i thought adding to a built-in module was tough. creating a new one has my head spinning... ๐Ÿ˜ต

tulip sleet
manic glacierBOT
timber lion
#

wooo hooo full unicode / asian font rendering now in sino:bit micropython ๐Ÿ˜ƒ the hard work is done, now i need to free up as much space as possible to fit as many characters as I can in the firmware. this is looking REALLY cool though so far. a few little tweaks and todo's still too but i am quite pleased with it and myself: https://twitter.com/tdicola/status/965489097769828352

Feeling a bit like ้’ข้“ไพ  (Iron Man) by coding in support for unicode and Asian font rendering in sino:bit MicroPython this weekend! :) @RealSexyCyborg @glowascii @ntoll @dastels @adafruit Need to make few tweaks and free up more space before releasing but groundwork is there! :) https://t.co/8x5HL8zLGS

โ–ถ Play video
hollow ingot
#

Looks like I missed out on catching up about asyncio in CircuitPython. The video at https://www.youtube.com/watch?v=rZ2DT8TzxPI got removed. Quite interested as I understood from earlier discussion that async constructs would be withheld from CircuitPython (not on critical path) although I guessed they might arrive when rebasing on later micropython versions. What's the new thinking? I have begun relying on async await a lot! I am also beginning to think it's more confusing to established programmers than it is to learners, for whom it looks like sequential code so could actually help to unlock parallel time-based behaviours for them.

manic glacierBOT
reef seal
#

Hello, can anyone point me to an example of using ISR (interrupt service request) programming on a CircuitPlayground Express board?

stuck elbow
#

no, because CircuitPython doesn't currently support interrupts

river quest
#

hi ho folks, the mu editor will have a plotter for live data and also saves csv files for data logging, short preview video here - https://blog.adafruit.com/2018/02/19/mu-plotter-sneak-preview-live-data-ntoll-raspberry_pi-microbit_edu-adafruit-boards/

Adafruit Industries - Makers, hackers, artists, designers and engineers!

Mu plotter sneak preview (video). We recently posted about the latest beta โ€œmu-editor 1.0.0b14 โ€“ Mu โ€“ A Simple Python Code Editor works.โ€ And check out more Mu-related postsโ€ฆ

fading solstice
#
0.01s$ cd docs && sphinx-build -E -W -b html . _build/html
/home/travis/.travis/job_stages: line 57: cd: docs: No such file or directory
The command "cd docs && sphinx-build -E -W -b html . _build/html" exited with 1.
#

Any ideas?

raven canopy
#

@timber lion looks great! well done!

reef seal
#

@stuck elbow This article references ISR programming on MicroPython - what is the relationship between CircuitPython and MicroPython, is there a way to use this on a CircuitExpress board?

raven canopy
#

@fading solstice there is discussion in issue #613 that the ssd1306 RTD build needs some work. that's probably what you're running into. the RTD link is still 404ing, too.

fading solstice
#

@raven canopy thanks for the heads up.

slender iron
stuck elbow
#

@reef seal CircuitPython doesn't implement that part

slender iron
#

@fading solstice the docs files have moved with the latest cookiecutter

#

@reef seal We haven't gone through and removed irrelevant micropython docs. What are you trying to do? We usually rely on C helpers instead of doing interrupts in python.

manic glacierBOT
reef seal
#

@reef seal can I use MicroPython on CircuitPlayground Express? what boards support micoPython?

slender iron
#

@reef seal Nope. pyboard and esp8266 are the core supported boards.

#

What are you trying to do with ISRs?

hollow ingot
#

Esp32 has increasing support too.

fading solstice
#

@slender iron i updated using pip -U before I created the files. What should i be doing?

slender iron
#

move the files around to match the cookiecutter repo

#

new docs directory

fading solstice
#

@slender iron i didn;t see the new docs folder. i will copy that over.

slender iron
#

conf.py is moved there along with a path tweak

#

the table of contents moves from the readme to index.rst as well

reef seal
#

@slender iron I'm just getting starting with CircuitPython and the only way to manage timing that I have seen is sleep(). But that puts the entire thread to sleep and my program can't respond to inputs or anything else during that time. So I'm looking for a more sophisticated way to manage that. aka interrupts, threads, something like that.

I've been a software engineer for a long time but just getting started with programming hardware.

raven canopy
#

@reef seal you can also use time.monotonic() to count time without blocking other operations. similar to the Arduino work around for delay().

#
last_time = time.monotonic()
interval = 1000
while True:
    current_time = time.monotonic()
    if (current_time - last_time) > interval:
         #dostuff
        last_time = time.monotonic()
reef seal
#

@raven canopy A bit tedious but I can see how that would work, thanks.

raven canopy
#

it can get tedious, and long in code...but, work with what you have, right? ๐Ÿ˜„

reef seal
#

yeah, or make something better ๐Ÿ˜ƒ

slender iron
#

@reef seal Ah! Take a look at time.monotonic() its an ever increasing count from start up

#

now, I see the replies. ๐Ÿ˜„ good job @raven canopy !

raven canopy
#

๐Ÿ™‡ ๐Ÿ˜„

#

if only i understood the module-->object<--module chain as well. i'm getting close to getting it to work, but my understanding of what is working is getting less and less. ๐Ÿ˜œ

fading solstice
#

@slender iron missing comma in docs/conf.py on line 15 " 'sphinx.ext.napoleon' "

slender iron
#

oops! mind submitting a PR?

fading solstice
#

will do

slender iron
#

thanks!

fading solstice
#

@slender iron getting closer. now sphinx needs to resolve import framebuf. do i need to add somehting to requirements.txt file.?

slender iron
#

add it to the automock list in conf.py

fading solstice
#

i found the framebuf in micropython doc at

#
http://circuitpython.readthedocs.io/en/latest/docs/library/framebuf.html
slender iron
#

thats different from the import I think

fading solstice
#
https://circuitpython.readthedocs.io/projects/framebuf/en/latest/
slender iron
#

I'm not sure what you mean

#

whats the error?

fading solstice
#

i am not getting what is need ed for framebuf support in sphinx. I now see a # autodoc_mock_imports line

slender iron
#

yeah, try changing that line

fading solstice
#

is that what i need to uncomment

#

ol

#

ok

slender iron
#

yeah and add it to the list

raven canopy
#

["framebuf", "adafruit_bus_device", "micropython"] should be what you'll need

#

forgot the quotes

fading solstice
#

ok

#

getting closer

#
Warning, treated as error:
../README.rst:12:Error in "image" directive:
no content permitted.
.. image:: https://travis-ci.org/adafruit/adafruit_CircuitPython_SSD1306.svg?branch=master
    :target: https://travis-ci.org/adafruit/adafruit_CircuitPython_SSD1306
    :alt: Build Status
    Adafruit CircuitPython driver for SSD1306 OLED displays.
    This driver is based on the SSD1306 driver in the MicroPython source but differs
    by supporting hardware I2C interfaces and Adafruit CircuitPython API.  For a
    MicroPython machine API compatible library see: https://github.com/adafruit/micropython-adafruit-ssd1306
The command "cd docs && sphinx-build -E -W -b html . _build/html" exited with 2.
fading solstice
#

Looks like the .. image is case sentitive. on the web address

frail geode
#

Hi folks! I have a Metro M4 here, and I'm doing some testing. I'm curious, is the schematic available online somewhere?

slender iron
#

@fading solstice I think you are missing a space and need to unindent the text

#

er, by space I mean newline

#

@frail geode schematics aren't usually released until the project is launched

#

what do you want to know?

fading solstice
#

@slender iron Yes, i noticed that and several other problem along the way. I finally got there, but this change for RTD was harder then i expected.

#

Is this the first project ro use most recent changes in cookiecutter ?

slender iron
#

its the second one to be updated to it. the rest now start that way

frail geode
#

tannewt, nothing in particular, just curious as to the differences between it and the metro m0, that's all

slender iron
#

Its mainly the core microcontroller

stuck elbow
#

there is the extra inductor in there, no?

slender iron
#

maybe, I'm not sure if the latest design has it

#

my pyoven one doesn't and its fine. it just uses the linear reg though

manic glacierBOT
manic glacierBOT
#

See isREPLconnected & isUSBconnected issue #544.

This only includes atmel-samd and nRF for now. ESP8266 will require more work since supervisor is not an entity on that port.

This is my first [sub]module from scratch, so please let me know if I totally bungled it. I kind of patchworked my way through it, after initially just putting it all in __init__ then realizing that wouldn't work across ports.

manic glacierBOT
tidal kiln
#

does the neopixel lib support different color arrangements? like GRB vs RGB?

timber mango
tidal kiln
#

@timber mango nice sluething. changing that works.

timber mango
#

:)

tidal kiln
solar whale
#

@tidal kiln crosses posts with you on the forum regarding Gemma โ€œcandle โ€œ I hope I did not confuse things. The 8mm neopixel appears to me to have red/green swapped

tidal kiln
#

@solar whale it does. that's why i was asking.

solar whale
#

Just made one yesterday๐Ÿ˜‰

tidal kiln
#

the candle?

solar whale
#

Yes

#

Swapped neopixel to use the 8mm -had to make the code change

tidal kiln
#

ah. so you ran into same issue as forum poster?

solar whale
#

Yes

tidal kiln
#

hmm

#

did you just change the code to swap the first two entries on these lines?

        strip[0] = [index, int ( (index * 3) / 8 ), 0]
#

or did you change the class level ORDER tuple?

solar whale
#

Yes, just swapped those lines.

slender iron
#

<@&356864093652516868> and everyone else. Meeting tomorrow at our normal time, 11am Pacific / 2pm Eastern.

cunning crypt
#

I'll still be at work at that time. Oh well!

slender iron
#

@cunning crypt I'm happy to chat with you at other times if you like

solar whale
#

@tidal kiln how do you change the ORDER tuple?

tidal kiln
#

cheat

#

just change it through your instance

#

like

strip.ORDER = (0, 1, 2, 3)
solar whale
#

Thanks. Swapping the two lines was pretty easy as well ๐Ÿ˜‰

cunning crypt
#

@slender iron I haven't done much regarding CP lately, so I'm not terribly worried at the moment. There's the recordings for now. Might take you up on it in the future though.

tidal kiln
#

@solar whale yah, changing ORDER is a hack, generally not meant to be done like i did

solar whale
#

Nice to know how to do it., just in case...

tidal kiln
#

i think ideally, it'd be done under the hood

solar whale
#

NeoPixels are still magic...

#

I am amazed they work at all. But this was confusing, since I thought the demo used the diffused neopixel.

#

@tidal kiln just checked and the demo does use the 8mm so I donโ€™t think it works as posted.

tidal kiln
#

i think that is an updated guide, originally only Arduino, now with CP added in.

#

it's a gemma classic in the build photos

#

and the arduino code instatiates correctly:

  wick = new Adafruit_NeoPixel(1, WICK_PIN, NEO_RGB + NEO_KHZ800);

using NEO_RGB

#

@solar whale agree. i think it's a minor bug in the current guide code. once i get the forum poster sorted, i'll send word to have it checked.

solar whale
#

@tidal kiln thanks.

humble mural
#

@timber lion Hello, I would like to stick to CircuitPython, (I know nothing of the Arduino sketch language and I teach Python), how different is C++ form a microcontroller perspective? I have seen about a dozen or so of your videos and you seem to be using Python's OOB and class structure. BTW, I love watcing your videos, I end up having to watch them two and three times because they are chock-full of little pearls of wisdoms. Thanks!

manic glacierBOT
humble mural
#

Do all esp8266 boards run MicroPython/Circuit Python or just Adafruit's? I just spent an hour on the ESP8266 forum and I'm more confused than before.

manic glacierBOT
inner raft
#

I'm just a noob at the circuit python stuff, but the way I understand it, all esp8266 boards could run circuit python, but the adafruit ones have the special bootloader on them which actually does it.

reef seal
#

how to I write to the circuitpython drive from bash? (mac os)

#

I found it : /Volumes/CIRCUITPY

slender iron
#

@inner raft Mostly right! It'll run on most esp8266 with the same flash setup. the Pin names in board may be wrong though. We don't have a special bootloader for the ESP8266. Its just the atmel one that works like a USB drive

manic glacierBOT
raven canopy
#

@slender iron quick Q: is .. include:: indented underneath the .. code:: block?

slender iron
#

I don't think so

#

I think its just include

#

ah, .. literalinclude::

#

(for including an example)

raven canopy
#

i looked at literal...was going to see if you wanted to use that based on the "warning vs error" footnote when a file isn't found. i'll peep the example...

slender iron
#

๐Ÿ‘

raven canopy
slender iron
#

yup!

raven canopy
#

your call. if nothing else, we can at least test it to see how it looks...

#

i do like the inclusion of line numbers, and since we now have pylint skipping over examples, none of that will show up.

slender iron
#

I like line numbers even though the theme on rtd breaks the spacing

raven canopy
#

i'll pull the trigger then. easy fix to revert..

slender iron
#

๐Ÿ‘

manic glacierBOT
carmine hornet
manic glacierBOT
tulip sleet
#

<@&356864093652516868> Warning: The latest master (3.0) commit of adafruit/circuitpython assumes the latest board rev (blue color) because it assumes the SPI flash is connected correctly for QSPI support. The older rev B black boards will not work without changes to boards/metro_m4_express/* files. I will push up a PR to add a new board type metro_m4_express_revb for those without the latest boards. For now you can just restore the old versions of those files to build for your board.
EDIT: you can't restore the old versions of those files -- sorry. But you can change QSPI_FLASH_FILESYSTEM = 1 to SPI_FLASH_FILESYSTEM = 1 in mpconfigboard.mk

tulip sleet
#

Actually there appear to be further problems, so don't upgrade yet.

timber mango
#

Will this affect the 2.2.x series? Sounds like a 3.x issue.

tulip sleet
#

no, not at all

manic glacierBOT
#

I was trying to make a metro_m4_express_revb board temporary board def. I just copied the new version and changed QSPI_FLASH_FILESYSTEMtoSPI_FLASH_FILESYSTEMinmpconfigboard.mk. (I noticed you corrected the MICROPY_PORT_x` defns which describe which pins not to reset, and which appear to have been wrong for a while.)

However, what happens now is that the M4 RevB gets a blue (?color vision issues) status LED every hard-reset and always re-creates the filesystem (takes a number o...

indigo wedge
#

@slender iron I'm gonna have to skip today's meeting to quickly summarize, I had not much time to work on CP last week, hope to get some stuff done this week, mostly the stuff that's assigned on me in Issues. Hug reports for all ๐Ÿ˜‰

slender iron
#

Thanks @indigo wedge ! Have a good rest of your day

humble mural
#

Hello, I made a dumb mistake. I ordered the PC educational pack thinking it was the PCX, itโ€™s not itโ€™s the classic version. I want to program in Python. Should i exchange for the PCX or keep and use Firmata and Python

tidal kiln
#

@humble mural up to you, but if you want to run circuitpython you'll need the CPX

humble mural
#

@tidal kiln I guess the question will my students be able to code a wide variety of projects as they can with the PCX? P

manic glacierBOT
#

we have a little breathing room in external-flash builds. Rather than using #define's, lets create small packed structs, JEDEC-ID-indexed, with details on all the SPI flash chips we come across. Then circuitpy can automatically initialized no matter what chip it finds. This will future-proof us as SPI flash chips come-and-go & also make it easier for non-adafruit-made hardware

slender iron
#

@humble mural the circuitplayground classic is used by code.org through firmata. it has the limitation that it must be tethered to the computer though

tidal kiln
#

@compact solstice there are tons of projects that can be done with the CPC, it's just a matter of what programming environment you want to use. are you wanting to work with something specific?

tulip sleet
#

@compact solstice if you have time to exchange, I would suggest going ahead and doing so.

quick oyster
#

For anybody who cares about async and await stuff but doesnโ€™t understand it yet (which is where I count myself), I found a good article explaining the details: https://snarky.ca/how-the-heck-does-async-await-work-in-python-3-5/

#

Itโ€™s not applicable to CP this instant, but my hope is I can make it relevant soon.

slender iron
#

@quick oyster thanks for the link!

prime flower
#

@quick oyster thanks for this! been looking for some references

slender iron
#

<@&356864093652516868> Meeting in two minutes!

errant grail
#

do-bip

tulip sleet
#

duu-duu

tidal kiln
#

hey hey. just fly on the wall mode again for me this week.

raven canopy
#

Hit 80+ with humidity here.. ๐Ÿ˜‰

#

lol. Sorry.

tidal kiln
#

currently snowing lightly

timber lion
#

cant unmute again!

#

wow

#

weird!

opaque patrol
#

isn't that called lurking?

errant grail
#

It's a "listening skill"

raven canopy
#

HUGS: @mrmcwethy & @brentr for RTD work. Those got knocked out quick! @cater for course correcting a couple of my troubleshooting efforts on discord.

tidal kiln
#

sry. got called away.

slender iron
stuck elbow
opaque patrol
errant grail
#

@opaque patrol Super!

raven canopy
#

I think one is open...

#

Scroll up. Someone (@cater?) posted it.

errant grail
raven canopy
#

STATUS: Trellis is...closer? ๐Ÿ˜ serial_connected PR pending. Next issue...haven't decided/open for suggestions.

#

Noted.

#

Still need to figure out how I should frame this..but

#

Educator resources? Anything better than just "email support" and "look at learn guides"?

#

That's who I meant...

#

๐Ÿ‘

errant grail
#

Black tape

raven canopy
#

Wish I could mic; but it's like kattni was channeling my thoughts. Thanks @idle owl !

idle owl
#

@raven canopy ๐Ÿ˜ƒ

errant grail
#

Thanks to @idle owl and @slender iron for encouraging me to use GitHub more. Created 15 project repositories this week.

raven canopy
#

Thanks everyone! Have a great rest of your Monday-on-a-Tuesday!

manic glacierBOT
errant grail
#

bye!

manic glacierBOT
slender iron
#

fyi, I'm deleting out of date docs from the 2.x branch

indigo wedge
#

Ayy, $15 cheapest shipping to Sweden for a $3.5 blinka pin :(

humble mural
#

@tulip sleet In my gut I agree. The main issue is that I want to stick to Python and more so, the paper work that I have to do in order to make that exchange happen make closing on a home like a walk in the park.

slender iron
humble mural
#

That is also true considering that Adafruit seems to be moving to support CircuitPython with both barrels blazing.

manic glacierBOT
slender iron
#

Going as fast as we can @humble mural ๐Ÿ˜ƒ

humble mural
#

@slender iron Hello, always a pleasure chatting with you. My comments were in reference to a something I said earlier. I screwed up and ordered the CP Educators pack, wasn't aware of a CP vs CPX (I wanted CPX). I asked the room if the CP was an adequate platform for Python programming. In other words, are there plenty of challenging projects for students to do in Python. 2 reasons for considering keeping that kit is I really don't want to introduce another programming language (Python and Java are enought for three years of high school) and doing the paper to return that kit and then resubmitting the P/O is a nightmare. None the less, that is what I am going to have to end up doing.

slender iron
#

@humble mural I think the CPX will be better in the long term. Sorry for the hassle though!

stuck elbow
#

we might have understood CP as CircuitPython not CircuitPlayground

#

too many acronyms

#

we are turning into IBM

humble mural
#

@slender iron Nothing to be sorry about, it was totally my fault. I feel bummed because I have my CPX and it's going all over the room and the kids are tearing it up, they love it! So I wanted to put it in there hands as soon as possible. @stuck elbow Got it! You have to learn language. thanks

#

@stuck elbow besides I'm a vet so acronyms are right up my ally (sorry, nothing witty to add here).๐Ÿ˜‚

opaque patrol
#

@humble mural I assume you got the Code.org educator's pack? There is also a Circuit Playground Express Educator's Pack which comes with CPX.

humble mural
#

Yes

#

@opaque patrol That is the other thing, This year I teach one section of AP Computer Science Principles.

#

I got caught up in everything except the correct content of the pack.

#

There is.....

opaque patrol
#

I am not an Adafruit employee, but have you tried contacting Support about the mixup?

humble mural
#

I offered a list of solutions they responded back with a return to Adafruit response. I was hoping to return the 15 Circuit Playground boards and get 15 CPX in exchange and just pay the difference (even if out of pocket, much easier).

opaque patrol
#

Probably due to it being a 'code.org' pack.

humble mural
#

I agree, I have to assume that my suggestion would ruin the package. Again, my mistake, I'll take care of it, at the end of hte day, it's all good.

tawdry ether
#

I'm trying to use serial over USB with a circuit playground express using circuitpython without any success. This seems to be what I'm looking for, but I'm unable to import the machine module: http://circuitpython.readthedocs.io/en/2.x/docs/library/machine.UART.html

I installed the latest library bundle linked here: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries

Is there something else I need to install? Or is there something else I should be using?

New to CircuitPython? This is the place to start.

opaque patrol
#

@tawdry ether What operating system are you using?

tawdry ether
#

OS X

slender iron
#

@tawdry ether you want busio.UART what board are you using?

tawdry ether
#

the circuit playground express

#

what pins would I specify to use USB serial?

slender iron
#

you want to write text back to the computer?

tawdry ether
#

Yes, as well as read a byte string from the computer

slender iron
#

you can simply print() to send to the computer. input() will read data from the computer

#

usually the serial connection is used for debugging

tawdry ether
#

input generally blocks until there is input, is there a nonblocking way to see if there's input?

#

the busio interface seems like what I'm looking for, but I can't seem to get it to work

solar whale
#

@tulip sleet built M4 for metro revb - working fine! Thanks!

timber lion
#

@tawdry ether non-blocking input is actually kind of hard, even in desktop python. it turns out to be a platform specific thing because you're basically looking for key presses and each OS has a different way to do it

#

on windows there are different APIs and on mac IIRC they have select and a different poll

#

but in micropython there isn't really an analog

#

it tries to balance buffered vs. non buffered access and blocking vs. non-blocking

tawdry ether
#

Yeah, I was hoping there was a different interface than stdin/stdout as streams don't seem to fit well with reading a serial input stream of bytes.

timber lion
#

so what you want to do is treat sys.stdin as a stream and try to read from it a character at a time

#

but it might actually block a bit IIRC

#

but you can do something like this

#
import sys

while True:
    d = sys.stdin.read(1)
    if d is not None and d != '':
        print('Got: 0x{0:02x}'.format(ord(d[0])))
#

that prints any kepress from repl as hex

#

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Got: 0x64
Got: 0x64
Got: 0x64
Got: 0x64
Got: 0x64
Got: 0x66
Got: 0x66
Got: 0x66
Got: 0x64
Got: 0x66

#

(pressing d and e)

#

the tricky thing though is the terminal you use, if it buffers and waits for an enter before sending then you won't see anything

#

this is just using screen.. i think most are smart and let you check a box to wait for enter before send or just send everything (what you typically want)

#

i'm being a little extra cautious there to check that the d string i get back has data too

#

if you read the micropython io doc it says micropython will actually guarantee you get 1 byte back no matter what

#

vs. in normal python in non blocking modes it would happily return a null value if nothing is available

#

so it's tricky.. i like to be defensive and just always check

#

worst case if it's null or empty the code reaching in to get the character value will explode with an exception

#

that may or may not be what you want ๐Ÿ˜ƒ

#

if you're parsing input though, like reading commands it might be easier to use readline

#

then it waits for a full string with newline and gives it back to you

#

like this:

import sys

while True:
    l = sys.stdin.readline()
    print('Got line: {0}'.format(l.strip()))
#

example output after i type a line and hit enter:
uto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Got line: this is a test line

#

but readline will definitely block for a while until a full line is available

#

there's no non-blocking way to do it that i know

stuck elbow
#

@tawdry ether there is no machine module in circuitpython, that part of the documentation is taken from micropython

slender iron
#

(and I'm deleting it now)

tawdry ether
#

Awesome, thanks @timber lion! That seems to be what I need! I'll let you know how it goes. In case you're interested, I'm trying to adapt my SerialCraft Arduino library to work with CircuitPython: https://github.com/AllwineDesigns/serialcraft-arduino

Here's a project I used it in: https://www.instructables.com/id/Creeper-Detector/

So the goal is to communicate with Minecraft through a mod called SerialCraft that sends data over the serial port. I'm trying to read that data.

Instructables.com

For a couple years, I helped the Children's Museum of Bozeman develop curriculum for their STEAMlab. I was always looking for fun ways to engage kids with...

slender iron
#

@tawdry ether looks awesome! keep us posted on how it goes

tawdry ether
#

Will do, thanks @slender iron!

timber lion
#

oh nifty, yeah if you're lucking and the commands end in newline then readline should be perfect and give you really simple code ๐Ÿ˜ƒ

#

if not, then yeah might need to read a byte at a time and buffer it yourself

#

but at least that's wayyyyy easier in python ๐Ÿ˜ƒ

#

string buffer += sys.stdin.read(1)

#

vs. circular buffers, malloc, str funcs etc in arduino ๐Ÿ˜ƒ

graceful tusk
#

Ok, I'm porting a library from C arduino code. They sub-class Print() and then re-define the write() method to redirect output from stout to writing each byte to the i2c display. Doing it this way, they have all the printable character things and infrastructure of print.

#

I COULD just write a new print() method in my code that just don't care and expects a string that it turns into bytes to feed the disply, but it seemed like a good idea to use the same sort of approach in my ported code. Since in circuitpython, print() is a built in function, I can't sub-class it like they did, but it occured to me that it might work to redirect the stdout to catch print's output. Is that a good idea? Is it feasible?

stuck elbow
#

what "infrastructure" of print would you like to inherit, in particular?

#

it seems to me that print() in python is pretty straightforward and all the work happens before it, with the % operator

graceful tusk
#

? with the % operator?

stuck elbow
#

the string formatting operator, yes

#

or the .format() method, if you are so inclined

#

in any case, print just gets a string

graceful tusk
#

ok, so I think that print gets passed an object, and it's the object's .format() method that does the work?

stuck elbow
#

no, the method is called .__str__()

#

but that's the idea, pretty much

graceful tusk
#

i.e. ```

foo = 0x06
print(foo)
6

#

print just says whatever foo.__str__() is, that's going out

stuck elbow
#
>>> foo = 0x06
>>> foo.__str__()
'6'
graceful tusk
#

ftfm, thanks

stuck elbow
#

well, it does add sep if you print several things, and end at the end

graceful tusk
#

and what does it do about non-printable chars?

stuck elbow
#
>>> print(1, 2, 3, sep=":", end="...\n")
1:2:3...
#

it prints them anyways

#

it just sends the bytes to the UART, and lets your computer on the other side handle them

graceful tusk
#

Ok, I'll just call the .__str()__ on whatever is passed to my print method, and then iterate through the string sending bytes to the display. Easy, done in minutes.

stuck elbow
#

actually use str() functuon, like str(foo)

#

that calls foo.__str__() under the hood

#

just like len(foo) calls foo.__len__()

graceful tusk
#

got it.

manic glacierBOT
tawdry ether
#

@timber lion, @slender iron, It seems like the CPX is rebooting in some cases and reporting incorrect data in others.

slender iron
#

@tawdry ether it'll reboot after the drive is written to

#

in the samd module there is a way to turn it off

tawdry ether
#

In the middle of running the code, the python script stops reporting serial messages, when another connected device continues to correctly report the serial messages. At some point the CPX is crashing.

#

It seems like a bug to me, where should I report it?

slender iron
#

I don't think it is

#

have you tried connecting with a serial connection directly?

#

when it autoreloads it will get a KeyboardException

tawdry ether
#

Well if it's not crashing, then its not correctly receiving serial data that it's being sent.

slender iron
#

main.py can be interrupted by default

#

and it will be reloaded

#

it does that so its easy to iterate on the code

#

it should be visible over a normal serial connection

tawdry ether
slender iron
#

can you try connecting to the serial port through screen in the terminal? (I think you are on mac osx)

tawdry ether
#

I can

slender iron
#

thanks!

humble mural
#

The first error I get is the Traceback (most recent call last):
File "code.py", line 7, in <module>
ImportError: no module named 'adafruit_circuitplayground'

#

I assume I have to put that on the board so that Python can access it.

idle owl
#

Yep!

#

You need to load the CircuitPython library bundle onto your board first

humble mural
#

Ok, give me a few minutes to figure it out

idle owl
#

@humble mural Would you like a guide link?

tawdry ether
#

@slender iron I can connect fine through screen, but the problem arrises with specific messages, which I can't send with a keyboard

humble mural
#

yes, but i won't look at it until I strike out. Struggling is 80% of the fun.

idle owl
slender iron
#

@tawdry ether can you take a screenshot?

humble mural
#

@idle owl Thanks!!!

tawdry ether
#

@slender iron of what?

idle owl
#

The guide link has a link to the library bundle, which you may want to at least grab that and not struggle through finding it.

slender iron
#

@tawdry ether with "specific messages"?

#

or is there input that it takes?

tawdry ether
#

@slender iron the message that gives unexpected output is the following bytes of data: 1, 83, 67, 2, 4, 13

slender iron
#

oh!

#

its possible one of those is a control character

#

if you ctrl-c then the script will quit

#

ctrl-c is 3 and ctrl-d is 4

tawdry ether
#

That would do it!

slender iron
#

do you have any control over what is sent to the circuitplayground?

tawdry ether
#

I do, but I'd prefer not to make changes to the Minecraft mod.

slender iron
#

it'd be safer to encode it into text somehow

tawdry ether
#

ok, I'll put some thought into it. Thanks for the help!

slender iron
#

no problem! perhaps we should add second serial connection to the usb composite descriptor

tawdry ether
#

How do you properly close screen?

slender iron
#

I do "ctrl-a k"

#

for kill

#

circuitpython doesn't take offense to it ๐Ÿ˜ƒ

tawdry ether
#

perfect, thanks!

slender iron
#

np, I'm excited to see the minecraft integration!

tawdry ether
#

I'm not sure what you mean by "perhaps we should add second serial connection to the usb composite descriptor"

slender iron
#

you aren't the first person wanting to transmit and receive data over usb to the board

#

its tricky now because we also use it for circuitpython itself

#

in the future we could have the device contain two serial connections, one for circuitpython and one for user code

tawdry ether
#

That would be ideal

slender iron
#

cool cool, we'll get there

#

dynamic usb configuration is something we want to add

tawdry ether
#

Awesome, well I'll keep an eye on your progress and think about ways I can move forward. Thanks again for all the help!

humble mural
#

@idle owl thanks got it running. Do I have to copy the entire library folder or can just move in the โ€œadafruit_circuitplaygroundโ€ folder?

#

my only concern is future file space.

slender iron
#

@humble mural copying it all is easiest but you can copy it as needed as well

#

you may find you have other import errors after copying the single folder

#

k, time for dinner. goodnight all!

idle owl
#

@humble mural make sure you keep it in a /lib folder if you copy only the one library over because that's where it looks for the lib, or will look for other libs when you start to add more.

#

Makes it easier for the future as you start to use more libraries.

humble mural
#

@idle owl In your judgement it's okay to drag that entire foldre over and deal with space issues when space become an issue. Because right now I am not sure exactly what I would drag over if I didn't drag the entire folder over.

idle owl
#

Ahh ok

#

So when I've dealt with it, there's two major options.

#

You start with only the library you're using, and as you add more stuff to the project, you get an error "module not found" and you remember to drag that library over from the bundle as you go. I've done this, and sometimes I even remember to add the library before I get the error!

humble mural
#

I'd drag over "adafruit_circuitplayground" .... and that's it...correct and I wuold put that in the /lib folder on the CPX.

idle owl
#

Or you copy the entire bundle over, and when you get a memory error, you delete the stuff you're not using to free up space.

#

Yep that's a great place to start!

humble mural
#

Option two for now.

idle owl
#

Excellent ๐Ÿ˜ƒ

tawdry ether
#

@slender iron does circuitpython use the control characters for anything other than the REPL? Could there be a separate UF2 file with the REPL turned off?

humble mural
#

@idle owl I want to create good habits from the beginning. Right now I am running code.py which is the bike light project code. I want to move on (or finish for the class period) to something else. Do I exit Mu, go to the circuitpy drive and rename code.py to bikeLight.py and reuse code.py later or don't store any file on the CPX at all?

idle owl
#

I would, to be safe, create a directory on your computer and at least copy bikelight.py to that directory. If at some point the file system on your CPX gets corrupted, which happens, you'd lose all the files on the board. So I do my projects, and then save them to a CPXDev folder on my computer for reuse later. You can leave it on the CPX if you think you might reuse it soon, so it's there, but still keep a second copy. Which I also do.

humble mural
#

Perfect I was going to do a version of that. Through the schools system I have a 1TB OneDrive. I already created an Adafruit directory for drivers, libraries, etc. I'll just put a CPX subdirectory in there, thanks again.

humble mural
#

@meager fog, I'm watch you right now, https://www.youtube.com/watch?v=91qnz-VVrpU , you refer to Digikey when searching for infrared receivers. Please incorporate a lesson on how to shop on Digikey. I never buy from them because I can't find what I want half the time. A little lesson for the "Digikey challenged" would be appreciated. Thanks!

if you can't feed a hundred people, then feed just one - mother teresa ----------------------------------------- Visit the Adafruit shop online - http://www....

โ–ถ Play video
frail geode
#

I used to keep track of when a component was 10x bigger or smaller than I expected ๐Ÿ˜ƒ Hasn't happened in a decade but it was funny when it happened!

timber mango
#

@compact solstice that's a good idea, ill let ya know ๐Ÿ˜ƒ

blazing trail
#

hey @timber mango

#

my bot is up!

timber mango
#

I find their shipping uber fast!

raven canopy
#

@idle owl "great guide migration" parts ordered. ๐Ÿ˜„ with a couple "me" projects added (blinka, meet FRAM and VS1053. FRAM and VS1053, meet blinka)

timber mango
#

I love fram

blazing trail
#

circuitpython is the new programming language! It's so much better than javascript!

idle owl
#

@raven canopy Excellent!

timber mango
#

@blazing trail congrats on the bot. what should i do to try it out?

ruby lake
#

ok all midicv code is as good as it gets, time to build second module

timber mango
#

@ruby lake cool, we'll have M4's soon

#

dual DAC, 1MSPS each

ruby lake
#

hm, can do stereo string machine

timber mango
#

all sorts o things.

graceful tusk
#

Ok, so I have some code that was working, using i2c_device from adafruit_bus_device library. now it is giving OSError: 5 errors.

#

I suspect that the lcd I am communicating with is borked, would that result in OSError: 5?

timber mango
graceful tusk
#

File "/lib/adafruit_bus_device/i2c_device.py", line 102, in write

timber mango
#

maybe pullups are missing

graceful tusk
#

I have a 4k pullup on SDA to 3.3v

ruby lake
#

also scl?

timber mango
#

do you have a photo of your wiring? that will help

graceful tusk
#

it's on a breadboard; I just reseated the scl pullup and it is doing something different anyway.

#

I suspect it is breadboard gremlins. can post a pic in a bit.

timber mango
#

otez

#

totez

#

ok pumpkin time l8r!

graceful tusk
#

i2c scans are now not finding devices.

#

they were before, so I think I just need to get better connections than this cheap breadboard and jumpers are providing.

manic glacierBOT
#

Assigned myself, but anyone feel free to jump in. @ me if you start one so I can mark it, or if you get one completed and need it marked as complete.

So, I took step one and made a list of the current drivers in the bundle. Then, went through each one to see if any were already completed (knew it would be a short list).

At any rate, here's the task list:

DRIVERS

  • [ ] ads1x15
  • [ ] amg88x
  • [ ] apds9960
  • [ ] bme280
  • [ ] bme680
  • [ ] bmp280
  • [ ] bno055
  • [ ] ccs81...
pastel panther
#

Gotta catch'em all! blinka

raven canopy
#

that is a nice collection!

pastel panther
#

I have a compulsion #sorrynotsorry

#

really though I only have this many so I can test across the available platforms

reef seal
#

Hi all. I want to find a way to stream the serial output of my board to the terminal instead of using mu editor for this. Anyone know a command that will do this?

pastel panther
#

on a mac screen will work

#

what are you using?

reef seal
#

mac

pastel panther
#

check what's available with ls /dev/tty.usb*

#

then screen /dev/tty.usbmodemXXXX

graceful tusk
#

After further investigation, it seems the lcd is borked ๐Ÿ˜ฆ le sigh.

reef seal
#
/dev/tty.usbmodem1421```
pastel panther
#

to disconnect use CTRL-A, ATRL-K

#

looks about right

#

it you may get different values depending on how many boards you have connected and when

reef seal
#

@pastel panther Cannot open line '/dev/tty.usbmodem1421' for R/W: Resource busy

pastel panther
#

you may have to close mu if you have it open, or at least disconnect from the board

reef seal
#

Yes perfect!

#

seems to be working

pastel panther
#

@idle owl Are you responsible for my new CPX behaving like a mario coin block at a rave?

#

cool!

#

Make sure to use the ctrl+A then ctrl+K to disconnect or it may screw up your terminal

#

@graceful tusk Sorry to hear it; I had one suffer the same fate after spending to much time int he box 'o parts

slender iron
#

@tawdry ether a custom build would be possible but I wouldn't want to distribute as a supported release

manic glacierBOT
humble mural
#

Good morning. Last night I was inspired by @timber mango video on the CPX and IR remotes. I shared the Pixmob site with my class and they want to experiment with that using the CPX. Before they run they have to crawl. We want to do this in CircuitPython. My first question is how would I program the CPX to read the it remote so we know what information each button is sending. I found a similar project but it uses C++. I can start with that as a reference if need be. Thanks in advance.

stuck elbow
#

I think there is a library that decodes the remote signal

prime flower
tidal kiln
#

@compact solstice โฌ† that's it, but also, it's still a work in progress

prime flower
tawdry ether
#

@slender iron, @timber lion, I'm still unable to read from stdin in a nonblocking way. The docs reference non-blocking mode, but I don't see how to enable that mode. Any ideas?

prime flower
#

for anyone else interested - the itsy bitsy m0s are available on the store this morning (stock < 100)

split ocean
#

hey <@&356864093652516868> or anyone else here do we have a good link for Express spi flash erase proceedure? I'm helping someone troubleshoot a CPX issue in the forums and it may be time to erase it.

tidal kiln
split ocean
#

thanks

umbral dagger
#

@pastel panther No Gemma M0?

timber mango
#

so jut got my first trinket M0

#

and been playing with the dotstar

#
import board
import digitalio
import busio
import time
 
dotstar = busio.SPI(board.APA102_SCK, board.APA102_MOSI)
print("INIT")

def setPixel(red, green, blue):
    if not dotstar.try_lock():
        return
    print("setting pixel to: %d %d %d" % (red, green, blue))
    data = bytearray([0x00, 0x00, 0x00, 0x00,
                      0xff, blue, green, red,
                      0xff, 0xff, 0xff, 0xff])
    dotstar.write(data)
    dotstar.unlock()
    time.sleep(0.01)

while True:
    stringInp= input("r, g, b: ")
    valuesInp= stringInp.split(", ")
    
    red= int(valuesInp[0])
    green= int(valuesInp[1])
    blue= int(valuesInp[2])
    setPixel(red, blue, green)```
#

is this the most efficient way to do this?

stuck elbow
#

I don't think you need to worry abut efficiency

timber mango
#

i want to be able to cram as much code on it as possible xD

stuck elbow
#

you could do:

while True:
    setPixel(*(int(c) for c in input("r, g, b").split()))
#

but it's a little less readable

timber mango
#

what does that first asterix do?

stuck elbow
#

lets you pass an iterator as individual arguments to the function

#

for example, foo(a, b, c) could be replaced with p = [a, b, c] and then foo(*p)

timber mango
#

huh nice

#

thats very nicely efficient

#

so it just iterates c for each split in r, g, b

stuck elbow
#

yes, precisely

timber mango
#

wouldnt it be

while True:
    setPixel(*(int(c) for c in input("r, g, b: ").split(", ")))```
stuck elbow
#

ah, yes, sorry

#

.split() would work too, but it would split on whitespace

timber mango
#

ah ok

#

ye id prefer by ,

stuck elbow
#

of course normally you would also add all sorts of error handling

timber mango
#

and for def setPixel( what would it pass?

stuck elbow
#

not sure what you mean

timber mango
#
def setPixel(red, green, blue):```
what would i have instead of ``red, blue, green``
stuck elbow
#

when?

timber mango
#

at the def

#

since calling it isnt passing the values red blue and green

stuck elbow
#

it is

#

you wold get exactly the same result

timber mango
#

oh so it doesnt matter what the call is giving it

#

itll just name the first three passed variables as red blue and green?

stuck elbow
#

yes

timber mango
#

ah ok

#

i thought it had to pass them named