Oh - actually forget that. It's not a problem at all.
Basically if you have nothing in FlashEEPROM at that location, f.read will return undefined.
f.read
So f.read(0) returns undefined, and E.toString complains because it's given undefined.
f.read(0)
E.toString
undefined
Try:
var eepromcontents = f.read(0); if (eepromcontents!==undefined) { var str = E.toString(eepromcontents); ... }
Or make sure you do f.write(0,"Hello") first to put something in there - but personally it'd be good practice to check anyway.
f.write(0,"Hello")
@Gordon started
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.
Oh - actually forget that. It's not a problem at all.
Basically if you have nothing in FlashEEPROM at that location,
f.read
will return undefined.So
f.read(0)
returns undefined, andE.toString
complains because it's givenundefined
.Try:
Or make sure you do
f.write(0,"Hello")
first to put something in there - but personally it'd be good practice to check anyway.