Just discovered Espruino for Micro:bit and it was a revelation!
I'm trying to build a small project that makes use of the internal "light sensor" (the one that makes use of the led display) but I see it isn't yet supported, right?
I imagine it would need to be implemented from scratch since I don't see the library used eg by MicroPython to access micro:bit hardware.
Any plan for the future?
Otherwise I'll start studying the library in my spare time to understand how it works to try to implement it directly in Espruino
Thanks in advance!
Hi - glad you're enjoying it!
Is this the micro:bit 2, or the 1?
It's not supported yet, but as far as I can see all the micro:bit does is read the voltage from one of the LEDs on the display (it's something we do for Puck.js too) so actually doing it shouldn't be too hard - the code we have is at https://github.com/espruino/Espruino/blob/cfbc4040d/libs/puckjs/jswrap_puck.c#L1298-L1311
I'm having real difficulty finding out which pins they use for sensing, but if you knew which pin was used, even though we don't expose all the analogs, you could still use the NRF52LL library to manually kick off an ADC reading: https://www.espruino.com/NRF52LL#make-one-reading-from-the-adc-
Thanks a lot for the feedback !
It's a micro:bit 2
I'll read your docs and try to figure it out... there's also some code for micro:bit more (a scratch extension that features the light intensity reading), I'll try to figure out how to add it to espruino
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem