small example with SD card module connected to SPI1
function onInit() {
// initial SPI1 for SDCard module
SPI1.setup({sck:A5, miso:A6, mosi:A7 });
E.connectSDCard(SPI1,B1/*CS*/);
console.log(require("fs").readdirSync());
require("fs").writeFileSync("hello.txt", "Hello World");
console.log(require("fs").readFileSync("hello.txt")); // prints "Hello World"
require("fs").appendFileSync("hello.txt", "!!!");
console.log(require("fs").readFileSync("hello.txt")); // prints "Hello World!!!"
}
// call onInit() if it is first start
onInit();
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.
small example with SD card module connected to SPI1