Skip to content

Commit

Permalink
added support for TSL2561 brightness sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
jp112sdl committed Mar 20, 2018
1 parent 1c39cad commit 8d71de5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions examples/HM-Sen-LI-O/HM-Sen-LI-O.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <AskSinPP.h>
#include <LowPower.h>
#include <Register.h>
#include <sensors/Bh1750.h>
//#include <sensors/Bh1750.h>
#include <sensors/Tsl2561.h>

#include <MultiChannelDevice.h>

Expand Down Expand Up @@ -106,7 +107,8 @@ class LuxChannel : public Channel<Hal, LiList1, EmptyList, List4, PEERS_PER_CHAN
uint32_t lux;
uint16_t millis;

Bh1750<> bh1750;
//Bh1750<> bh1750;
Tsl2561<> tsl2561;

public:
LuxChannel () : Channel(), Alarm(5), lux(0), millis(0) {}
Expand All @@ -115,8 +117,10 @@ class LuxChannel : public Channel<Hal, LiList1, EmptyList, List4, PEERS_PER_CHAN
// here we do the measurement
void measure () {
DPRINT("Measure... ");
bh1750.measure();
lux = bh1750.brightness();
//bh1750.measure();
//lux = bh1750.brightness();
tsl2561.measure();
lux = tsl2561.brightness();
DDEC(lux);
DPRINTLN(" lux");
}
Expand Down Expand Up @@ -149,7 +153,8 @@ class LuxChannel : public Channel<Hal, LiList1, EmptyList, List4, PEERS_PER_CHAN
void setup(Device<Hal, LiList0>* dev, uint8_t number, uint16_t addr) {
Channel::setup(dev, number, addr);
sysclock.add(*this);
bh1750.init();
//bh1750.init();
tsl2561.init();
}

uint8_t status () const {
Expand Down

0 comments on commit 8d71de5

Please sign in to comment.