[Microbit-Python] Non volatile storage

Piggott BRUCE brucepiggott at ntlworld.com
Sat Oct 22 13:19:22 EDT 2016


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
> mailto: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
> > mailto: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 mailto:ntoll at ntoll.org >
> >         >> wrote:
> >         >>
> >         >>
> >         >>     It's all in the documentation here:
> >         >>
> >         >>
> >         >>
> >         >> https://microbit-micropython.readthedocs.io/en/latest/tutorials/storage.html
> >         >> https://microbit-micropython.readthedocs.io/en/latest/tutorials/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 mailto:Microbit at python.org
> >         >>     > https://mail.python.org/mailman/listinfo/microbit
> >         >>     > https://mail.python.org/mailman/listinfo/microbit
> >         >>     >
> >         >>
> >         >>
> >         >>     _______________________________________________
> >         >>     Microbit mailing list
> >         >>     Microbit at python.org mailto:Microbit at python.org
> >         >>     https://mail.python.org/mailman/listinfo/microbit
> >         >> https://mail.python.org/mailman/listinfo/microbit
> >         >>
> >         _______________________________________________
> >         Microbit mailing list
> >         Microbit at python.org mailto:Microbit at python.org
> >         https://mail.python.org/mailman/listinfo/microbit
> > 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/a0461926/attachment-0001.html>


More information about the Microbit mailing list