microsoft / pxt-filesystem

File system - beta
https://pxt.microbit.org/pkg/microsoft/pxt-filesystem
MIT License
28 stars 18 forks source link

Not working on board only in simulator #17

Open aqmoreira opened 5 years ago

aqmoreira commented 5 years ago

Example file no running in board Micro:bit.

https://makecode.microbit.org/_7ia7bCddr0Ay

davorradic commented 5 years ago

I'm too trying to write to serial: input.onButtonPressed(Button.B, function () { basic.showNumber(1) serial.redirectToUSB() serial.writeLine("dit is een test1") let my_data = "output.txt" files.appendLine( my_data, "lll,lll,dddl,ll099" ) files.readToSerial(my_data) }) I followed tutorial on: https://www.dendrite.me/media/output/mediaid/5a13f86908d73406ab61317c

and when I say: serial.writeLine("dit is een test1") It works great and I see it in tera term "dit is een test1" but when I try to do it like this: files.readToSerial(my_data) nothing is showed :( In the simulator it works, but on Micro:bit it doesn't show up.

davorradic commented 5 years ago

I just test it with python and writing file is working perfect :) For my students I really need JavaScript and it would be great to get this done with JavaScript and to avoid python

davorradic commented 5 years ago

I see there are many commits, how could I include the old commits of the file to my makecode on windows? I really want to work with JavaScript and not with python.

johnhunt commented 5 years ago

Can confirm the same here... cannot use the web editor/JS - works in simulator but totally dead on board (no code runs at all). Good to know it's still possible via python though.

asandven commented 5 years ago

Can confirm the same. Feedback from Micro:bit Foundation: "I'm afraid the filesystem plugin does not work well with the updated MakeCode editor and that is why it is still in Beta. I would suggest you look at MicroPython for support doing this. https://microbit-micropython.readthedocs.io/en/latest/filesystem.html"

Cybot101 commented 5 years ago

It looks like there is an issue with the StringData type being passed into the files.cpp methods. I've 'hacked' together a working version that simply replaces all the StringData arguments with String, and adjusted where needed, but I haven't yet properly tested and verified it.

roctopwerk commented 5 years ago

@Cybot101 How could I fix it then? So I don't use python, but stay with Javascript?

Cybot101 commented 5 years ago

@roctopwerk My Fork you are welcome to import and try out, but it's not 'official'. It's been working for me so far. github.com/Cybot101/pxt-filesystem I haven't had time to clean up for a Pull Request here.

omarbenhamid commented 5 years ago

@Cybot101 fork worked for me on the online makecode editor, offline (w10) did not work at first but worked after having it running through the online one first ... I know there are issues with compilation on w10 ... maybe is it related.

mhamilt commented 4 years ago

Is there currently a setup of Operating System, browser, offline / online editor and firmware version to get this to function on a physical micro:bit? Or is this still strictly "simulator only"?

mhamilt commented 4 years ago

Lacking a better place to add any documentation to get this working. Here are some instructions for adding the fork mentioned by @Cybot101 .

Adding Github Repository to Available Extensions

  1. Go to MakeCode
  2. Start a project
  3. From the setup cog, select Extensions
  4. Scroll to the bottom until Want to create your own extension? Log in to GitHub
  5. follow process for generating a token
  6. paste the url for the fork https://github.com/Cybot101/pxt-filesystem
  7. click on result to add

Notes

The intended functionality of having files appear visible when the micro:bit is connected via usb* is not present in the fork. Data can be streamed over Serial and then downloaded as a .csv from there.

* Which is what I assume is the crux of this issue

Tested on:

OS Browser micro:bit Firmware Version
macOS Mojave 10.14.6 Chrome 253

Useful Links