From matt.hickford at gmail.com Thu Jan 5 16:40:37 2017 From: matt.hickford at gmail.com (Matt Hickford) Date: Thu, 5 Jan 2017 21:40:37 +0000 Subject: [Microbit-Python] Image to string and back again Message-ID: Hi all. I wrote a program using the radio module to send images between microbits, but hit a snag converting the received string back to an Image. To demonstrate the problem: >>> Image(str(Image.DUCK)) Traceback (most recent call last): File "", line 1, in ValueError: Unexpected character in Image definition. In the end, the solution was to send `repr(image)[7:36]` rather than `str(image)`, which felt less obvious than ideal. Could the Image(string) constructor be improved to strip the extraneous characters? Otherwise perhaps a note should go in the documentation [1]? -Matt [1] https://microbit-micropython.readthedocs.io/en/ latest/image.html#microbit.Image -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at hotpy.org Thu Jan 5 16:49:44 2017 From: mark at hotpy.org (Mark Shannon) Date: Thu, 5 Jan 2017 21:49:44 +0000 Subject: [Microbit-Python] Image to string and back again In-Reply-To: References: Message-ID: <40a33d9f-5a93-5c67-87ef-a9a3428a320f@hotpy.org> Hi Matt, Conventionally in Python the `repr` function should (for simple objects) produce the Python code to reproduce the object. In other words, you need to use `eval(repr(Image.DUCK))` to get a copy of the duck image. Cheers, Mark. On 05/01/17 21:40, Matt Hickford wrote: > Hi all. I wrote a program using the radio module to send images between > microbits, but hit a snag converting the received string back to an Image. > > To demonstrate the problem: > > >>> Image(str(Image.DUCK)) > > Traceback (most recent call last): > > File "", line 1, in > > ValueError: Unexpected character in Image definition. > > > In the end, the solution was to send `repr(image)[7:36]` rather than > `str(image)`, which felt less obvious than ideal. > > Could the Image(string) constructor be improved to strip the extraneous > characters? Otherwise perhaps a note should go in the documentation [1]? > > -Matt > > [1] https://microbit-micropython.readthedocs.io/en/latest/image.html#microbit.Image > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > From barrachri at gmail.com Mon Jan 9 13:45:01 2017 From: barrachri at gmail.com (Christian Barra) Date: Mon, 9 Jan 2017 19:45:01 +0100 Subject: [Microbit-Python] Microbit:Polska - Happy to announce our first workshop ! Message-ID: Hello ML, We just published a blog post about our first workshop! Check here: https://microbitpolska.org/en/blog/we-are-starting-bbc-micro-bit-is-coming-to-gliwice/ -- With Gravitational Cheers, Christian Barra EuroPython Society board member -------------- next part -------------- An HTML attachment was scrubbed... URL: From loopspace at mathforge.org Wed Jan 18 13:09:03 2017 From: loopspace at mathforge.org (Andrew Stacey) Date: Wed, 18 Jan 2017 18:09:03 +0000 Subject: [Microbit-Python] Communicating with a Micro:bit Message-ID: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Hi all, With a microbit connected to a USB port on a computer I can send stuff from the microbit to the PC using the "print" command on the MB and read it using pySerial on the PC. Can I go the other way? Obviously, I can send messages from the PC but I don't know how to listen on the MB. Can it be done? Thanks, Andrew From jim at groklearning.com Wed Jan 18 19:21:56 2017 From: jim at groklearning.com (Jim Mussared) Date: Thu, 19 Jan 2017 11:21:56 +1100 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: hi Andrew, Just like regular Python, you can use input() while True: cmd = input('? ') if cmd == ... Jim On 19 January 2017 at 05:09, Andrew Stacey wrote: > Hi all, > > With a microbit connected to a USB port on a computer I can send stuff from > the microbit to the PC using the "print" command on the MB and read it using > pySerial on the PC. > > Can I go the other way? Obviously, I can send messages from the PC but I > don't know how to listen on the MB. Can it be done? > > Thanks, > Andrew > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit From damien.p.george at gmail.com Wed Jan 18 19:34:05 2017 From: damien.p.george at gmail.com (Damien George) Date: Thu, 19 Jan 2017 11:34:05 +1100 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: In addition to input(), there is also sys.stdin (and sys.stdout for writing). On 19 January 2017 at 11:21, Jim Mussared via Microbit wrote: > hi Andrew, > > Just like regular Python, you can use input() > > while True: > cmd = input('? ') > if cmd == ... > > Jim > > On 19 January 2017 at 05:09, Andrew Stacey wrote: >> Hi all, >> >> With a microbit connected to a USB port on a computer I can send stuff from >> the microbit to the PC using the "print" command on the MB and read it using >> pySerial on the PC. >> >> Can I go the other way? Obviously, I can send messages from the PC but I >> don't know how to listen on the MB. Can it be done? >> >> Thanks, >> Andrew >> _______________________________________________ >> Microbit mailing list >> Microbit at python.org >> https://mail.python.org/mailman/listinfo/microbit > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit From david.f.booth at googlemail.com Thu Jan 19 05:22:38 2017 From: david.f.booth at googlemail.com (David Booth) Date: Thu, 19 Jan 2017 10:22:38 +0000 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: Hi Andrew Frankly I do not know. However I know someone who does know and that is David Whale who is connected with the Micro:bit Foundation so I will forward your question to him and let him deal with it using the Micro:but Foundation procedures. All the best David On 18 January 2017 at 18:09, Andrew Stacey wrote: > Hi all, > > With a microbit connected to a USB port on a computer I can send stuff > from the microbit to the PC using the "print" command on the MB and read it > using pySerial on the PC. > > Can I go the other way? Obviously, I can send messages from the PC but I > don't know how to listen on the MB. Can it be done? > > Thanks, > Andrew > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.f.booth at googlemail.com Thu Jan 19 05:28:07 2017 From: david.f.booth at googlemail.com (David Booth) Date: Thu, 19 Jan 2017 10:28:07 +0000 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: Hi Andrew I have just realised that you have sent the question to python.org so you should get a positive response from someone on the mailing list so I have not conntacted David Whale. If you do not get a satisfactory answer contact me again. David On 18 January 2017 at 18:09, Andrew Stacey wrote: > Hi all, > > With a microbit connected to a USB port on a computer I can send stuff > from the microbit to the PC using the "print" command on the MB and read it > using pySerial on the PC. > > Can I go the other way? Obviously, I can send messages from the PC but I > don't know how to listen on the MB. Can it be done? > > Thanks, > Andrew > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paivi.e.suomela at gmail.com Thu Jan 19 05:36:51 2017 From: paivi.e.suomela at gmail.com (=?UTF-8?Q?P=C3=A4ivi_Suomela?=) Date: Thu, 19 Jan 2017 10:36:51 +0000 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: Hi Andrew, You can use pyserial.write on the PC, and then read it on the microbit using uart. If you want to look at an example, I have a small game https://github.com/peconia/microbit-space-invaders where I'm communicating both ways. Hope this helps, P?ivi On Wed, Jan 18, 2017 at 6:09 PM, Andrew Stacey wrote: > Hi all, > > With a microbit connected to a USB port on a computer I can send stuff > from the microbit to the PC using the "print" command on the MB and read it > using pySerial on the PC. > > Can I go the other way? Obviously, I can send messages from the PC but I > don't know how to listen on the MB. Can it be done? > > Thanks, > Andrew > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.hickford at gmail.com Thu Jan 19 13:14:39 2017 From: matt.hickford at gmail.com (Matt Hickford) Date: Thu, 19 Jan 2017 18:14:39 +0000 Subject: [Microbit-Python] While loop without sleep Message-ID: Hi. My program reacts to button presses. The documentation gives an example of while loop that checks if the button has been pressed, reacts, then sleeps between loops https://microbit-micropython.readthedocs.io/en/latest/button.html#example while True: sleep(100) if button_a.was_pressed(): act() Does it matter if I omit the sleep statement? I wrote while True: if button_a.was_pressed(): act() It seems to work. My only concern was, might it drain the battery because it's looping very fast? Any thoughts? -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From ntoll at ntoll.org Thu Jan 19 15:52:06 2017 From: ntoll at ntoll.org (Nicholas H.Tollervey) Date: Thu, 19 Jan 2017 20:52:06 +0000 Subject: [Microbit-Python] While loop without sleep In-Reply-To: References: Message-ID: <75f552d6-e2db-6d3c-1ff7-f5a336d40e64@ntoll.org> On 19/01/17 18:14, Matt Hickford wrote: > Hi. My program reacts to button presses. The documentation gives an > example of while loop that checks if the button has been pressed, > reacts, then sleeps between loops > https://microbit-micropython.readthedocs.io/en/latest/button.html#example > > while True: > sleep(100) > if button_a.was_pressed(): > act() > > Does it matter if I omit the sleep statement? I wrote > > while True: > if button_a.was_pressed(): > act() > > It seems to work. My only concern was, might it drain the battery > because it's looping very fast? Any thoughts? > -Matt > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > The sleep is to debounce the button. Say your act() function should only be called once per-press of the button then if the loop is faster than it takes a human to push the button down and then release it (and, believe me, it is) then you'll get a number of calls to act() over the duration of the single push/release interaction. By adding a shortish sleep you avoid this problem. Does this make sense? More than happy to answer questions. 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 matt.hickford at gmail.com Thu Jan 19 16:06:34 2017 From: matt.hickford at gmail.com (Matt Hickford) Date: Thu, 19 Jan 2017 21:06:34 +0000 Subject: [Microbit-Python] While loop without sleep In-Reply-To: <75f552d6-e2db-6d3c-1ff7-f5a336d40e64@ntoll.org> References: <75f552d6-e2db-6d3c-1ff7-f5a336d40e64@ntoll.org> Message-ID: Thanks Nicholas, that makes sense. Because the original example used button.is_pressed() it has to debounce, whereas I used was_pressed() which solves the problem for me (just tested it). I'll keep that in mind, thanks for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.hickford at gmail.com Thu Jan 19 17:06:47 2017 From: matt.hickford at gmail.com (Matt Hickford) Date: Thu, 19 Jan 2017 22:06:47 +0000 Subject: [Microbit-Python] Image to string and back again In-Reply-To: <40a33d9f-5a93-5c67-87ef-a9a3428a320f@hotpy.org> References: <40a33d9f-5a93-5c67-87ef-a9a3428a320f@hotpy.org> Message-ID: Hi Mark. Thanks for your reply. To clarify, the problem is str(image) contains extra spaces, newlines and single quotes compared to the format expected by Image(str) >>> str(Image.DUCK) "Image(\n '09900:'\n '99900:'\n '09999:'\n '09990:'\n '00000:'\n)" >>> Image(str(Image.DUCK)) Traceback (most recent call last): File "", line 1, in ValueError: Unexpected character in Image definition. The formats are only slightly different. My suggestion would be make Image(str) automatically strip the extraneous characters so that the round trip Image(str(Image.DUCK)) would just work. As you say, another workaround is to use eval?assuming you trust the data. My app receives strings over radio, so I went with stripping characters. -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From ctyoung at mtu.edu Fri Jan 20 09:32:24 2017 From: ctyoung at mtu.edu (Charles Young) Date: Fri, 20 Jan 2017 09:32:24 -0500 Subject: [Microbit-Python] can not transfer file from microbit after battery-powered program execution Message-ID: HI Folks: I finally managed to create a micro:bit micro python program to log data to a file on the microbit from the onboard magnetometers. The data acquisition program is otherwise working fine, BUT I find it impossible to transfer the file out to my iMac. Here is my account of the problem. I hope you can help me with this. Chuck Young RE: Micro:bit: want to transfer file after battery-powered data acquisition. My intention is to log magnetometer data to a file on the microbit (while it is battery-powered), and transfer the data to my iMac.,I have created a program on the microbit that reads data from the magnetometer and writes it to a file on the microbit. I can check that the file exists with the OS commands on the micro bit (using REPL in Mu). I am able to create the file on the microbit and transfer the file to my iMac using microfs as long as the microbit is connected to my iMac with the USB cable all the time. I have read that if I ?flash? the microbit (with any program) it will destroy any existing file. I run into trouble when I run the microbit from a battery, then connect the USB cable to transfer the data to the iMac. The microbit program re-starts and then I can?t find the file on the microbit using microfs commands on my iMac. SAMPLE OF TRYING TO TRANSFER FILE FROM MICROBIT TO IMAC GOES LIKE THIS: ( cd to python directory) python import microfs from microfs import ls, rm, put, get, get_serial serial = get_serial() ls(serial) get(serial, filename goes here in single quotes) (This sequence becomes unresponsive at the line ls(serial) -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.hickford at gmail.com Fri Jan 20 14:09:56 2017 From: matt.hickford at gmail.com (Matt Hickford) Date: Fri, 20 Jan 2017 19:09:56 +0000 Subject: [Microbit-Python] Detect if microbit powered by battery or usb Message-ID: Hi. Silly quesion: Is it possible to detect if my microbit is running on battery or powered by usb? -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at thinkingbinaries.com Fri Jan 20 14:55:29 2017 From: david at thinkingbinaries.com (David Whale) Date: Fri, 20 Jan 2017 19:55:29 +0000 Subject: [Microbit-Python] Detect if microbit powered by battery or usb In-Reply-To: References: Message-ID: The KL26 interface processor is powered down when just on battery (hence why the system LED is off on battery only). In order for the nRF51 application processor to send and receive serial data via USB, there are TX/RX lines wired between the two processors. You *might* be lucky and find that the RX in to the nRF51 is low when powered just from battery, and high (marking) when powered from USB (and no serial data is being sent to the micro:bit). I suppose it depends which way the line floats. So, you could try to do a port read of the RX pin on the nRF51 and see if you can infer the power source from that. You can get schematics for the micro:bit reference design here: https://github.com/microbit-foundation/microbit-reference-design/blob/master/PDF/Schematic%20Print/Schematic%20Prints.PDF P0.25 is the RX line at the nRF51 app processor end - so you could sample the state of that raw pin and see if it differs when powered from USB or from battery only. On 20 January 2017 at 19:09, Matt Hickford wrote: > Hi. Silly quesion: Is it possible to detect if my microbit is running on > battery or powered by usb? > -Matt > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jj at gioorgi.com Thu Jan 26 12:42:04 2017 From: jj at gioorgi.com (Giovanni Giorgi) Date: Thu, 26 Jan 2017 18:42:04 +0100 Subject: [Microbit-Python] MicroPython without DAL and compiling under windows (was Re: New version of the microbit DAL) In-Reply-To: <5811C2C4.7010704@hotpy.org> References: <1477483844321.12877@iais.fraunhofer.de> <5811C2C4.7010704@hotpy.org> Message-ID: <97884fcbb6eb7819d2276166242a3047@gioorgi.com> Interesting, so micropyton will run without the Lancaster University DAL anymore? Do you have a roadmap plan for this porting (or a branch) on git hub to help the porting? Also, is it possible to compile micropython under windows10 using the yotta installer? Is it complex to do? Il 2016-10-27 11:03 Mark Shannon ha scritto: > Hi, > > No, we don't plan to update to the newest version of the DAL, although we may well cherry pick bug-fixes if appropriate. > > We are moving away from the DAL, as the all the components of the DAL are tightly coupled together and its memory management and threading model do not work well with MicroPython. > > If there any features of the DAL that are missing from the MicroPython port and that you need, please file an issue. > > Cheers, > Mark. > > On 26/10/16 13:10, Cvejoski, Kostadin wrote: > >> Hi, >> >> I was looking into the microbit/micropython project and I would like to >> say you have done a great job. >> >> However the DAL that is used in the project is not up to date. >> >> My question is do you plan to update to the newest version of the DAL >> and if so when? >> >> Thank you >> >> Best Regards, >> >> Kostadin Cvejoski >> Abteilung Media Engineering >> Fraunhofer-Institut Intelligente Analyse- und Informationssysteme IAIS >> Schloss Birlinghoven >> D-53757 Sankt Augustin >> Telefon + 49-2241-14-2986 >> Fax + 49-2241-14-4-2986 >> kostadin.cvejoski at iais.fraunhofer.de >> >> _______________________________________________ >> Microbit mailing list >> Microbit at python.org >> https://mail.python.org/mailman/listinfo/microbit > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit -------------- next part -------------- An HTML attachment was scrubbed... URL: From nevil.hunt at hotmail.co.uk Thu Jan 26 13:14:26 2017 From: nevil.hunt at hotmail.co.uk (Nevil Hunt) Date: Thu, 26 Jan 2017 18:14:26 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org>, Message-ID: Hi David/Mark/Damien, Are there any updates on this lock-up issue? By the way if you or anyone else on this mailing list is at the BETT Show tomorrow (Friday) then I will be on the micro:bit stand for at least part of the day so come over and say 'hello'! Cheers, Nevil ________________________________ From: Microbit on behalf of David Booth via Microbit Sent: 31 December 2016 23:17 To: For Pythonic MicroBit related discussions Cc: David Booth Subject: Re: [Microbit-Python] Lock-up due to some combination of radio and pwm. Hi Mark I have been having problems getting github to accept my input. It keeps asking me to verify my email address which I have done several times. So I have now re registered and submitted a comment. However it did not let me send .hex or .py files However you should know that in the interim Damien George has my hex files and has reproduced the problem. I have sent him my .py files so he can investigate further. Happy New Year David On 30 December 2016 at 12:04, Mark Shannon > wrote: Hi Nevil and David, Could you please submit an issue for this. https://github.com/bbcmicrobit/micropython/issues/new It is frustrating knowing that there may be a problem, but not being able to fix it. All I need is a brief description of what goes wrong and, most importantly, some code that causes the problem. Cheers, Mark. On 23/12/16 18:44, Nevil Hunt wrote: Hi David, I've also encountered some similar symptoms this week, namely a micro:bit locking up such that a reset doesn't bring it back to life. Only a power cycle brings it back to life. My set-up has some similarities with yours in that I'm sending Radio commands from one micro:bit to another using the suggested method of "radio.send(str(x))" with the receiving micro:bit locking up from time to time. However I think the lockups might not be due to the Radio commands. I too have the receiving micro:bit driving pins with PWM (in my case Servos) and with a bit of experimenting it looks like it might be these "pin1.write_analog(x_angle)" commands that are causing the lock-ups since by commenting out these "write_analog" commands (but with all the Radio commands still running) it hasn't locked up in over an hour. By comparison, with the "write_analog" commands still active, ~5 mins is the longest it runs without locking up. Maybe you could see if commenting out the "write_analog" commands on your setup has the same effects. It may not stop other errors but I'd be interested to see if it stops the lock-ups. Cheers, Nevil ------------------------------------------------------------------------ *From:* Microbit > on behalf of David Booth via Microbit > *Sent:* 23 December 2016 15:09 *To:* For Pythonic MicroBit related discussions *Cc:* David Booth *Subject:* Re: [Microbit-Python] List of error codes and their meanings Hi Damien I have a related question regarding run time errors in micro Python. I have three micro:bits. The first I call Rx because it basically receives x axis acceleration data in string form, via the radio from the other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 with 100 ms gaps. Nicholas Tollervey showed me how to avoid the Type None error when converting the string to an integer in RX and I now have three simple script which enable Rx to drive pins P0 (from Tx1) and P8 (from Tx2) with a PWM signal. However after running perfectly well for anything from 10 seconds to a minute Rx freezes. On the very few occasions an error message has scrolled it appears to be saying that "received is not a string" and possibly there is a value error. However on 98% of occasions Rx is frozen to the extent it cannot report the error. Since spurious errors do not worry me, provided Rx continues with the polling loop, is it possible to suppress catching run time errors and if it is possible is it likely that the While loop would continue? Sometimes pressing reset restarts the system but sometimes I have to remove the battery. Thank you and a Happy Christmas David Booth ps will you be at BETT? On 20 December 2016 at 23:31, Damien George >> wrote: There are many exceptions and they can occur for many reasons. Almost all are based on CPython and the exceptions form a hierarchy. Eg, indexing a list with an out-of-bounds index will raise IndexError, which derives from LookupError, which derives from Exception, which derives from BaseException. For a list of implemented exceptions in MicroPython see https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280 On 21 December 2016 at 08:35, David Whale >> wrote: > Is there anything in the docs that lists all the errors (exceptions) that > can occur in MicroPython and what they mean? > > The closest I found was this: > > https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h > > > Thanks > > David > > microbit.org-ticket: 460 > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > > https://mail.python.org/mailman/listinfo/microbit > _______________________________________________ Microbit mailing list Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit _______________________________________________ Microbit mailing list Microbit at python.org https://mail.python.org/mailman/listinfo/microbit _______________________________________________ Microbit mailing list Microbit at python.org https://mail.python.org/mailman/listinfo/microbit -------------- next part -------------- An HTML attachment was scrubbed... URL: From damien.p.george at gmail.com Fri Jan 27 03:03:02 2017 From: damien.p.george at gmail.com (Damien George) Date: Fri, 27 Jan 2017 19:03:02 +1100 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> Message-ID: Hi Nevil, It's fixed with the latest version of the code on GitHub. Please see here for details: https://github.com/bbcmicrobit/micropython/issues/392 Regards, Damien. On 27 January 2017 at 05:14, Nevil Hunt wrote: > Hi David/Mark/Damien, > > > Are there any updates on this lock-up issue? > > > By the way if you or anyone else on this mailing list is at the BETT Show > tomorrow (Friday) then I will be on the micro:bit stand for at least part of > the day so come over and say 'hello'! > > > Cheers, > > > Nevil > > From david.f.booth at googlemail.com Fri Jan 27 05:27:10 2017 From: david.f.booth at googlemail.com (David Booth) Date: Fri, 27 Jan 2017 10:27:10 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> Message-ID: Hi Nevil, Damien, Mark Re Micro Python lock up when Radio and PWM output used on micro:bit. Damien found that my firmware was out of date and sent me a fix which involved merging two hex file. Unfortunately my programming skills were not up to performing this merger and so David Whale sent me this idiots guide (me) to producing a microPython editor on my PC screen which incorporated Damien's fix but enabled me to write any microPython script as I would in the editor I would have got via microbit.org. This solution written by Nicholas Tollervey is given at the end of this email. This worked. So I recommend you follow the instructions but remember if you do not update your new editor, over time it might get out of date again. *Question for Damien* *For people like me with older micro:bits and poor C skills, will there come a time when linking into the microPython editor via www.microbit.org will give them an editor that will by-pass this problem or should the microPython documentation warn them that if they want to use radio and PWM to use the following procedure?* Regarding Ticket 583 https://support.microbit.org/helpdesk/tickets/583 Ok, so I have a simple scheme for how you can fix this, the idea came from Nicholas Tollervey late last night! 1. go to: https://github.com/bbcmicrobit/PythonEditor 2. press the CLONE OR DOWNLOAD button 3. Choose the DOWNLOAD ZIP option This will download a complete web based python editor. 4. Unzip this on your computer - you should now have a PythonEditor folder 5. get Damien's patched .hex file from here: https://micropython.org/ resources/firmware/microbit-micropython.hex 6. rename Damien's .hex file as 'firmware.hex' and replace the firmware.hex that is in the PythonEditor directory that is now on your computer with this patched version. 7. double click on editor.html - this should launch a complete python editor web page in your browser. 8. Paste your code into this editor window, then press the DOWNLOAD button. This will generate a .hex file that has your script and Damien's latest MicroPython 'firmware' inside it (which apparently has the PWM fix inside it that he was talking about) 9. Test your code again to see if the PWM lasts for longer, and report back to us on how this goes? Hope this helps! David Whale micro:bit support http://microbit.org/team On 26 January 2017 at 18:14, Nevil Hunt wrote: > Hi David/Mark/Damien, > > > Are there any updates on this lock-up issue? > > > By the way if you or anyone else on this mailing list is at the BETT Show > tomorrow (Friday) then I will be on the micro:bit stand for at least part > of the day so come over and say 'hello'! > > > Cheers, > > > Nevil > > > ------------------------------ > *From:* Microbit > on behalf of David Booth via Microbit > *Sent:* 31 December 2016 23:17 > *To:* For Pythonic MicroBit related discussions > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of radio > and pwm. > > Hi Mark > I have been having problems getting github to accept my input. It keeps > asking me to verify my email address which I have done several times. So I > have now re registered and submitted a comment. However it did not let me > send .hex or .py files > > However you should know that in the interim Damien George has my hex files > and has reproduced the problem. I have sent him my .py files so he can > investigate further. > > Happy New Year > David > > On 30 December 2016 at 12:04, Mark Shannon wrote: > >> Hi Nevil and David, >> >> Could you please submit an issue for this. >> https://github.com/bbcmicrobit/micropython/issues/new >> >> It is frustrating knowing that there may be a problem, but not being able >> to fix it. >> All I need is a brief description of what goes wrong and, most >> importantly, some code that causes the problem. >> >> Cheers, >> Mark. >> >> On 23/12/16 18:44, Nevil Hunt wrote: >> >>> Hi David, >>> >>> >>> I've also encountered some similar symptoms this week, namely a >>> micro:bit locking up such that a reset doesn't bring it back to life. >>> Only a power cycle brings it back to life. >>> >>> >>> My set-up has some similarities with yours in that I'm sending Radio >>> commands from one micro:bit to another using the suggested method of >>> "radio.send(str(x))" with the receiving micro:bit locking up from time >>> to time. However I think the lockups might not be due to the Radio >>> commands. I too have the receiving micro:bit driving pins with PWM (in >>> my case Servos) and with a bit of experimenting it looks like it might >>> be these "pin1.write_analog(x_angle)" commands that are causing the >>> lock-ups since by commenting out these "write_analog" commands (but with >>> all the Radio commands still running) it hasn't locked up in over an >>> hour. By comparison, with the "write_analog" commands still active, ~5 >>> mins is the longest it runs without locking up. >>> >>> >>> Maybe you could see if commenting out the "write_analog" commands on >>> your setup has the same effects. It may not stop other errors but I'd be >>> interested to see if it stops the lock-ups. >>> >>> >>> >>> Cheers, >>> >>> >>> Nevil >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> *From:* Microbit >>> on behalf of David Booth via Microbit >>> *Sent:* 23 December 2016 15:09 >>> *To:* For Pythonic MicroBit related discussions >>> *Cc:* David Booth >>> *Subject:* Re: [Microbit-Python] List of error codes and their meanings >>> >>> Hi Damien >>> >>> I have a related question regarding run time errors in micro Python. >>> >>> I have three micro:bits. The first I call Rx because it basically >>> receives x axis acceleration data in string form, via the radio from the >>> other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 with 100 ms >>> gaps. Nicholas Tollervey showed me how to avoid the Type None error when >>> converting the string to an integer in RX and I now have three simple >>> script which enable Rx to drive pins P0 (from Tx1) and P8 (from Tx2) >>> with a PWM signal. >>> >>> However after running perfectly well for anything from 10 seconds to a >>> minute Rx freezes. On the very few occasions an error message has >>> scrolled it appears to be saying that "received is not a string" and >>> possibly there is a value error. However on 98% of occasions Rx is >>> frozen to the extent it cannot report the error. Since spurious errors >>> do not worry me, provided Rx continues with the polling loop, is it >>> possible to suppress catching run time errors and if it is possible is >>> it likely that the While loop would continue? >>> >>> Sometimes pressing reset restarts the system but sometimes I have to >>> remove the battery. >>> >>> Thank you and a Happy Christmas >>> David Booth >>> ps will you be at BETT? >>> >>> >>> On 20 December 2016 at 23:31, Damien George >> > wrote: >>> >>> There are many exceptions and they can occur for many reasons. >>> Almost >>> all are based on CPython and the exceptions form a hierarchy. Eg, >>> indexing a list with an out-of-bounds index will raise IndexError, >>> which derives from LookupError, which derives from Exception, which >>> derives from BaseException. >>> >>> For a list of implemented exceptions in MicroPython see >>> https://github.com/bbcmicrobit/micropython/blob/master/sourc >>> e/py/objexcept.c#L192-L280 >>> >> ce/py/objexcept.c#L192-L280> >>> >>> On 21 December 2016 at 08:35, David Whale >>> > >>> wrote: >>> > Is there anything in the docs that lists all the errors >>> (exceptions) that >>> > can occur in MicroPython and what they mean? >>> > >>> > The closest I found was this: >>> > >>> > >>> https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919 >>> cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h >>> >> 9cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h> >>> > >>> > >>> > Thanks >>> > >>> > David >>> > >>> > microbit.org-ticket: 460 >>> > >>> > >>> > >>> > _______________________________________________ >>> > Microbit mailing list >>> > Microbit at python.org >>> > https://mail.python.org/mailman/listinfo/microbit >>> >>> > >>> _______________________________________________ >>> Microbit mailing list >>> Microbit at python.org >>> https://mail.python.org/mailman/listinfo/microbit >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Microbit mailing list >>> Microbit at python.org >>> https://mail.python.org/mailman/listinfo/microbit >>> >>> _______________________________________________ >> 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 Fri Jan 27 06:04:49 2017 From: ntoll at ntoll.org (Nicholas H.Tollervey) Date: Fri, 27 Jan 2017 11:04:49 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> Message-ID: Hi, I'm hope to have a release of the editors with an updated runtime come out relatively soon. Unfortunately, it's a case of lining things up and making sure everything is ready / tested and those people I'm relying on to do something actually do it. N. On 27/01/17 10:27, David Booth via Microbit wrote: > Hi Nevil, Damien, Mark > > Re Micro Python lock up when Radio and PWM output used on micro:bit. > > Damien found that my firmware was out of date and sent me a fix which > involved merging two hex file. Unfortunately my programming skills were > not up to performing this merger and so David Whale sent me this idiots > guide (me) to producing a microPython editor on my PC screen which > incorporated Damien's fix but enabled me to write any microPython script > as I would in the editor I would have got via microbit.org > . This solution written by Nicholas Tollervey is > given at the end of this email. This worked. So I recommend you follow > the instructions but remember if you do not update your new editor, over > time it might get out of date again. > > *Question for Damien* > * > * > *For people like me with older micro:bits and poor C skills, will there > come a time when linking into the microPython editor via > www.microbit.org will give them an editor that > will by-pass this problem or should the microPython documentation warn > them that if they want to use radio and PWM to use the following procedure?* > * > * > Regarding Ticket 583 https://support.microbit.org/helpdesk/tickets/583 > > > Ok, so I have a simple scheme for how you can fix this, the idea came > from Nicholas Tollervey late last night! > > 1. go to: https://github.com/bbcmicrobit/PythonEditor > > > 2. press the CLONE OR DOWNLOAD button > > 3. Choose the DOWNLOAD ZIP option > > This will download a complete web based python editor. > > 4. Unzip this on your computer - you should now have a PythonEditor folder > > 5. get Damien's patched .hex file from > here: https://micropython.org/resources/firmware/microbit-micropython.hex > > 6. rename Damien's .hex file as 'firmware.hex' and replace the > firmware.hex that is in the PythonEditor directory that is now on your > computer with this patched version. > > 7. double click on editor.html - this should launch a complete python > editor web page in your browser. > > 8. Paste your code into this editor window, then press the DOWNLOAD > button. This will generate a .hex file that has your script and Damien's > latest MicroPython 'firmware' inside it (which apparently has the PWM > fix inside it that he was talking about) > > 9. Test your code again to see if the PWM lasts for longer, and report > back to us on how this goes? > > Hope this helps! > > > > David Whale > micro:bit support > http://microbit.org/team > > > On 26 January 2017 at 18:14, Nevil Hunt > wrote: > > Hi David/Mark/Damien, > > > Are there any updates on this lock-up issue? > > > By the way if you or anyone else on this mailing list is at the BETT > Show tomorrow (Friday) then I will be on the micro:bit stand for at > least part of the day so come over and say 'hello'! > > > Cheers, > > > Nevil > > > > ------------------------------------------------------------------------ > *From:* Microbit > > on behalf of David Booth via > Microbit > > *Sent:* 31 December 2016 23:17 > *To:* For Pythonic MicroBit related discussions > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of > radio and pwm. > > Hi Mark > I have been having problems getting github to accept my input. It > keeps asking me to verify my email address which I have done several > times. So I have now re registered and submitted a comment. > However it did not let me send .hex or .py files > > However you should know that in the interim Damien George has my hex > files and has reproduced the problem. I have sent him my .py files > so he can investigate further. > > Happy New Year > David > > On 30 December 2016 at 12:04, Mark Shannon > wrote: > > Hi Nevil and David, > > Could you please submit an issue for this. > https://github.com/bbcmicrobit/micropython/issues/new > > > It is frustrating knowing that there may be a problem, but not > being able to fix it. > All I need is a brief description of what goes wrong and, most > importantly, some code that causes the problem. > > Cheers, > Mark. > > On 23/12/16 18:44, Nevil Hunt wrote: > > Hi David, > > > I've also encountered some similar symptoms this week, namely a > micro:bit locking up such that a reset doesn't bring it back > to life. > Only a power cycle brings it back to life. > > > My set-up has some similarities with yours in that I'm > sending Radio > commands from one micro:bit to another using the suggested > method of > "radio.send(str(x))" with the receiving micro:bit locking up > from time > to time. However I think the lockups might not be due to the > Radio > commands. I too have the receiving micro:bit driving pins > with PWM (in > my case Servos) and with a bit of experimenting it looks > like it might > be these "pin1.write_analog(x_angle)" commands that are > causing the > lock-ups since by commenting out these "write_analog" > commands (but with > all the Radio commands still running) it hasn't locked up in > over an > hour. By comparison, with the "write_analog" commands still > active, ~5 > mins is the longest it runs without locking up. > > > Maybe you could see if commenting out the "write_analog" > commands on > your setup has the same effects. It may not stop other > errors but I'd be > interested to see if it stops the lock-ups. > > > > Cheers, > > > Nevil > > > > > ------------------------------------------------------------------------ > *From:* Microbit > > > on behalf of David Booth via Microbit > > *Sent:* 23 December 2016 15:09 > *To:* For Pythonic MicroBit related discussions > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] List of error codes and > their meanings > > Hi Damien > > I have a related question regarding run time errors in micro > Python. > > I have three micro:bits. The first I call Rx because it > basically > receives x axis acceleration data in string form, via the > radio from the > other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 > with 100 ms > gaps. Nicholas Tollervey showed me how to avoid the Type > None error when > converting the string to an integer in RX and I now have > three simple > script which enable Rx to drive pins P0 (from Tx1) and P8 > (from Tx2) > with a PWM signal. > > However after running perfectly well for anything from 10 > seconds to a > minute Rx freezes. On the very few occasions an error > message has > scrolled it appears to be saying that "received is not a > string" and > possibly there is a value error. However on 98% of > occasions Rx is > frozen to the extent it cannot report the error. Since > spurious errors > do not worry me, provided Rx continues with the polling > loop, is it > possible to suppress catching run time errors and if it is > possible is > it likely that the While loop would continue? > > Sometimes pressing reset restarts the system but sometimes I > have to > remove the battery. > > Thank you and a Happy Christmas > David Booth > ps will you be at BETT? > > > On 20 December 2016 at 23:31, Damien George > > >> wrote: > > There are many exceptions and they can occur for many > reasons. Almost > all are based on CPython and the exceptions form a > hierarchy. Eg, > indexing a list with an out-of-bounds index will raise > IndexError, > which derives from LookupError, which derives from > Exception, which > derives from BaseException. > > For a list of implemented exceptions in MicroPython see > > https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280 > > > > > > On 21 December 2016 at 08:35, David Whale > > >> wrote: > > Is there anything in the docs that lists all the errors > (exceptions) that > > can occur in MicroPython and what they mean? > > > > The closest I found was this: > > > > > > https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h > > > > > > > > > > Thanks > > > > David > > > > microbit.org-ticket: 460 > > > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > > > > > > _______________________________________________ > 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.f.booth at googlemail.com Sat Jan 28 03:55:26 2017 From: david.f.booth at googlemail.com (David Booth) Date: Sat, 28 Jan 2017 08:55:26 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> Message-ID: Hi Nevil This is a quick answer and later to day I will do a lot more testing. When I was testing the new editor I did notice that if the receiving microbit battery got to 2.8V which it did after several hours then it was likely to freeze where as the transmitters batteries went much lower and the transmitters continued to work. I reported this to Damien but neither of us could see a good reason why. So try putting new batteries in your receiver and let me know if this did anything to prolong the working time. Thanks David On 28 January 2017 at 07:08, Nevil Hunt wrote: > Hi All, > > > I've given it a quick go following David's instructions and my code still > crashes at least as often as before. > > Shame, as I am taking zbit:bod for the kids to have a go on at the BETT > Show today where I'm helping DavidW and others on the micro:bit foundation > stand and it would have been nice to show it working without crashing! I > still hope to have it running (if there is space on the stand) but it just > means power cycling it from time to time. > > > It's possible in my rush to do it this morning I've not correctly followed > the work around instructions so I've attached my python script, the hex > file before the bug fix work around and the hex file after the bug fix > work around if you want to check if the bug fix is actually in the > bug_fixed.hex. > > > If I've done something wrong and (by some miracle) someone finds a way to > create a bug fixed hex this morning then email it to me and to > david at microbit.org and we might be able to load it on the stand! > > > > Cheers, > > > Nevil > > > > > ------------------------------ > *From:* Nicholas H.Tollervey > *Sent:* 27 January 2017 11:04 > *To:* For Pythonic MicroBit related discussions; Nevil Hunt > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of radio > and pwm. > > Hi, > > I'm hope to have a release of the editors with an updated runtime come > out relatively soon. Unfortunately, it's a case of lining things up and > making sure everything is ready / tested and those people I'm relying on > to do something actually do it. > > N. > > On 27/01/17 10:27, David Booth via Microbit wrote: > > Hi Nevil, Damien, Mark > > > > Re Micro Python lock up when Radio and PWM output used on micro:bit. > > > > Damien found that my firmware was out of date and sent me a fix which > > involved merging two hex file. Unfortunately my programming skills were > > not up to performing this merger and so David Whale sent me this idiots > > guide (me) to producing a microPython editor on my PC screen which > > incorporated Damien's fix but enabled me to write any microPython script > > as I would in the editor I would have got via microbit.org > > . This solution written by Nicholas Tollervey is > > The Micro:bit Foundation is a global non-profit ... > microbit.org > The Micro:bit Foundation will be at Bett this year with the BBC micro:bit > and partners. > > > > > given at the end of this email. This worked. So I recommend you follow > > the instructions but remember if you do not update your new editor, over > > time it might get out of date again. > > > > *Question for Damien* > > * > > * > > *For people like me with older micro:bits and poor C skills, will there > > come a time when linking into the microPython editor via > > www.microbit.org will give them an editor > that > > The Micro:bit Foundation is a global non-profit ... > > www.microbit.org > The Micro:bit Foundation will be at Bett this year with the BBC micro:bit > and partners. > > > The Micro:bit Foundation is a global non-profit ... > > www.microbit.org > The Micro:bit Foundation will be at Bett this year with the BBC micro:bit > and partners. > > > > > will by-pass this problem or should the microPython documentation warn > > them that if they want to use radio and PWM to use the following > procedure?* > > * > > * > > Regarding Ticket 583 https://support.microbit.org/helpdesk/tickets/583 > > > > > > Ok, so I have a simple scheme for how you can fix this, the idea came > > from Nicholas Tollervey late last night! > > > > 1. go to: https://github.com/bbcmicrobit/PythonEditor > > > GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... > > github.com > PythonEditor - A MicroPython editor for the BBC micro:bit that works with > browsers. > > > > > > > > GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... > > github.com > PythonEditor - A MicroPython editor for the BBC micro:bit that works with > browsers. > > > > > > > 2. press the CLONE OR DOWNLOAD button > > > > 3. Choose the DOWNLOAD ZIP option > > > > This will download a complete web based python editor. > > > > 4. Unzip this on your computer - you should now have a PythonEditor > folder > > > > 5. get Damien's patched .hex file from > > here: https://micropython.org/resources/firmware/microbit- > micropython.hex micropython.hex> > > > > 6. rename Damien's .hex file as 'firmware.hex' and replace the > > firmware.hex that is in the PythonEditor directory that is now on your > > computer with this patched version. > > > > 7. double click on editor.html - this should launch a complete python > > editor web page in your browser. > > > > 8. Paste your code into this editor window, then press the DOWNLOAD > > button. This will generate a .hex file that has your script and Damien's > > latest MicroPython 'firmware' inside it (which apparently has the PWM > > fix inside it that he was talking about) > > > > 9. Test your code again to see if the PWM lasts for longer, and report > > back to us on how this goes? > > > > Hope this helps! > > > > > > > > David Whale > > micro:bit support > > http://microbit.org/team > > The Micro:bit Foundation is a global non-profit ... > > microbit.org > We are enabling children around the world to get creative with technology > and invent in school, in clubs and at home! The micro:bit is a handheld, > fully programmable ... > > > > > > > > > On 26 January 2017 at 18:14, Nevil Hunt > >> wrote: > > > > Hi David/Mark/Damien, > > > > > > Are there any updates on this lock-up issue? > > > > > > By the way if you or anyone else on this mailing list is at the BETT > > Show tomorrow (Friday) then I will be on the micro:bit stand for at > > least part of the day so come over and say 'hello'! > > > > > > Cheers, > > > > > > Nevil > > > > > > > > ------------------------------------------------------------ > ------------ > > *From:* Microbit > > > >> on > behalf of David Booth via > > Microbit >> > > *Sent:* 31 December 2016 23:17 > > *To:* For Pythonic MicroBit related discussions > > *Cc:* David Booth > > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of > > radio and pwm. > > > > Hi Mark > > I have been having problems getting github to accept my input. It > > keeps asking me to verify my email address which I have done several > > times. So I have now re registered and submitted a comment. > > However it did not let me send .hex or .py files > > > > However you should know that in the interim Damien George has my hex > > files and has reproduced the problem. I have sent him my .py files > > so he can investigate further. > > > > Happy New Year > > David > > > > On 30 December 2016 at 12:04, Mark Shannon > >> wrote: > > > > Hi Nevil and David, > > > > Could you please submit an issue for this. > > https://github.com/bbcmicrobit/micropython/issues/new > > > > > > It is frustrating knowing that there may be a problem, but not > > being able to fix it. > > All I need is a brief description of what goes wrong and, most > > importantly, some code that causes the problem. > > > > Cheers, > > Mark. > > > > On 23/12/16 18:44, Nevil Hunt wrote: > > > > Hi David, > > > > > > I've also encountered some similar symptoms this week, > namely a > > micro:bit locking up such that a reset doesn't bring it back > > to life. > > Only a power cycle brings it back to life. > > > > > > My set-up has some similarities with yours in that I'm > > sending Radio > > commands from one micro:bit to another using the suggested > > method of > > "radio.send(str(x))" with the receiving micro:bit locking up > > from time > > to time. However I think the lockups might not be due to the > > Radio > > commands. I too have the receiving micro:bit driving pins > > with PWM (in > > my case Servos) and with a bit of experimenting it looks > > like it might > > be these "pin1.write_analog(x_angle)" commands that are > > causing the > > lock-ups since by commenting out these "write_analog" > > commands (but with > > all the Radio commands still running) it hasn't locked up in > > over an > > hour. By comparison, with the "write_analog" commands still > > active, ~5 > > mins is the longest it runs without locking up. > > > > > > Maybe you could see if commenting out the "write_analog" > > commands on > > your setup has the same effects. It may not stop other > > errors but I'd be > > interested to see if it stops the lock-ups. > > > > > > > > Cheers, > > > > > > Nevil > > > > > > > > > > ------------------------------------------------------------ > ------------ > > *From:* Microbit > > > > >> > > on behalf of David Booth via Microbit > >> > > *Sent:* 23 December 2016 15:09 > > *To:* For Pythonic MicroBit related discussions > > *Cc:* David Booth > > *Subject:* Re: [Microbit-Python] List of error codes and > > their meanings > > > > Hi Damien > > > > I have a related question regarding run time errors in micro > > Python. > > > > I have three micro:bits. The first I call Rx because it > > basically > > receives x axis acceleration data in string form, via the > > radio from the > > other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 > > with 100 ms > > gaps. Nicholas Tollervey showed me how to avoid the Type > > None error when > > converting the string to an integer in RX and I now have > > three simple > > script which enable Rx to drive pins P0 (from Tx1) and P8 > > (from Tx2) > > with a PWM signal. > > > > However after running perfectly well for anything from 10 > > seconds to a > > minute Rx freezes. On the very few occasions an error > > message has > > scrolled it appears to be saying that "received is not a > > string" and > > possibly there is a value error. However on 98% of > > occasions Rx is > > frozen to the extent it cannot report the error. Since > > spurious errors > > do not worry me, provided Rx continues with the polling > > loop, is it > > possible to suppress catching run time errors and if it is > > possible is > > it likely that the While loop would continue? > > > > Sometimes pressing reset restarts the system but sometimes I > > have to > > remove the battery. > > > > Thank you and a Happy Christmas > > David Booth > > ps will you be at BETT? > > > > > > On 20 December 2016 at 23:31, Damien George > > > > > > >>> wrote: > > > > There are many exceptions and they can occur for many > > reasons. Almost > > all are based on CPython and the exceptions form a > > hierarchy. Eg, > > indexing a list with an out-of-bounds index will raise > > IndexError, > > which derives from LookupError, which derives from > > Exception, which > > derives from BaseException. > > > > For a list of implemented exceptions in MicroPython see > > > > https://github.com/bbcmicrobit/micropython/blob/ > master/source/py/objexcept.c#L192-L280 > > master/source/py/objexcept.c#L192-L280> > > > > master/source/py/objexcept.c#L192-L280 > > master/source/py/objexcept.c#L192-L280>> > > > > On 21 December 2016 at 08:35, David Whale > > > > > > > >>> wrote: > > > Is there anything in the docs that lists all the errors > > (exceptions) that > > > can occur in MicroPython and what they mean? > > > > > > The closest I found was this: > > > > > > > > > > https://github.com/bbcmicrobit/micropython/blob/ > a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h > > a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h> > > > > a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h > > a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h>> > > > > > > > > > Thanks > > > > > > David > > > > > > microbit.org-ticket: 460 > > > > > > > > > > > > _______________________________________________ > > > Microbit mailing list > > > Microbit at python.org > > > >> > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > > >> > > https://mail.python.org/mailman/listinfo/microbit > > > > > > > > > > > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > > > > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > https://mail.python.org/mailman/listinfo/microbit > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nevil.hunt at hotmail.co.uk Sun Jan 29 08:00:18 2017 From: nevil.hunt at hotmail.co.uk (Nevil Hunt) Date: Sun, 29 Jan 2017 13:00:18 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> , Message-ID: Hi David, Thanks for the update. I don't think the crash is caused by a voltage drop (though I could prove to be wrong). When I first encountered it I checked the 3V rail on a scope and didn't notice any dips. I'm also powering my micro:bit + servos from a separate regulator which gives over 500mA @ 3.3V from a 5V USB battery powerbank. I discussed it with David Whale on the stand at the BETT Show and one theory we thought might have a bearing on it was that I am not just doing Radio + Servos. I'm doing Radio + Servos (P1 & P2) + Speech Audio (P0). Anyway, in good presentation style, I used the regular crashing of the zbit:bot as a way to highlight just how quick a micro:bit is to re-boot after a power cycle compared to Windows or Linux! Cheers, Nevil ________________________________ From: David Booth Sent: 28 January 2017 08:55 To: Nevil Hunt Cc: Nicholas H.Tollervey; For Pythonic MicroBit related discussions; david at microbit.org Subject: Re: [Microbit-Python] Lock-up due to some combination of radio and pwm. Hi Nevil This is a quick answer and later to day I will do a lot more testing. When I was testing the new editor I did notice that if the receiving microbit battery got to 2.8V which it did after several hours then it was likely to freeze where as the transmitters batteries went much lower and the transmitters continued to work. I reported this to Damien but neither of us could see a good reason why. So try putting new batteries in your receiver and let me know if this did anything to prolong the working time. Thanks David On 28 January 2017 at 07:08, Nevil Hunt > wrote: Hi All, I've given it a quick go following David's instructions and my code still crashes at least as often as before. Shame, as I am taking zbit:bod for the kids to have a go on at the BETT Show today where I'm helping DavidW and others on the micro:bit foundation stand and it would have been nice to show it working without crashing! I still hope to have it running (if there is space on the stand) but it just means power cycling it from time to time. It's possible in my rush to do it this morning I've not correctly followed the work around instructions so I've attached my python script, the hex file before the bug fix work around and the hex file after the bug fix work around if you want to check if the bug fix is actually in the bug_fixed.hex. If I've done something wrong and (by some miracle) someone finds a way to create a bug fixed hex this morning then email it to me and to david at microbit.org and we might be able to load it on the stand! Cheers, Nevil ________________________________ From: Nicholas H.Tollervey > Sent: 27 January 2017 11:04 To: For Pythonic MicroBit related discussions; Nevil Hunt Cc: David Booth Subject: Re: [Microbit-Python] Lock-up due to some combination of radio and pwm. Hi, I'm hope to have a release of the editors with an updated runtime come out relatively soon. Unfortunately, it's a case of lining things up and making sure everything is ready / tested and those people I'm relying on to do something actually do it. N. On 27/01/17 10:27, David Booth via Microbit wrote: > Hi Nevil, Damien, Mark > > Re Micro Python lock up when Radio and PWM output used on micro:bit. > > Damien found that my firmware was out of date and sent me a fix which > involved merging two hex file. Unfortunately my programming skills were > not up to performing this merger and so David Whale sent me this idiots > guide (me) to producing a microPython editor on my PC screen which > incorporated Damien's fix but enabled me to write any microPython script > as I would in the editor I would have got via microbit.org > . This solution written by Nicholas Tollervey is The Micro:bit Foundation is a global non-profit ... microbit.org The Micro:bit Foundation will be at Bett this year with the BBC micro:bit and partners. > given at the end of this email. This worked. So I recommend you follow > the instructions but remember if you do not update your new editor, over > time it might get out of date again. > > *Question for Damien* > * > * > *For people like me with older micro:bits and poor C skills, will there > come a time when linking into the microPython editor via > www.microbit.org will give them an editor that The Micro:bit Foundation is a global non-profit ... www.microbit.org The Micro:bit Foundation will be at Bett this year with the BBC micro:bit and partners. The Micro:bit Foundation is a global non-profit ... www.microbit.org The Micro:bit Foundation will be at Bett this year with the BBC micro:bit and partners. > will by-pass this problem or should the microPython documentation warn > them that if they want to use radio and PWM to use the following procedure?* > * > * > Regarding Ticket 583 https://support.microbit.org/helpdesk/tickets/583 > > > Ok, so I have a simple scheme for how you can fix this, the idea came > from Nicholas Tollervey late last night! > > 1. go to: https://github.com/bbcmicrobit/PythonEditor [https://avatars3.githubusercontent.com/u/15104236?v=3&s=400] GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... github.com PythonEditor - A MicroPython editor for the BBC micro:bit that works with browsers. > [https://avatars3.githubusercontent.com/u/15104236?v=3&s=400] GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... github.com PythonEditor - A MicroPython editor for the BBC micro:bit that works with browsers. > > 2. press the CLONE OR DOWNLOAD button > > 3. Choose the DOWNLOAD ZIP option > > This will download a complete web based python editor. > > 4. Unzip this on your computer - you should now have a PythonEditor folder > > 5. get Damien's patched .hex file from > here: https://micropython.org/resources/firmware/microbit-micropython.hex > > 6. rename Damien's .hex file as 'firmware.hex' and replace the > firmware.hex that is in the PythonEditor directory that is now on your > computer with this patched version. > > 7. double click on editor.html - this should launch a complete python > editor web page in your browser. > > 8. Paste your code into this editor window, then press the DOWNLOAD > button. This will generate a .hex file that has your script and Damien's > latest MicroPython 'firmware' inside it (which apparently has the PWM > fix inside it that he was talking about) > > 9. Test your code again to see if the PWM lasts for longer, and report > back to us on how this goes? > > Hope this helps! > > > > David Whale > micro:bit support > http://microbit.org/team The Micro:bit Foundation is a global non-profit ... microbit.org We are enabling children around the world to get creative with technology and invent in school, in clubs and at home! The micro:bit is a handheld, fully programmable ... > > > On 26 January 2017 at 18:14, Nevil Hunt > > wrote: > > Hi David/Mark/Damien, > > > Are there any updates on this lock-up issue? > > > By the way if you or anyone else on this mailing list is at the BETT > Show tomorrow (Friday) then I will be on the micro:bit stand for at > least part of the day so come over and say 'hello'! > > > Cheers, > > > Nevil > > > > ------------------------------------------------------------------------ > *From:* Microbit > > > on behalf of David Booth via > Microbit > > *Sent:* 31 December 2016 23:17 > *To:* For Pythonic MicroBit related discussions > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of > radio and pwm. > > Hi Mark > I have been having problems getting github to accept my input. It > keeps asking me to verify my email address which I have done several > times. So I have now re registered and submitted a comment. > However it did not let me send .hex or .py files > > However you should know that in the interim Damien George has my hex > files and has reproduced the problem. I have sent him my .py files > so he can investigate further. > > Happy New Year > David > > On 30 December 2016 at 12:04, Mark Shannon > > wrote: > > Hi Nevil and David, > > Could you please submit an issue for this. > https://github.com/bbcmicrobit/micropython/issues/new > > > It is frustrating knowing that there may be a problem, but not > being able to fix it. > All I need is a brief description of what goes wrong and, most > importantly, some code that causes the problem. > > Cheers, > Mark. > > On 23/12/16 18:44, Nevil Hunt wrote: > > Hi David, > > > I've also encountered some similar symptoms this week, namely a > micro:bit locking up such that a reset doesn't bring it back > to life. > Only a power cycle brings it back to life. > > > My set-up has some similarities with yours in that I'm > sending Radio > commands from one micro:bit to another using the suggested > method of > "radio.send(str(x))" with the receiving micro:bit locking up > from time > to time. However I think the lockups might not be due to the > Radio > commands. I too have the receiving micro:bit driving pins > with PWM (in > my case Servos) and with a bit of experimenting it looks > like it might > be these "pin1.write_analog(x_angle)" commands that are > causing the > lock-ups since by commenting out these "write_analog" > commands (but with > all the Radio commands still running) it hasn't locked up in > over an > hour. By comparison, with the "write_analog" commands still > active, ~5 > mins is the longest it runs without locking up. > > > Maybe you could see if commenting out the "write_analog" > commands on > your setup has the same effects. It may not stop other > errors but I'd be > interested to see if it stops the lock-ups. > > > > Cheers, > > > Nevil > > > > > ------------------------------------------------------------------------ > *From:* Microbit > > > > on behalf of David Booth via Microbit > > > *Sent:* 23 December 2016 15:09 > *To:* For Pythonic MicroBit related discussions > *Cc:* David Booth > *Subject:* Re: [Microbit-Python] List of error codes and > their meanings > > Hi Damien > > I have a related question regarding run time errors in micro > Python. > > I have three micro:bits. The first I call Rx because it > basically > receives x axis acceleration data in string form, via the > radio from the > other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 > with 100 ms > gaps. Nicholas Tollervey showed me how to avoid the Type > None error when > converting the string to an integer in RX and I now have > three simple > script which enable Rx to drive pins P0 (from Tx1) and P8 > (from Tx2) > with a PWM signal. > > However after running perfectly well for anything from 10 > seconds to a > minute Rx freezes. On the very few occasions an error > message has > scrolled it appears to be saying that "received is not a > string" and > possibly there is a value error. However on 98% of > occasions Rx is > frozen to the extent it cannot report the error. Since > spurious errors > do not worry me, provided Rx continues with the polling > loop, is it > possible to suppress catching run time errors and if it is > possible is > it likely that the While loop would continue? > > Sometimes pressing reset restarts the system but sometimes I > have to > remove the battery. > > Thank you and a Happy Christmas > David Booth > ps will you be at BETT? > > > On 20 December 2016 at 23:31, Damien George > > > >> wrote: > > There are many exceptions and they can occur for many > reasons. Almost > all are based on CPython and the exceptions form a > hierarchy. Eg, > indexing a list with an out-of-bounds index will raise > IndexError, > which derives from LookupError, which derives from > Exception, which > derives from BaseException. > > For a list of implemented exceptions in MicroPython see > > https://github.com/bbcmicrobit/micropython/blob/master/source/py/objexcept.c#L192-L280 > > > > > > On 21 December 2016 at 08:35, David Whale > > > > >> wrote: > > Is there anything in the docs that lists all the errors > (exceptions) that > > can occur in MicroPython and what they mean? > > > > The closest I found was this: > > > > > > https://github.com/bbcmicrobit/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h > > > > > > > > > > Thanks > > > > David > > > > microbit.org-ticket: 460 > > > > > > > > _______________________________________________ > > Microbit mailing list > > Microbit at python.org > > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > > > https://mail.python.org/mailman/listinfo/microbit > > > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.f.booth at googlemail.com Sun Jan 29 10:27:35 2017 From: david.f.booth at googlemail.com (David Booth) Date: Sun, 29 Jan 2017 15:27:35 +0000 Subject: [Microbit-Python] Lock-up due to some combination of radio and pwm. In-Reply-To: References: <2f795150-c0fd-1787-a816-6f6bd398c275@hotpy.org> Message-ID: Hi Nevil I have edited my latest micro:bit receiver and transmitter scripts from scratch going through Nicholas's procedure to produce a new editor and like you my receiver only lasted a minute before freezing. When I first tried the new editor the receiver lasted for up to 5 hours during which time the receiver battery went down from over 3 V to about 2.8 V which I assumed was the reason it stopped. I did this test twice at the time. So I have now gone back to my original 29th Dec 2016 hex files and re edited them. They lasted for 5 minutes before freezing. In both cases the micro:bit was plugged into a Kitronik Motor driver Board and so its 3 V supply voltage was stabilised from a 5v source. So sadly it seems that we still have a problem with the micro Python freezing when both Radio and PWM output is in use. David B On 29 January 2017 at 13:00, Nevil Hunt wrote: > Hi David, > > > Thanks for the update. > > > I don't think the crash is caused by a voltage drop (though I could prove > to be wrong). When I first encountered it I checked the 3V rail on a scope > and didn't notice any dips. I'm also powering my micro:bit + servos from a > separate regulator which gives over 500mA @ 3.3V from a 5V USB battery > powerbank. > > > I discussed it with David Whale on the stand at the BETT Show and one > theory we thought might have a bearing on it was that I am not just doing > Radio + Servos. I'm doing Radio + Servos (P1 & P2) + Speech Audio (P0). > > > Anyway, in good presentation style, I used the regular crashing of the > zbit:bot as a way to highlight just how quick a micro:bit is to re-boot > after a power cycle compared to Windows or Linux! > > > > Cheers, > > > Nevil > > > > > ------------------------------ > *From:* David Booth > *Sent:* 28 January 2017 08:55 > *To:* Nevil Hunt > *Cc:* Nicholas H.Tollervey; For Pythonic MicroBit related discussions; > david at microbit.org > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of radio > and pwm. > > Hi Nevil > > This is a quick answer and later to day I will do a lot more testing. > > When I was testing the new editor I did notice that if the receiving > microbit battery got to 2.8V which it did after several hours then it was > likely to freeze where as the transmitters batteries went much lower and > the transmitters continued to work. I reported this to Damien but neither > of us could see a good reason why. > > > So try putting new batteries in your receiver and let me know if this did > anything to prolong the working time. > > Thanks > David > > On 28 January 2017 at 07:08, Nevil Hunt wrote: > >> Hi All, >> >> >> I've given it a quick go following David's instructions and my code still >> crashes at least as often as before. >> >> Shame, as I am taking zbit:bod for the kids to have a go on at the BETT >> Show today where I'm helping DavidW and others on the micro:bit foundation >> stand and it would have been nice to show it working without crashing! I >> still hope to have it running (if there is space on the stand) but it just >> means power cycling it from time to time. >> >> >> It's possible in my rush to do it this morning I've not correctly >> followed the work around instructions so I've attached my python script, >> the hex file before the bug fix work around and the hex file after the >> bug fix work around if you want to check if the bug fix is actually in the >> bug_fixed.hex. >> >> >> If I've done something wrong and (by some miracle) someone finds a way to >> create a bug fixed hex this morning then email it to me and to >> david at microbit.org and we might be able to load it on the stand! >> >> >> >> Cheers, >> >> >> Nevil >> >> >> >> >> ------------------------------ >> *From:* Nicholas H.Tollervey >> *Sent:* 27 January 2017 11:04 >> *To:* For Pythonic MicroBit related discussions; Nevil Hunt >> *Cc:* David Booth >> *Subject:* Re: [Microbit-Python] Lock-up due to some combination of >> radio and pwm. >> >> Hi, >> >> I'm hope to have a release of the editors with an updated runtime come >> out relatively soon. Unfortunately, it's a case of lining things up and >> making sure everything is ready / tested and those people I'm relying on >> to do something actually do it. >> >> N. >> >> On 27/01/17 10:27, David Booth via Microbit wrote: >> > Hi Nevil, Damien, Mark >> > >> > Re Micro Python lock up when Radio and PWM output used on micro:bit. >> > >> > Damien found that my firmware was out of date and sent me a fix which >> > involved merging two hex file. Unfortunately my programming skills were >> > not up to performing this merger and so David Whale sent me this idiots >> > guide (me) to producing a microPython editor on my PC screen which >> > incorporated Damien's fix but enabled me to write any microPython script >> > as I would in the editor I would have got via microbit.org >> > . This solution written by Nicholas Tollervey is >> >> The Micro:bit Foundation is a global non-profit ... >> >> microbit.org >> The Micro:bit Foundation will be at Bett this year with the BBC micro:bit >> and partners. >> >> >> >> > given at the end of this email. This worked. So I recommend you follow >> > the instructions but remember if you do not update your new editor, over >> > time it might get out of date again. >> > >> > *Question for Damien* >> > * >> > * >> > *For people like me with older micro:bits and poor C skills, will there >> > come a time when linking into the microPython editor via >> > www.microbit.org will give them an editor >> that >> >> The Micro:bit Foundation is a global non-profit ... >> >> www.microbit.org >> The Micro:bit Foundation will be at Bett this year with the BBC micro:bit >> and partners. >> >> >> The Micro:bit Foundation is a global non-profit ... >> >> www.microbit.org >> The Micro:bit Foundation will be at Bett this year with the BBC micro:bit >> and partners. >> >> >> >> > will by-pass this problem or should the microPython documentation warn >> > them that if they want to use radio and PWM to use the following >> procedure?* >> > * >> > * >> > Regarding Ticket 583 https://support.microbit.org/helpdesk/tickets/583 >> > >> > >> > Ok, so I have a simple scheme for how you can fix this, the idea came >> > from Nicholas Tollervey late last night! >> > >> > 1. go to: https://github.com/bbcmicrobit/PythonEditor >> >> >> GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... >> >> github.com >> PythonEditor - A MicroPython editor for the BBC micro:bit that works with >> browsers. >> >> >> >> > >> >> >> GitHub - bbcmicrobit/PythonEditor: A MicroPython editor ... >> >> github.com >> PythonEditor - A MicroPython editor for the BBC micro:bit that works with >> browsers. >> >> >> >> > >> > 2. press the CLONE OR DOWNLOAD button >> > >> > 3. Choose the DOWNLOAD ZIP option >> > >> > This will download a complete web based python editor. >> > >> > 4. Unzip this on your computer - you should now have a PythonEditor >> folder >> > >> > 5. get Damien's patched .hex file from >> > here: https://micropython.org/resources/firmware/microbit-micropyt >> hon.hex > thon.hex> >> > >> > 6. rename Damien's .hex file as 'firmware.hex' and replace the >> > firmware.hex that is in the PythonEditor directory that is now on your >> > computer with this patched version. >> > >> > 7. double click on editor.html - this should launch a complete python >> > editor web page in your browser. >> > >> > 8. Paste your code into this editor window, then press the DOWNLOAD >> > button. This will generate a .hex file that has your script and Damien's >> > latest MicroPython 'firmware' inside it (which apparently has the PWM >> > fix inside it that he was talking about) >> > >> > 9. Test your code again to see if the PWM lasts for longer, and report >> > back to us on how this goes? >> > >> > Hope this helps! >> > >> > >> > >> > David Whale >> > micro:bit support >> > http://microbit.org/team >> >> The Micro:bit Foundation is a global non-profit ... >> >> microbit.org >> We are enabling children around the world to get creative with technology >> and invent in school, in clubs and at home! The micro:bit is a handheld, >> fully programmable ... >> >> >> >> > >> > >> > On 26 January 2017 at 18:14, Nevil Hunt > > >> wrote: >> > >> > Hi David/Mark/Damien, >> > >> > >> > Are there any updates on this lock-up issue? >> > >> > >> > By the way if you or anyone else on this mailing list is at the BETT >> > Show tomorrow (Friday) then I will be on the micro:bit stand for at >> > least part of the day so come over and say 'hello'! >> > >> > >> > Cheers, >> > >> > >> > Nevil >> > >> > >> > >> > ------------------------------------------------------------ >> ------------ >> > *From:* Microbit >> > > > >> on >> behalf of David Booth via >> > Microbit > >> >> > *Sent:* 31 December 2016 23:17 >> > *To:* For Pythonic MicroBit related discussions >> > *Cc:* David Booth >> > *Subject:* Re: [Microbit-Python] Lock-up due to some combination of >> > radio and pwm. >> > >> > Hi Mark >> > I have been having problems getting github to accept my input. It >> > keeps asking me to verify my email address which I have done several >> > times. So I have now re registered and submitted a comment. >> > However it did not let me send .hex or .py files >> > >> > However you should know that in the interim Damien George has my hex >> > files and has reproduced the problem. I have sent him my .py files >> > so he can investigate further. >> > >> > Happy New Year >> > David >> > >> > On 30 December 2016 at 12:04, Mark Shannon > > >> wrote: >> > >> > Hi Nevil and David, >> > >> > Could you please submit an issue for this. >> > https://github.com/bbcmicrobit/micropython/issues/new >> > >> > >> > It is frustrating knowing that there may be a problem, but not >> > being able to fix it. >> > All I need is a brief description of what goes wrong and, most >> > importantly, some code that causes the problem. >> > >> > Cheers, >> > Mark. >> > >> > On 23/12/16 18:44, Nevil Hunt wrote: >> > >> > Hi David, >> > >> > >> > I've also encountered some similar symptoms this week, >> namely a >> > micro:bit locking up such that a reset doesn't bring it back >> > to life. >> > Only a power cycle brings it back to life. >> > >> > >> > My set-up has some similarities with yours in that I'm >> > sending Radio >> > commands from one micro:bit to another using the suggested >> > method of >> > "radio.send(str(x))" with the receiving micro:bit locking up >> > from time >> > to time. However I think the lockups might not be due to the >> > Radio >> > commands. I too have the receiving micro:bit driving pins >> > with PWM (in >> > my case Servos) and with a bit of experimenting it looks >> > like it might >> > be these "pin1.write_analog(x_angle)" commands that are >> > causing the >> > lock-ups since by commenting out these "write_analog" >> > commands (but with >> > all the Radio commands still running) it hasn't locked up in >> > over an >> > hour. By comparison, with the "write_analog" commands still >> > active, ~5 >> > mins is the longest it runs without locking up. >> > >> > >> > Maybe you could see if commenting out the "write_analog" >> > commands on >> > your setup has the same effects. It may not stop other >> > errors but I'd be >> > interested to see if it stops the lock-ups. >> > >> > >> > >> > Cheers, >> > >> > >> > Nevil >> > >> > >> > >> > >> > ------------------------------ >> ------------------------------------------ >> > *From:* Microbit >> > > > >> >> >> > on behalf of David Booth via Microbit > > >> >> > *Sent:* 23 December 2016 15:09 >> > *To:* For Pythonic MicroBit related discussions >> > *Cc:* David Booth >> > *Subject:* Re: [Microbit-Python] List of error codes and >> > their meanings >> > >> > Hi Damien >> > >> > I have a related question regarding run time errors in micro >> > Python. >> > >> > I have three micro:bits. The first I call Rx because it >> > basically >> > receives x axis acceleration data in string form, via the >> > radio from the >> > other two micro:bits Tx1 and Tx2. Rx poles Tx1 then Tx2 >> > with 100 ms >> > gaps. Nicholas Tollervey showed me how to avoid the Type >> > None error when >> > converting the string to an integer in RX and I now have >> > three simple >> > script which enable Rx to drive pins P0 (from Tx1) and P8 >> > (from Tx2) >> > with a PWM signal. >> > >> > However after running perfectly well for anything from 10 >> > seconds to a >> > minute Rx freezes. On the very few occasions an error >> > message has >> > scrolled it appears to be saying that "received is not a >> > string" and >> > possibly there is a value error. However on 98% of >> > occasions Rx is >> > frozen to the extent it cannot report the error. Since >> > spurious errors >> > do not worry me, provided Rx continues with the polling >> > loop, is it >> > possible to suppress catching run time errors and if it is >> > possible is >> > it likely that the While loop would continue? >> > >> > Sometimes pressing reset restarts the system but sometimes I >> > have to >> > remove the battery. >> > >> > Thank you and a Happy Christmas >> > David Booth >> > ps will you be at BETT? >> > >> > >> > On 20 December 2016 at 23:31, Damien George >> > > com > >> > > > > >>> wrote: >> > >> > There are many exceptions and they can occur for many >> > reasons. Almost >> > all are based on CPython and the exceptions form a >> > hierarchy. Eg, >> > indexing a list with an out-of-bounds index will raise >> > IndexError, >> > which derives from LookupError, which derives from >> > Exception, which >> > derives from BaseException. >> > >> > For a list of implemented exceptions in MicroPython see >> > >> > https://github.com/bbcmicrobit/micropython/blob/master/ >> source/py/objexcept.c#L192-L280 >> > > source/py/objexcept.c#L192-L280> >> > >> > > source/py/objexcept.c#L192-L280 >> > > source/py/objexcept.c#L192-L280>> >> > >> > On 21 December 2016 at 08:35, David Whale >> > > > > > >> > > > > >>> wrote: >> > > Is there anything in the docs that lists all the >> errors >> > (exceptions) that >> > > can occur in MicroPython and what they mean? >> > > >> > > The closest I found was this: >> > > >> > > >> > >> > https://github.com/bbcmicrobit >> /micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/ >> inc/py/qstrdefs.h >> > > t/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/ >> inc/py/qstrdefs.h> >> > >> > > t/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/ >> inc/py/qstrdefs.h >> > > t/micropython/blob/a20fbe82c919cea9519ce5a1140103f518b51caa/ >> inc/py/qstrdefs.h>> >> > > >> > > >> > > Thanks >> > > >> > > David >> > > >> > > microbit.org-ticket: 460 >> > > >> > > >> > > >> > > _______________________________________________ >> > > Microbit mailing list >> > > Microbit at python.org > > >> > > >> >> > > https://mail.python.org/mailman/listinfo/microbit >> > >> > > > > >> > > >> > _______________________________________________ >> > Microbit mailing list >> > Microbit at python.org > > >> > > >> >> > https://mail.python.org/mailman/listinfo/microbit >> > >> > > > > >> > >> > >> > >> > >> > _______________________________________________ >> > Microbit mailing list >> > Microbit at python.org > > >> > https://mail.python.org/mailman/listinfo/microbit >> > >> > >> > _______________________________________________ >> > Microbit mailing list >> > Microbit at python.org > > >> > https://mail.python.org/mailman/listinfo/microbit >> > >> > >> > >> > >> > >> > >> > _______________________________________________ >> > Microbit mailing list >> > Microbit at python.org >> > https://mail.python.org/mailman/listinfo/microbit >> > >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From loopspace at mathforge.org Sun Jan 29 10:38:29 2017 From: loopspace at mathforge.org (Andrew Stacey) Date: Sun, 29 Jan 2017 15:38:29 +0000 Subject: [Microbit-Python] Communicating with a Micro:bit In-Reply-To: References: <58ea0ea4-aa02-bc26-cc3d-5b0cfc951dd0@mathforge.org> Message-ID: Just want to say thanks to all those who answered my query. There's plenty for me to experiment with there. Andrew On 19/01/2017 10:28, David Booth via Microbit wrote: > Hi Andrew I have just realised that you have sent the question to > python.org so you should get a positive response > from someone on the mailing list so I have not conntacted David Whale. > If you do not get a satisfactory answer contact me again. > David > > On 18 January 2017 at 18:09, Andrew Stacey > wrote: > > Hi all, > > With a microbit connected to a USB port on a computer I can send > stuff from the microbit to the PC using the "print" command on the > MB and read it using pySerial on the PC. > > Can I go the other way? Obviously, I can send messages from the PC > but I don't know how to listen on the MB. Can it be done? > > Thanks, > Andrew > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit > > > > > > _______________________________________________ > Microbit mailing list > Microbit at python.org > https://mail.python.org/mailman/listinfo/microbit >