![]() |
ThinkingSkins - MossSolar Facade
Version 1.0
|
This is the mainfile of the ThinkingSkins - MossSolar Facade project software. More...
#include "defines.h"
#include "TM_motorDriver.h"
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include <pgmspace.h>
#include "WS2812_Definitions.h"
Functions | |
void | setup () |
void | loop () |
void | triggerDustEvent () |
Called, if there is much dust in the air. Randomly turns one of the moss-sides to the front. More... | |
void | triggerLightEvent () |
Called, if the brightness at the frondside is to high. Turns the solarpanels to the front to protect the moss and collect energy. More... | |
void | triggerTemperatureEvent () |
Called, if the temperature at the frondside is to high. Turns the solarpanels to the front to protect the moss and switchs over the status-led to red to indicate the watering prohibition . More... | |
void | triggerHumidityEvent_A () |
Called, if the A-side of the moss (green or 'g') runs dry. Turn the other moss-side to the front ('r') and switchs over the status-led to blue to indicate the watering requirement. More... | |
void | triggerHumidityEvent_B () |
Called, if the B-side of the moss (red or 'r') runs dry. Turn the other moss-side to the front ('g') and switchs over the status-led to blue to indicate the watering requirement. More... | |
void | setupSensors () |
Initializes the pins for the sensors and the led and set them to a defined state. More... | |
void | loopDustSensor () |
Checks each loop-tick if the dustsensor-timer triggers a check. More... | |
void | loopLightSensor () |
Checks each loop-tick if the lightsensor-timer triggers a check. More... | |
void | loopTemperatureSensor () |
Checks each loop-tick if the temperaturesensor-timer triggers a check. More... | |
void | loopHumiditySensor () |
Checks each loop-tick if the humitidysensor-timer triggers a check. More... | |
int | readDustSensor () |
First lighten the led in the dustsensor. Then wait and then get the value from the internal lightsensor and return it. More... | |
boolean | testDustSensor () |
Reads the value of the dustsensor and compares it with the threshold. More... | |
boolean | testLightSensor () |
eads the value of the lightsensor and compares it with the threshold. More... | |
boolean | testTemperatureSensor () |
Reads the value of the temperaturesensor and compares it with the threshold. More... | |
boolean | testHumiditySensor_A () |
Reads the value of the first humiditysensor (A) and compares it with the threshold. More... | |
boolean | testHumiditySensor_B () |
Reads the value of the second humiditysensor (B) and compares it with the threshold. More... | |
Variables | |
unsigned long | dustSensorTimer = 0 |
unsigned long | lightSensorTimer = 0 |
unsigned long | temperatureSensorTimer = 0 |
unsigned long | humiditySensorTimer = 0 |
unsigned long | time = 0 |
int | particles = 0 |
int | lux = 0 |
int | temperature = 0 |
int | humidity_A = 0 |
int | humidity_B = 0 |
boolean | dustSensoredPrev = false |
boolean | lightSensoredPrev = false |
boolean | temperatureSensoredPrev = false |
boolean | humiditySensoredPrev_A = false |
boolean | humiditySensoredPrev_B = false |
Adafruit_NeoPixel | colorLed = Adafruit_NeoPixel(1, LED_PIN, NEO_GRB + NEO_KHZ800) |
Adafruit_TSL2561_Unified | lightSensor = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 11235) |
sensors_event_t | lightEvent |
TM_motorDriver | motors = TM_motorDriver() |
This is the mainfile of the ThinkingSkins - MossSolar Facade project software.
This code provides funcions to turn the three panels A,B,C with the sides green, red and solar. Change the triggerevent-functions below setup/loop for your personal needs Call motors.calibrate() to calibrate the panel-alignment
void loopDustSensor | ( | ) |
Checks each loop-tick if the dustsensor-timer triggers a check.
loopDustSensor() Standartinterval: 10s Debounceinterval after first trigger: 5s Interval after a positive triggered dustsensoring: 20s After dust is sensored the first time, the sensor waits for 5s and check, whether there is still dust. Turns the moss in front if this check is also positive.
void loopHumiditySensor | ( | ) |
Checks each loop-tick if the humitidysensor-timer triggers a check.
loopHumiditySensor() Standartinterval: 60s Debounceinterval after first trigger: 5s Interval after a positive triggered humiditysensoring: 20s After drought is sensored the first time in one og the mosssides, the sensor waits for 5s and check, whether the moss is still dry. Turns the solarpanels in front if this check is also positive.
void loopLightSensor | ( | ) |
Checks each loop-tick if the lightsensor-timer triggers a check.
loopLightSensor() Standartinterval: 10s Debounceinterval after first trigger: 5s Interval after a positive triggered lightsensoring: 20s After light is sensored the first time, the sensor waits for 5s and check, whether its still too bright. Turns the solarpanels in front if this check is also positive.
void loopTemperatureSensor | ( | ) |
Checks each loop-tick if the temperaturesensor-timer triggers a check.
loopTemperatureSensor() Standartinterval: 10s Debounceinterval after first trigger: 5s Interval after a positive triggered temperaturesensoring: 20s After a high temperature is sensored the first time, the sensor waits for 5s and check, whether its still too hot. Turns the solarpanels in front if this check is also positive.
int readDustSensor | ( | ) |
First lighten the led in the dustsensor. Then wait and then get the value from the internal lightsensor and return it.
readDustSensor() Returns: int which contains the value of dustparticles messured in the air. Higher value => more dustparticles 0 => zero dustparticles (theoretical)
void setupSensors | ( | ) |
Initializes the pins for the sensors and the led and set them to a defined state.
boolean testDustSensor | ( | ) |
Reads the value of the dustsensor and compares it with the threshold.
testDustSensor() Return: true, if the measured value passes the threshold false, if it is within the threshold
boolean testHumiditySensor_A | ( | ) |
Reads the value of the first humiditysensor (A) and compares it with the threshold.
testHumiditySensor_A() Return: true, if the measured value passes the threshold false, if it is within the threshold
boolean testHumiditySensor_B | ( | ) |
Reads the value of the second humiditysensor (B) and compares it with the threshold.
testHumiditySensor_B() Return: true, if the measured value passes the threshold false, if it is within the threshold
boolean testLightSensor | ( | ) |
eads the value of the lightsensor and compares it with the threshold.
testLightSensor() Return: true, if the measured value passes the threshold false, if it is within the threshold
boolean testTemperatureSensor | ( | ) |
Reads the value of the temperaturesensor and compares it with the threshold.
testTemperatureSensor() Return: true, if the measured value passes the threshold false, if it is within the threshold
void triggerDustEvent | ( | ) |
Called, if there is much dust in the air. Randomly turns one of the moss-sides to the front.
void triggerHumidityEvent_A | ( | ) |
Called, if the A-side of the moss (green or 'g') runs dry. Turn the other moss-side to the front ('r') and switchs over the status-led to blue to indicate the watering requirement.
void triggerHumidityEvent_B | ( | ) |
Called, if the B-side of the moss (red or 'r') runs dry. Turn the other moss-side to the front ('g') and switchs over the status-led to blue to indicate the watering requirement.
void triggerLightEvent | ( | ) |
Called, if the brightness at the frondside is to high. Turns the solarpanels to the front to protect the moss and collect energy.
void triggerTemperatureEvent | ( | ) |
Called, if the temperature at the frondside is to high. Turns the solarpanels to the front to protect the moss and switchs over the status-led to red to indicate the watering prohibition .