Open remay opened 8 years ago
We should, yes :-)
I have a recent request for this in support as a tool to aid teaching IoT, so adding a +1
I believe the IOPinService or EventService could / should be used for this. See https://youtu.be/dyFyq42Snkw for an example of light dependent resistors accessed over Bluetooth, in this case using the Event Service as it gives you full 10 bit resolution.
@bluetooth-mdw digging up an old issue as I came here to file this because people are doing some music related stuff with micro:bit+Bluetooth and the light sensor might be interesting there too (https://github.com/Louismac/CBMicroBit).
Can you elaborate on the design you imagine for this? I'd thought it would just be a new service similar to the way you did the temperature one? Ideally it'd be nice for there to be enough hints in this ticket for someone to step up and implement something.
Can you clarify the idea/requirement, please? Is this about externally connected light sensors or about using the LED matrix per this info: https://support.microbit.org/support/solutions/articles/19000024023-how-does-the-light-sensing-feature-on-the-micro-bit-work- Cheers
Martin
I was thinking about the 'internal' light sensor - IE the display
On Thu, 5 Apr 2018, 09:25 Martin Woolley, notifications@github.com wrote:
Can you clarify the idea/requirement, please? Is this about externally connected light sensors or about using the LED matrix per this info: https://support.microbit.org/support/solutions/articles/19000024023-how-does-the-light-sensing-feature-on-the-micro-bit-work- Cheers
Martin
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lancaster-university/microbit-dal/issues/192#issuecomment-378858467, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI-qRhTfTZtoYXjweFoOkkRoZIXOvwxks5tldUOgaJpZM4Je-yQ .
OK, thanks @jaustin
I looked at the DAL API and see that display.getBrightness() returns a value from 0-255. A simple approach would be to add a characteristic to the LED Service called BrightnessLevel with support for notifications (only). Subscribing to notifications should cause an automatic switch to the DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE display mode and start sampling the light level at a fixed rate, sending a notification for each one.
If wanted to get all fancy, we could have support for one off reads as well and could have a characteristic for setting the sampling period but... do we really need these features? I doubt it. KISS I think applies.
Comments?
I know that the light sensor came late in the day, but shouldn't we add a BLE characteristic for it?