Skip to content

Commit

Permalink
Add control for the WiFi shield FET
Browse files Browse the repository at this point in the history
  • Loading branch information
thgeorgiou committed Nov 1, 2017
1 parent 948f790 commit 717c51b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
5 changes: 4 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ begin KEYWORD2
refresh KEYWORD2
readPM25 KEYWORD2
readPM10 KEYWORD2
readPM01 KEYWORD2
readPM01 KEYWORD2
enablePowerControl KEYWORD2
turnOn KEYWORD2
turnOff KEYWORD2
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=hackAIR
version=0.3.4
version=0.4.0
author=Thanasis Georgiou <contact@thgeorgiou.com>
maintainer=Thanasis Georgiou <contact@thgeorgiou.com>
sentence=A library for using a variety of air quality sensors.
Expand Down
12 changes: 12 additions & 0 deletions src/hackair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,15 @@ void hackAIR::clearData(hackAirData &data) {
data.tamper = 0;
data.battery = 0;
}

void enablePowerControl() {
pinMode(A2, OUTPUT);
}

void turnOn() {
digitalWrite(A2, HIGH);
}

void turnOff() {
digitalWrite(A2, LOW);
}
17 changes: 16 additions & 1 deletion src/hackair.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,27 @@ class hackAIR {
* sensors.
*/
void refresh(hackAirData &data);

/**
* Empties a hackAir data structure
*/
void clearData(hackAirData &data);

/**
* Uses pin A2 to control the sensor power switch (FET)
*/
void enablePowerControl();

/**
* Turn the sensor power on
*/
void turnOn();

/**
* Turn the sensor power off
*/
void turnOff();

private:
int _sensorType;
long _lastTime;
Expand Down

0 comments on commit 717c51b

Please sign in to comment.