Some small updates
This commit is contained in:
parent
df6feb5597
commit
5f0800897c
5 changed files with 22 additions and 14 deletions
|
|
@ -51,7 +51,7 @@ based on Christopher Laws, March, 2013 code.
|
|||
|
||||
void SensorBH1750::setup() {
|
||||
Wire.begin();
|
||||
configure(BH1750_CONTINUOUS_HIGH_RES_MODE);
|
||||
configure(BH1750_ONE_TIME_HIGH_RES_MODE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
#include "SensorPhotocell.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
void SensorPhotocell::interruptHandler()
|
||||
{
|
||||
++pulse;
|
||||
}
|
||||
|
||||
|
||||
void SensorPhotocell::setup()
|
||||
{
|
||||
Interrupt::setCallback(SensorPhotocell::interruptHandler);
|
||||
Interrupt::setupPinInterrupt(PC2); //PC3
|
||||
}
|
||||
|
||||
void SensorPhotocell::read(PowerData& data)
|
||||
{
|
||||
data.consumption = pulse;
|
||||
}
|
||||
|
||||
void SensorPhotocell::reset()
|
||||
{
|
||||
pulse = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@ class SensorPhotocell : public SensorPowerConsumption
|
|||
public:
|
||||
virtual void setup();
|
||||
virtual void read(PowerData& data);
|
||||
virtual void reset();
|
||||
|
||||
private:
|
||||
unsigned int pulse;
|
||||
static unsigned int pulse;
|
||||
|
||||
static void interruptHandler();
|
||||
};
|
||||
|
||||
#endif // SensorPhotocell_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue