-
• #2
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:
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>>
-
• #3
Thanks!
Wait then what is the bluetooth module for?
can I connect to my board by bluetooth and open up espruino(or screen/picocom/minicom) and program it wirelessly? -
• #4
can I connect to my board by bluetooth and open up espruino(or screen/picocom/minicom) and program it wirelessly?
Yes, that's the idea.
You can move the Espruino console away from
Serial1
and use it directly to read and write individual bytes - but keeping the console on there is easier, and if there were some kind of error it'd get reported back to you over Bluetooth as well.
Hi,
I'm planning to make a datalogger with my espruino with a dht11 sensor.
I want to make it so that If I connect my mac to my espruino via bluetooth, which will be on my windowsill, the espruino will send me all the logged data through a text file.
Is this possible?
Is there a command/keyword that triggers when bluetooth is connected?
Also a command for sending files by bluetooth?
I checked the reference page but I can't find any.
Thanks!
by the way here's my code so far:
yeah I'm a noob so please point out any errors in my code please!