Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BLE characteristic(s) for light sensor #192

Open
remay opened this issue Aug 8, 2016 · 7 comments
Open

Add BLE characteristic(s) for light sensor #192

remay opened this issue Aug 8, 2016 · 7 comments
Labels

Comments

@remay
Copy link
Contributor

remay commented Aug 8, 2016

I know that the light sensor came late in the day, but shouldn't we add a BLE characteristic for it?

@ghost
Copy link

ghost commented Aug 8, 2016

We should, yes :-)

@ghost ghost added the BLE label Aug 17, 2016
@microbit-mark
Copy link
Contributor

I have a recent request for this in support as a tool to aid teaching IoT, so adding a +1

@ghost
Copy link

ghost commented Nov 23, 2017

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.

@jaustin
Copy link
Contributor

jaustin commented Mar 23, 2018

@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.

@ghost
Copy link

ghost commented Apr 5, 2018

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

@jaustin
Copy link
Contributor

jaustin commented Apr 5, 2018 via email

@ghost
Copy link

ghost commented Apr 5, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants