0

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.

user1405338
  • 179
  • 1
  • 5
  • 14
  • Have you tried to read `my-data` a line at a time and writing each line with `serial.writeLine` – phil Nov 22 '18 at 14:28
  • yes it gives me just variable name back and not the file :( – user1405338 Nov 22 '18 at 18:29
  • 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 Github – phil Nov 24 '18 at 00:35

1 Answers1

0

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

phil
  • 561
  • 3
  • 10