• Hi - I think it might be best to start out from some existing SPI code like http://www.espruino.com/SPI and work from there...

    The code you've written seems to have a few issues (like :integer= not being valid JS) and I think you'll be banging your head against a wall for quite some time just trying to stop it erroring.

    For SPI, the issue is you're using SPI which is the class name for an SPI peripheral, but isn't an SPI peripheral itself. Try changing it for SPI1 - the first SPI peripheral - and it should be fine.

    In terms of your other stuff - try using the search box at the top right of Espruino.com and specifically the reference at http://www.espruino.com/Reference:

    function to convert decimal to binary

    If you want to convert a number to a binary string, just use ...toString(2) - eg (42).toString(2)

    ... but you don't need to convert anything to binary to send it over SPI

    fopen,fclose -- (file open, file write, file close)

    http://www.espruino.com/Reference#fs

    http://www.espruino.com/File+IO

    Or since you don't have an SD card, http://www.espruino.com/Reference#Storag­e

    getTime

    It's literally a function called 'getTime()' - or you can use Date.now() - http://www.espruino.com/Reference#l__glo­bal_getTime

About

Avatar for Gordon @Gordon started