mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
tsl2561: update example to use new API
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
parent
96a8bf7e06
commit
ac9cd1afa3
@ -32,7 +32,6 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
mraa_result_t error = MRAA_SUCCESS;
|
mraa_result_t error = MRAA_SUCCESS;
|
||||||
upm::TSL2561 *sensor = NULL;
|
upm::TSL2561 *sensor = NULL;
|
||||||
int calculatedLux = 0;
|
|
||||||
int loopCount = 100;
|
int loopCount = 100;
|
||||||
|
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
@ -48,13 +47,7 @@ int main (int argc, char **argv)
|
|||||||
//sensor = new upm::TSL2561(0, TSL2561_Address, GAIN_0X, INTEGRATION_TIME2_402MS);
|
//sensor = new upm::TSL2561(0, TSL2561_Address, GAIN_0X, INTEGRATION_TIME2_402MS);
|
||||||
|
|
||||||
for(int i=0; i< loopCount; i++){
|
for(int i=0; i< loopCount; i++){
|
||||||
error = sensor->getLux(calculatedLux);
|
fprintf(stdout, "Lux = %d\n", sensor->getLux());
|
||||||
if (error != MRAA_SUCCESS) {
|
|
||||||
fprintf(stderr, "Error: on i2c bus address setup in i2cReadReg()\n");
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stdout, "Lux = %d\n", calculatedLux);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user