pxt-filesystem
pxt-filesystem copied to clipboard
Not working on board only in simulator
Example file no running in board Micro:bit.
https://makecode.microbit.org/_7ia7bCddr0Ay
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.
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
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.
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.
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"
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.
@Cybot101 How could I fix it then? So I don't use python, but stay with Javascript?
@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.
@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.
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"?
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
- Go to MakeCode
- Start a project
- From the setup cog, select
Extensions
- Scroll to the bottom until Want to create your own extension? Log in to GitHub
- follow process for generating a token
- paste the url for the fork
https://github.com/Cybot101/pxt-filesystem
- 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 |