microbit file system with JavaScript

310 Views Asked by At

I'm 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.

1

There are 1 best solutions below

0
On

The files module is at best a beta edition. Makecode have advised not to use it, it's unsupported. Have you tried micropython, it has good support for file system. There is also serial support, but i have little knowledge of it