Hi - trying to solve an issue using an espruino pico and an sd card loggin gps and other sensor data
when connected to the usb and the ide it functions fine and logs the data as csv but as soon as i go to standalone mode using a battery nothing seems to happen
i have placed it all in onInit but can't seem to get anything going
any help would be super appreciated as i am super up against a project deadline on this thanks
function oninit(){
// Wire up up MOSI, MISO, SCK and CS pins (along with 3.3v and GND)
SPI1.setup({mosi:B5, miso:B4, sck:B3});
E.connectSDCard(SPI1, B1 /*CS*/);
// see what's on the device
//console.log(require("fs").readdirSync());
Serial1.setup(9600,{tx:B6,rx:B7});
require("fs").appendFileSync("data2.csv" , "new");
var gps = require("GPS").connect(Serial1, function(data) {
SPI1.setup({mosi:B5, miso:B4, sck:B3});
E.connectSDCard(SPI1, B1 /*CS*/);
//var fs = E.openFile("data2.csv","w");
i++;
var readings = [
analogRead(A0),
analogRead(A1),
analogRead(A2),
data.lat,
data.lon,
data.time
];
//f.write(readings.join(", ")+"\n");
ar=analogRead(A2);
//console.log(readings);
require("fs").appendFileSync("data2.csv" , readings.join(", ")+"\n");
// f.close();
});
setInterval(gps, 1000);
}
function gps(){
var fs;
var i=0;
var gps = require("GPS").connect(Serial1, function(data) {
SPI1.setup({mosi:B5, miso:B4, sck:B3});
E.connectSDCard(SPI1, B1 /*CS*/);
//var fs = E.openFile("data2.csv","w");
i++;
var readings = [
analogRead(A0),
analogRead(A1),
analogRead(A2),
data.lat,
data.lon,
data.time
];
//f.write(readings.join(", ")+"\n");
ar=analogRead(A2);
//console.log(readings);
require("fs").appendFileSync("data2.csv" , readings.join(", ")+"\n");
// f.close();
});
}
oninit();
save();
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 - trying to solve an issue using an espruino pico and an sd card loggin gps and other sensor data
when connected to the usb and the ide it functions fine and logs the data as csv but as soon as i go to standalone mode using a battery nothing seems to happen
i have placed it all in onInit but can't seem to get anything going
any help would be super appreciated as i am super up against a project deadline on this thanks