Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal-bluetooth-mdw by
MicroBitLightSensor Class Reference
Class definition for MicroBitLightSensor. More...
#include <MicroBitLightSensor.h>
Public Member Functions | |
| MicroBitLightSensor (const MatrixMap &map) | |
| Constructor. | |
| int | read () |
| This method returns a summed average of the three sections of the display. | |
| void | startSensing (MicroBitEvent) |
| The method that is invoked by sending MICROBIT_DISPLAY_EVT_LIGHT_SENSE using the id MICROBIT_ID_DISPLAY. | |
| ~MicroBitLightSensor () | |
| A destructor for MicroBitLightSensor. | |
Detailed Description
Class definition for MicroBitLightSensor.
This is an object that interleaves light sensing with MicroBitDisplay.
Definition at line 47 of file MicroBitLightSensor.h.
Constructor & Destructor Documentation
| MicroBitLightSensor | ( | const MatrixMap & | map ) |
Constructor.
Create a representation of the light sensor.
- Parameters:
-
map The mapping information that relates pin inputs/outputs to physical screen coordinates. Defaults to microbitMatrixMap, defined in MicroBitMatrixMaps.h.
Definition at line 84 of file MicroBitLightSensor.cpp.
| ~MicroBitLightSensor | ( | ) |
A destructor for MicroBitLightSensor.
The destructor removes the listener, used by MicroBitLightSensor from the default EventModel.
Definition at line 176 of file MicroBitLightSensor.cpp.
Member Function Documentation
| int read | ( | ) |
This method returns a summed average of the three sections of the display.
A section is defined as: ___________________ | 1 | | 2 | | 3 | |___|___|___|___|___| | | | | | | |___|___|___|___|___| | 2 | | 3 | | 1 | |___|___|___|___|___| | | | | | | |___|___|___|___|___| | 3 | | 1 | | 2 | |___|___|___|___|___|
Where each number represents a different section on the 5 x 5 matrix display.
- Returns:
- returns a value in the range 0 - 255 where 0 is dark, and 255 is very bright
Definition at line 120 of file MicroBitLightSensor.cpp.
| void startSensing | ( | MicroBitEvent | ) |
The method that is invoked by sending MICROBIT_DISPLAY_EVT_LIGHT_SENSE using the id MICROBIT_ID_DISPLAY.
- Note:
- this can be manually driven by calling this member function, with a MicroBitEvent using the CREATE_ONLY option of the MicroBitEvent constructor.
Definition at line 152 of file MicroBitLightSensor.cpp.
Generated on Tue Jul 12 2022 12:45:47 by
1.7.2
