[Microbit-Python] Non volatile storage

David Whale david at thinkingbinaries.com
Sat Oct 22 13:25:01 EDT 2016


Hi Bruce,

Yes, that will be the problem. The version of MicroPython on the BBC
website is updated on a much slower schedule than the version inside the Mu
editor, and as such, does not have a number of the new features.

Your best bet is to go to codewith.mu and download one of the prebuilt
packages for your platform and use that, as it will have the latest code
(including radio, speech, music, singing and filing system) inside it.

Also Mu has a FILES button that you can use to drag and drop files to and
from the micro:bit file system, and a REPL button that allows you to
interact live with your Python code.

David



On 22 October 2016 at 18:19, Piggott BRUCE <brucepiggott at ntlworld.com>
wrote:

> I am using the BBC website.
>
> Is that the problem?
>
> I don't think I have story.txt on my microbit.
>
> Can anybody give me a simple program that creates and stores a constant
> that can be retrieved after a subsequent power up?
>
> Cheers, Bruce
>
> On 22 October 2016 at 17:45 David Whale <david at thinkingbinaries.com>
> wrote:
>
> Are you using an up to date version of the Mu editor, or the BBC website?
>
> On 22 Oct 2016 5:06 pm, "Ben Mustill-Rose" <ben at benmr.com> wrote:
>
> Hi,
>
> Does story.txt exist on your micro:bit?
>
> Cheers,
> Ben.
>
> On 10/22/16, Piggott BRUCE <brucepiggott at ntlworld.com> wrote:
> > Thanks for that but I have already tried that and it does not work.
> >
> > I copied the example and tried it:
> >
> >
> > # test of non volatile storage
> >
> > from microbit import *
> >
> > with open('story.txt') as my_file:
> > content = my_file.read()
> > print(content)
> >
> > I get line 5 attribute error, etc
> >
> >
> > Try it yourself.
> >
> > I have been trying to solve this for 3 days now!
> >
> > This for the BBC micro:bit using micropython
> >
> > Cheers, Bruce
> >
> >
> >>
> >>     On 22 October 2016 at 16:24 "Nicholas H.Tollervey" <ntoll at ntoll.org
> >
> >> wrote:
> >>
> >>
> >>     It's all in the documentation here:
> >>
> >>
> >>
> >> https://microbit-micropython.readthedocs.io/en/latest/tutori
> als/storage.html
> >>
> >>     Hope this helps,
> >>
> >>     N.
> >>
> >>     On 22/10/16 15:54, Piggott BRUCE wrote:
> >>     > Hi Guys.
> >>     >
> >>     > I'm having a problem finding the correct instruction for storing
> >> non
> >>     > volatile data in the microbit module.
> >>     >
> >>     > I need to store a variable collected during run time that is
> >> available
> >>     > on next power up.
> >>     >
> >>     > I know I need to create a file of some sort and/ /have searched
> the
> >> web
> >>     > for how to do this but everything I have found does not work.
> >>     >
> >>     > Can anybody give me a simple example of how to create a file of
> >> data
> >>     > that is available after a subsequent power up?
> >>     >
> >>     > Cheers, Bruce
> >>     >
> >>     >
> >>     >
> >>     > _______________________________________________
> >>     > 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: <http://mail.python.org/pipermail/microbit/attachments/20161022/f0da65c1/attachment.html>


More information about the Microbit mailing list