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.
TSL2561 Class Reference
Interface for Luminosity sensor, TSL2561. More...
#include <TSL2561.h>
Public Member Functions | |
| TSL2561 (PinName p_sda, PinName p_scl) | |
| Configure data pin. | |
| TSL2561 (I2C &p_i2c) | |
| Configure data pin (with other devices on I2C line) | |
| float | lux (void) |
| Get approximates the human eye response in the commonly used Illuminance unit of Lux. | |
| uint8_t | set_timing_reg (uint8_t parameter) |
| Set timing register. | |
| uint8_t | read_timing_reg (void) |
| Read timing register. | |
| void | frequency (int hz) |
| Set I2C clock frequency. | |
| uint8_t | who_am_i (void) |
| check Device ID number | |
| uint16_t | read_ID (void) |
| Read ID and Revision Number. | |
| void | power_up (void) |
| Power Up/Down. | |
Detailed Description
Interface for Luminosity sensor, TSL2561.
#include "mbed.h" #include "TSL2561.h" // I2C Communication TSL2561 lum(dp5,dp27); // TSL2561 SDA, SCL // If you connected I2C line not only this device but also other devices, // you need to declare following method. I2C i2c(dp5,dp27); // SDA, SCL TSL2561 lum(i2c); // TSL2561 SDA, SCL (Data available every 400mSec) int main() {; while(true){ printf("Illuminance: %+7.2f [Lux]\r\n", lum.lux()); wait(1.0); } }
Definition at line 87 of file TSL2561.h.
Constructor & Destructor Documentation
| TSL2561 | ( | PinName | p_sda, |
| PinName | p_scl | ||
| ) |
| TSL2561 | ( | I2C & | p_i2c ) |
Configure data pin (with other devices on I2C line)
- Parameters:
-
I2C previous definition
Definition at line 29 of file TSL2561.cpp.
Member Function Documentation
| void frequency | ( | int | hz ) |
| float lux | ( | void | ) |
Get approximates the human eye response in the commonly used Illuminance unit of Lux.
- Parameters:
-
none
- Returns:
- Lux
Definition at line 51 of file TSL2561.cpp.
| void power_up | ( | void | ) |
| uint16_t read_ID | ( | void | ) |
Read ID and Revision Number.
- Parameters:
-
none
- Returns:
- ID + REVNO
Definition at line 141 of file TSL2561.cpp.
| uint8_t read_timing_reg | ( | void | ) |
Read timing register.
- Parameters:
-
timing parameter
- Returns:
- timing read data
Definition at line 110 of file TSL2561.cpp.
| uint8_t set_timing_reg | ( | uint8_t | parameter ) |
Set timing register.
- Parameters:
-
timing parameter
- Returns:
- timing read data
Definition at line 99 of file TSL2561.cpp.
| uint8_t who_am_i | ( | void | ) |
check Device ID number
- Parameters:
-
none
- Returns:
- TSL2561 = 1, others 0
Definition at line 150 of file TSL2561.cpp.
Generated on Sun Aug 7 2022 04:19:43 by
1.7.2