So this is an Original Espruino board with Bluetooth installed?
I'm afraid the bluetooth module (HC-05 / HC-06) acts as a simple serial port - so there's no file transfer or even connected/disconnected event.
You'd have to add a bit of software on the Mac to receive the file. It shouldn't be too bad for example if you have it send the string "\x10sendFile();\n" then it will silently call the sendFile function, which could send the contents.
You can then make a sendfile function on Espruino -something like:
function sendFile() {
var f = E.openFile('log.txt','r');
var d = f.read(100);
while (d!==undefined) {
Serial1.write(d);
d = f.read(100);
}
f.close();
Serial1.println("<<EOF>>");
}
Then your code only has to write everything it receives to a file until it gets the characters <<EOF>>
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
So this is an Original Espruino board with Bluetooth installed?
I'm afraid the bluetooth module (HC-05 / HC-06) acts as a simple serial port - so there's no file transfer or even connected/disconnected event.
You'd have to add a bit of software on the Mac to receive the file. It shouldn't be too bad for example if you have it send the string
"\x10sendFile();\n"
then it will silently call thesendFile
function, which could send the contents.You can then make a sendfile function on Espruino -something like:
Then your code only has to write everything it receives to a file until it gets the characters
<<EOF>>