From brincooke at brincooke.plus.com Tue Dec 12 12:16:29 2017 From: brincooke at brincooke.plus.com (Brin Cooke) Date: Tue, 12 Dec 2017 17:16:29 +0000 Subject: [Microbit-Python] set_analog_period Message-ID: I cannot make set_analog_period accept a value >1000. The response is ?Value Error invalid period?. The documentation I?ve seen specifies a minimum of 1 but no maximum. Can anyone explain please? From jim at groklearning.com Tue Dec 12 17:19:46 2017 From: jim at groklearning.com (Jim Mussared) Date: Wed, 13 Dec 2017 09:19:46 +1100 Subject: [Microbit-Python] set_analog_period In-Reply-To: References: Message-ID: Hi Brin, Yes, 1000 ms is the maximum -- see https://github.com/bbcmicrobit/micropython/blob/master/source/lib/pwm.c#L182 The PWM events internally use 16-bit tick counters -- each tick is 16 microseconds, so that means that 2^20 microseconds would be the maximum it could support (but also rounded to 1e6). I don't know if there's any particular reason these have to be 16-bit counters other than to save RAM. Jim On 13 December 2017 at 04:16, Brin Cooke wrote: > I cannot make set_analog_period accept a value >1000. The response is ?Value Error invalid period?. The documentation I?ve seen specifies a minimum of 1 but no maximum. Can anyone explain please? > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit From mjadud at bates.edu Tue Dec 19 14:42:04 2017 From: mjadud at bates.edu (Matthew Jadud) Date: Tue, 19 Dec 2017 14:42:04 -0500 Subject: [Microbit-Python] micro:bit Mu/MicroPython questions In-Reply-To: <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> Message-ID: [TOPQUOTE] My background is as a senior (classically trained music) teacher working with teenagers in inner city schools. I also have an MA in Philosophy of Education from London University's Institute of Education (https://www.ucl.ac.uk/ioe/about), so *I MOST CERTAINLY WANT TO SPEND TIME DEBATING* philosophy and approaches with you. ;-) [/TOPQUOTE] Hi Nick, Apologies for the delay. We got into the work of the term, and this thread dropped. After working with the Micro:Bit for a term in an introductory programming/design thinking course, I made some strategic decisions for next term. I switched the hardware for next term to the Circuit Python Express. This is primarily because I can use any editor, and save (via normal filesystem operations, as opposed to through uflash) a "main.py" onto the CPE and it will "just work." And, I can have students drag-and-drop libraries of code (including my own) onto the same flash. This is *critical*. And, further, it seems to have a more up-to-date MicroPython; discovering, at the end of the term, that the version of MP that ships with Mu is too old to enable pullup resistors was a major setback. (Or, if you prefer, I discovered that none of my students could use the Sparkfun game:pads we had purchased, because they require us to pull the internal resistors high so as to detect button presses. I had assumed, as opposed to tested, that this would be possible using MicroPython on the Micro:Bit, and discovered that there was not feature parity between MakeCode and MP on this front. Shame on me, and to the detriment of the students.) It isn't clear what development process the MP/Mu group follow. There's no on-boarding documentation/process, so I'm hesitant to try and dive in and contribute development effort. But, it would probably be some HAL- or DAL-level work to get (say) the USB-mounted behavior to be equivalent between the two platforms. At least, I assume so: I've not investigated. And, I have no idea what is involved in updating the Python that ships with Mu, nor how releases are managed/etc., so again, I'm hesitant to dive in. Anyway, I'm happy to share the lived experience of having used the M:Bs for an environmental sensing project, and then the kinds of work students did in their final projects. Next term we'll try living with the CPEs, and see how that goes. I can put together some blog-type content (on a blog, even) in terms of successes/challenges if it would benefit you/the community. (Basically, I'm working through the inbox, and replying to messages that lingered.) Have an excellent holiday season and new year, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From gfbertsch at gmail.com Wed Dec 20 18:12:47 2017 From: gfbertsch at gmail.com (George Bertsch) Date: Wed, 20 Dec 2017 15:12:47 -0800 Subject: [Microbit-Python] Fwd: micro:bit Mu/MicroPython questions In-Reply-To: References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> Message-ID: I also have felt the lack of documentation. For example, I know microbit supports interrupts because I found www.microbit.co.uk/functions/on-button-pressed in a Google search. But I have no clue how to find the corresponding python module. That said, the microbit/python system has some nice features. In particular, the interpreter "REPL". Also, the file system, while being very simple, is adequate for data logging. George Bertsch ---------- Forwarded message ---------- From: Matthew Jadud Date: Tue, Dec 19, 2017 at 11:42 AM Subject: Re: [Microbit-Python] micro:bit Mu/MicroPython questions To: For Pythonic MicroBit related discussions [TOPQUOTE] My background is as a senior (classically trained music) teacher working with teenagers in inner city schools. I also have an MA in Philosophy of Education from London University's Institute of Education (https://www.ucl.ac.uk/ioe/about), so *I MOST CERTAINLY WANT TO SPEND TIME DEBATING* philosophy and approaches with you. ;-) [/TOPQUOTE] Hi Nick, Apologies for the delay. We got into the work of the term, and this thread dropped. After working with the Micro:Bit for a term in an introductory programming/design thinking course, I made some strategic decisions for next term. I switched the hardware for next term to the Circuit Python Express. This is primarily because I can use any editor, and save (via normal filesystem operations, as opposed to through uflash) a "main.py" onto the CPE and it will "just work." And, I can have students drag-and-drop libraries of code (including my own) onto the same flash. This is *critical*. And, further, it seems to have a more up-to-date MicroPython; discovering, at the end of the term, that the version of MP that ships with Mu is too old to enable pullup resistors was a major setback. (Or, if you prefer, I discovered that none of my students could use the Sparkfun game:pads we had purchased, because they require us to pull the internal resistors high so as to detect button presses. I had assumed, as opposed to tested, that this would be possible using MicroPython on the Micro:Bit, and discovered that there was not feature parity between MakeCode and MP on this front. Shame on me, and to the detriment of the students.) It isn't clear what development process the MP/Mu group follow. There's no on-boarding documentation/process, so I'm hesitant to try and dive in and contribute development effort. But, it would probably be some HAL- or DAL-level work to get (say) the USB-mounted behavior to be equivalent between the two platforms. At least, I assume so: I've not investigated. And, I have no idea what is involved in updating the Python that ships with Mu, nor how releases are managed/etc., so again, I'm hesitant to dive in. Anyway, I'm happy to share the lived experience of having used the M:Bs for an environmental sensing project, and then the kinds of work students did in their final projects. Next term we'll try living with the CPEs, and see how that goes. I can put together some blog-type content (on a blog, even) in terms of successes/challenges if it would benefit you/the community. (Basically, I'm working through the inbox, and replying to messages that lingered.) Have an excellent holiday season and new year, Matt _______________________________________________ Microbit mailing list Microbit at python.org https://mail.python.org/mailman/listinfo/microbit -------------- next part -------------- An HTML attachment was scrubbed... URL: From ntoll at ntoll.org Thu Dec 21 05:29:51 2017 From: ntoll at ntoll.org (Nicholas H.Tollervey) Date: Thu, 21 Dec 2017 10:29:51 +0000 Subject: [Microbit-Python] Fwd: micro:bit Mu/MicroPython questions In-Reply-To: References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> Message-ID: <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> On 20/12/17 23:12, George Bertsch wrote: > I also have felt the lack of documentation.? For example, I know > microbit supports interrupts because I found > www.microbit.co.uk/functions/on-button-pressed > ? ? in a Google > search.? But I have no clue how to find > the corresponding python module.?? > The documentation is here: https://microbit-micropython.readthedocs.io/en/0.9/ Please remember that EVERYTHING to do with MicroPython on the micro:bit was created by a community of volunteers. If you feel there are gaps in the documentation you are most welcome to contribute a pull-request for documentation that fills the gap. There are TWO official development platforms for the micro:bit: MicroPython and Microsoft's MakeCode. MakeCode is an event driven JavasScript based platform hence the function you're looking at for Blocks and MakeCode (as it says on the page to which you link). MicroPython has taken a different approach: we expect people to explicitly create an "event loop" (because, as the Zen of Python says, "Explicit is better than implicit" and we believe it important that learners understand there's a loop involved here). As you'll see from the API docs for the button objects in MicroPython there are was_pressed and is_pressed methods that allow you to detect button presses. Hope this helps, N. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: OpenPGP digital signature URL: From ntoll at ntoll.org Thu Dec 21 06:37:42 2017 From: ntoll at ntoll.org (Nicholas H.Tollervey) Date: Thu, 21 Dec 2017 11:37:42 +0000 Subject: [Microbit-Python] micro:bit Mu/MicroPython questions In-Reply-To: References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> Message-ID: <0f6d1c20-1245-c305-5ddc-e5837f839478@ntoll.org> On 19/12/17 19:42, Matthew Jadud wrote: > Hi Nick, > > Apologies for the delay. We got into the work of the term, and this > thread dropped. > No problem, I know exactly how you feel! ;-) > After working with the Micro:Bit for a term in an introductory > programming/design thinking course, I made some strategic decisions for > next term. > Good stuff. > I switched the hardware for next term to the Circuit Python Express. Yes! This is a great device (and I use it extensively in the MicroPython book I wrote for O'Reilly). > This is primarily because I can use any editor, and save (via normal > filesystem operations, as opposed to through uflash) a "main.py" onto > the CPE and it will "just work." And, I can have students drag-and-drop > libraries of code (including my own) onto the same flash. This is > *critical*. And, further, it seems to have a more up-to-date > MicroPython; discovering, at the end of the term, that the version of MP > that ships with Mu is too old to enable pullup resistors was a major > setback. (Or, if you prefer, I discovered that none of my students could > use the Sparkfun game:pads we had purchased, because they require us to > pull the internal resistors high so as to detect button presses. I had > assumed, as opposed to tested, that this would be possible using > MicroPython on the Micro:Bit, and discovered that there was not feature > parity between MakeCode and MP on this front. Shame on me, and to the > detriment of the students.)? > Ouch. Sorry to hear that. As someone who has used and been involved with both micro:bit and the Adafruit boards, I have to say that Adafruit do an amazing job of making things simple and easy to use. Their rate of creating new stuff and improving things is staggering and a wonder to behold. I have nothing but the deepest respect for their hardware engineering, software *and* efforts in creating educational resources and fostering a community. They pay for a dedicated team to work on CircuitPython (their version of MicroPython - i.e. it's MicroPython with their uniform hardware API on top) whereas MicroPython on the micro:bit is an entirely volunteer "best effort" affair. Most (99.999%) of Damien's work was done for free and he has only recently been paid for fixing some outstanding bugs. No one else has ever been paid, nor, sadly, has anyone ever been acknowledged by the micro:bit foundation or the BBC for the extensive voluntary work and efforts making things for MicroPython like, for example, the speech synthesizer or music module. Wwe've had, I estimate, around 60-80 people volunteer their time for the project, ranging in age from 11yo and upwards and for all sorts of contributions: documentation, goofy projects, code, tools, design work, hosting user groups, giving talks and testing. This is perhaps why Adafruit's community is flourishing (they have a huge number of people engaged with their stuff on their "discord" chat platform, with many resources and projects being published) and the micro:bit "Slack" is sadly lacking in any activity whatsoever or equivalent level of community contributions. There are significantly more people in Adafruit's single CircuitPython channel than there are in ALL the channels combined on micro:bit's Slack. I'd rather hoped micro:bit's Slack would take off, but this doesn't appear the case. It turns out that if you don't celebrate, support or acknowledge your volunteer community they go off and find other stuff to do. > It isn't clear what development process the MP/Mu group follow. There's OK... have you even read any of our documentation? :-P For example: https://mu.readthedocs.io/en/latest/ Also, https://microbit-micropython.readthedocs.io/en/0.9/devguide/contributing.html explains how to contribute to MicroPython. You could also look at the various PRs and feature requests in GitHub's repository for MicroPython on the micro:bit and seen that new features are extensively discussed before they're implemented. > no on-boarding documentation/process, so I'm hesitant to try and dive in > and contribute development effort. But, it would probably be some HAL- Great. So please remember everything you refer to is the result of a "best effort" voluntary work. Why not step up and say something like, "I'm new here, I'll write up some on-boarding documentation for MicroPython on the micro:bit based on my experience coming to the project"? The MicroPython-on-the-micro:bit efforts could do with as much help as possible. > or DAL-level work to get (say) the USB-mounted behavior to be equivalent > between the two platforms. At least, I assume so: I've not investigated. > And, I have no idea what is involved in updating the Python that ships > with Mu, nor how releases are managed/etc., so again, I'm hesitant to > dive in.? > See the documentation mentioned above. Again, all volunteer based and both MicroPython on the micro:bit and Mu are "young" projects so I'm afraid you'll just have to accept volunteers can't do everything. As for DAL things - you're looking in the wrong place. You should check out: https://github.com/lancaster-university/microbit-dal It's all open source and run by Joe Finney who works as a lecturer at Lancaster University. He's a *really awesome guy* and another example of a sadly un-acknowledged contributor to the micro:bit project. > Anyway, I'm happy to share the lived experience of having used the M:Bs > for an environmental sensing project, and then the kinds of work > students did in their final projects. Next term we'll try living with > the CPEs, and see how that goes. I can put together some blog-type > content (on a blog, even)??in terms of successes/challenges?if it would > benefit you/the community. > Please do, this would be wonderfully useful and please make sure you show this to the micro:bit foundation too (via their Slack channel which will get most of the limited eyes interested in this). > (Basically, I'm working through the inbox, and replying to messages that > lingered.) > I know the feeling! :-D > Have an excellent holiday season and new year, And you too. I'm pretty confident that CPE is a better fit for your situation (if I understand your context correctly). I'm stepping away from the micro:bit project in the new year (this has been known since September and the autumn was supposed to be a period where I could hand over the various things I've been running). I've been involved with micro:bit from the very start of the project and, despite my best efforts, I have no way I can possibly make any useful contributions. I was the Python Software Foundation Fellow who proposed and coordinated our involvement in micro:bit. I'll not be doing that again in a hurry. ;-) My hope was for the micro:bit project to embrace, support and welcome the contributions of volunteers (as Adafruit, Raspberry Pi, Arduino and others have so successfully done) as a way to grow an enthusiastic international community of contributors to fix many of the short-comings you mention above. Unfortunately, this hasn't been the focus of the project and I could only champion this position for so long (3 years) before realising I was flogging a dead horse. I'm going to put my efforts elsewhere in projects that demonstrably value and grow their community. I'll still be working on Mu when I can find the time since this is a project that supports more than just micro:bit. Please do let me know (ntoll at ntoll.org) how you get on with the CPE devices, I know the Adafruit engineers involved and can pass on your feedback or (better) introduce you. Alternatively, join Adafruit's discord channels and just dive in. They've put a lot of effort in making their community an open, welcoming, safe and well structured place with plenty of documentation for beginners to advanced projects. I'm pretty certain you'll find lots of useful stuff there for your students as well as a place where your students can flourish. Best wishes and seasons' greetings to you, and here's hoping for your student's success in the new year! N. > Matt > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: OpenPGP digital signature URL: From David at Alphadene.co.uk Thu Dec 21 06:41:29 2017 From: David at Alphadene.co.uk (David Ferrington) Date: Thu, 21 Dec 2017 11:41:29 +0000 Subject: [Microbit-Python] Fwd: micro:bit Mu/MicroPython questions In-Reply-To: <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> Message-ID: <91ECCD14-003A-478B-BF8D-303E119C58F7@Alphadene.co.uk> I?d like to raise something here - surely, it is possible not be in a loop, but still want an event to interrupt your flow, so you can deal with it and then return to the point where you were interrupted. ? David -- Accuracy Transcends Speed > On 21 Dec 2017, at 10:29, Nicholas H.Tollervey wrote: > > On 20/12/17 23:12, George Bertsch wrote: >> I also have felt the lack of documentation. For example, I know >> microbit supports interrupts because I found >> www.microbit.co.uk/functions/on-button-pressed >> in a Google >> search. But I have no clue how to find >> the corresponding python module. >> > > The documentation is here: > > https://microbit-micropython.readthedocs.io/en/0.9/ > > Please remember that EVERYTHING to do with MicroPython on the micro:bit > was created by a community of volunteers. If you feel there are gaps in > the documentation you are most welcome to contribute a pull-request for > documentation that fills the gap. > > There are TWO official development platforms for the micro:bit: > MicroPython and Microsoft's MakeCode. MakeCode is an event driven > JavasScript based platform hence the function you're looking at for > Blocks and MakeCode (as it says on the page to which you link). > > MicroPython has taken a different approach: we expect people to > explicitly create an "event loop" (because, as the Zen of Python says, > "Explicit is better than implicit" and we believe it important that > learners understand there's a loop involved here). As you'll see from > the API docs for the button objects in MicroPython there are was_pressed > and is_pressed methods that allow you to detect button presses. > > Hope this helps, > > N. > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit -------------- next part -------------- An HTML attachment was scrubbed... URL: From ntoll at ntoll.org Thu Dec 21 06:47:01 2017 From: ntoll at ntoll.org (Nicholas H.Tollervey) Date: Thu, 21 Dec 2017 11:47:01 +0000 Subject: [Microbit-Python] Fwd: micro:bit Mu/MicroPython questions In-Reply-To: <91ECCD14-003A-478B-BF8D-303E119C58F7@Alphadene.co.uk> References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> <91ECCD14-003A-478B-BF8D-303E119C58F7@Alphadene.co.uk> Message-ID: <2cd18663-7d51-a440-fde5-f4b01f533ecf@ntoll.org> On 21/12/17 11:41, David Ferrington wrote: > I?d like to raise something here - surely, it is possible not be in a > loop, but still want an event to interrupt your flow, so you can deal > with it and then return to the point where you were interrupted. > > ? David? > Hi David, Not in the version of MicroPython for the micro:bit. Sorry. It is possible to do this on the PyBoard (which is an awesome piece of kit). N. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: OpenPGP digital signature URL: From gfbertsch at gmail.com Thu Dec 21 20:42:08 2017 From: gfbertsch at gmail.com (George Bertsch) Date: Thu, 21 Dec 2017 17:42:08 -0800 Subject: [Microbit-Python] Fwd: micro:bit Mu/MicroPython questions In-Reply-To: <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> References: <016c8fec-483f-8278-75bc-9c9835b2dae3@ntoll.org> <4a87fe22-5aee-4c3d-679f-65a7885ec64f@ntoll.org> <5f9e5e69-c1a9-1677-9c3e-c2eeca629aa3@ntoll.org> Message-ID: Thanks! "was_pressed" will serve my purposes. George Bertsch On Thu, Dec 21, 2017 at 2:29 AM, Nicholas H.Tollervey wrote: > On 20/12/17 23:12, George Bertsch wrote: > > I also have felt the lack of documentation. For example, I know > > microbit supports interrupts because I found > > www.microbit.co.uk/functions/on-button-pressed > > in a Google > > search. But I have no clue how to find > > the corresponding python module. > > > > The documentation is here: > > https://microbit-micropython.readthedocs.io/en/0.9/ > > Please remember that EVERYTHING to do with MicroPython on the micro:bit > was created by a community of volunteers. If you feel there are gaps in > the documentation you are most welcome to contribute a pull-request for > documentation that fills the gap. > > There are TWO official development platforms for the micro:bit: > MicroPython and Microsoft's MakeCode. MakeCode is an event driven > JavasScript based platform hence the function you're looking at for > Blocks and MakeCode (as it says on the page to which you link). > > MicroPython has taken a different approach: we expect people to > explicitly create an "event loop" (because, as the Zen of Python says, > "Explicit is better than implicit" and we believe it important that > learners understand there's a loop involved here). As you'll see from > the API docs for the button objects in MicroPython there are was_pressed > and is_pressed methods that allow you to detect button presses. > > Hope this helps, > > N. > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > -------------- next part -------------- An HTML attachment was scrubbed... URL: