0
votes

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
Have you tried to read my-data a line at a time and writing each line with serial.writeLinephil
yes it gives me just variable name back and not the file :(user1405338
There are many bugs with file and serial. I have just produced the same blocks as in op but with the addition of a for ever block with show number 6 in there, not only does the 6 not display, but the microbit also does nothing when i click button b. I have raised this as a bug on Githubphil

1 Answers

0
votes

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