Polluted Store
This project represents our carbon footprint in the most literal and visual way.
When we choose to add some meat to our chart, we don't consider what footprint this has. With this project you can see on the barometer how much per kilo emissions has released.
Hardware
For this little project you need:
- Arduino Uno
- 560 resistor (1x)
- 10k resistor (5x)
- Jump wiresLED (1x)
- Button (1x)
- Servo (1x)
Arduino Schema
This LED light glows continuously.
I made a switch button out of aluminum for the subjest meat, vegetables and fruits, dairy and eggs and nuts. In the arduino schema it's defined as a button. But the switch contains 2 jump wires that, when connected with the alum object, closses the circuit.
The servo motor is used for the up and down movement for the barometer.
Code
#include
Servo servo;
const int BUTTON_PIN = 2;
const int LED_PIN = 4;
boolean didMyOneTimeActionA = false;
boolean didMyOneTimeActionB = false;
boolean didMyOneTimeActionC = false;
boolean didMyOneTimeActionD = false;
const int switchPinA = 9; //vlees
const int switchPinB = 8; //groenten&fruit
const int switchPinC = 7; //zuivel&ei
const int switchPinD = 6; //noten
const int servoPinCo2 = 10;
int ledState = LOW;
int lastButtonState;
int currentButtonState;
int co2value = 0;
void setup() {
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
servo.attach(10);
Serial.println("---SERIAL BEGUN---");
pinMode(switchPinA, INPUT);
pinMode(switchPinB, INPUT);
pinMode(switchPinC, INPUT);
pinMode(switchPinD, INPUT);
pinMode(BUTTON_PIN, INPUT); }
void loop() {
digitalWrite(LED_PIN, HIGH);
if (digitalRead(switchPinA) == HIGH) {
Serial.println("switchAvlees closed");
} else {
Serial.println("switchAvlees open");
if (didMyOneTimeActionA == false)
{
didMyOneTimeActionA = true;
co2value = co2value + 135;
}
}
if (digitalRead(switchPinB) == HIGH) {
Serial.println("switchBgroente closed");
} else {
Serial.println("switchBgroente open");
if (didMyOneTimeActionB == false)
{
didMyOneTimeActionB = true;
co2value = co2value + 18;
}
}
if (digitalRead(switchPinC) == HIGH) {
Serial.println("switchCzuivel closed");
} else {
Serial.println("switchCzuivel open");
if (didMyOneTimeActionC == false)
{
didMyOneTimeActionC = true;
co2value = co2value + 16;
}
}
if (digitalRead(switchPinD) == HIGH) {
Serial.println("switchDnoten closed");
} else {
Serial.println("switchDnoten open");
if (didMyOneTimeActionD == false)
{
didMyOneTimeActionD = true;
co2value = co2value + 11;
}
}
if (digitalRead(BUTTON_PIN) == HIGH) {
co2value = 0;
didMyOneTimeActionA = false;
didMyOneTimeActionB = false;
didMyOneTimeActionC = false;
didMyOneTimeActionD = false;
}
co2value = constrain(co2value, 0, 180);
Serial.println("\n \n");
Serial.println(co2value);
Serial.println("\n \n");
servo.write(co2value);
delay(100);