@Stevie, wow - looks nice! Using the analog values directly seems like a great plan (analogRead gives a 16 bit value, but the ADC is only 12 bit - hence the low 4 bits being 0).
I think it probably does make sense to include something like that in jshardware.c (especially as some hardware actually has a proper RNG). I'll add that to the bug, and will probably expose it in something like E.random()...
Also, at some point I need to come up with an example of compiling your own function that can be loaded in dynamically. The work done for compiled functions could easily be applied to C - then you could have your own native code without having to recompile your own image.
@allObjects - actually the code @JumJum posted there isn't needed any more. Native code can now be stored in a String in Espruino's memory, so it works even when it's saved and Espruino is restarted.
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.
@Stevie, wow - looks nice! Using the analog values directly seems like a great plan (analogRead gives a 16 bit value, but the ADC is only 12 bit - hence the low 4 bits being 0).
I think it probably does make sense to include something like that in jshardware.c (especially as some hardware actually has a proper RNG). I'll add that to the bug, and will probably expose it in something like
E.random()
...Also, at some point I need to come up with an example of compiling your own function that can be loaded in dynamically. The work done for compiled functions could easily be applied to C - then you could have your own native code without having to recompile your own image.
@allObjects - actually the code @JumJum posted there isn't needed any more. Native code can now be stored in a String in Espruino's memory, so it works even when it's saved and Espruino is restarted.