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:
//Offline weather data logger for the Espruino Javascript microcontroller
//DHT11 sensor connected to pin c11
//Made by Eric Min - NO STEALING SOURCE CODE! IF YOU DO SO PLEASE CREDIT ME!!
var dht = require("DHT11").connect(c11); // requires the DHT11 module for temperature/humidity logging
var files = require("fs").readdirSync(); // requires the Filesystem module for reading, writing, and storing files
var f = E.openFile("log.txt","w"); // sets variable for file IO library
var x = 1;
function readTemp() {
dht.read(function (a) {
f.write(a.temp.toString() + a.rh.toString());
});
}
function logTemperature() {
dht.read(function (a) {
f.write(a.temp.toString()+a.rh.toString());
});
}
function logAtIntervals() {
setInterval(logTemperature, 1800000);
x++;
}
if (x <= 24) {
console.log("Logging done!");
f.write("Logging done! Entering sleep mode, good night!");
f.close("log.txt");
}
logAtIntervals();
yeah I'm a noob so please point out any errors in my code please!
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.
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!