Andrew FangEmily ToPaige Xio AlvarezJulia SolanoStanford Stickney
Published

Zenrack

Be one with cleanliness

Work in progress1,848
Zenrack

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×2
LED (generic)
LED (generic)
×12
Speaker
×1
Wtv020sd16p
×1
Econoboard
×1
Gravel
×1
Moss
×1
Wires
×1
Force Sensitive Resistors
×4
Nails (for Moisture Sensor)
×2
1/8" acrylic sheet (34" x 18") - clear
×1
1/8" acrylic sheet - black
×1
Galvanized nails
×2
100kΩ Resistor
×1
100Ω Resistor
×1

Story

Read more

Code

zenrack.ino

C/C++
#include <Wtv020sd16p.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.
const int analogInPin0 = A0;  // Analog input pin that the FSR is attached to
const int analogInPin1 = A1;  // Analog input pin that the FSR is attached to
const int analogInPin2 = A2;  // Analog input pin that the FSR is attached to
const int analogInPin3 = A3;  // Analog input pin that the FSR is attached to
const int thresh = 25;

int sensorValue0 = 0;
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
boolean first = true;

int lastWeight = 0;
int lastTrack = 0;
const int numSongs = 2;

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void setup() {
  wtv020sd16p.reset();
  Serial.begin(9600);
}

void loop() {
  sensorValue0 = analogRead(analogInPin0);
  sensorValue1 = analogRead(analogInPin1);
  sensorValue2 = analogRead(analogInPin2);
  sensorValue3 = analogRead(analogInPin3);         

  // print the results to the serial monitor:
  Serial.print("sensor0 = " );                       
  Serial.print(sensorValue0);
  Serial.print(" | sensor1 = " );                       
  Serial.print(sensorValue1);
  Serial.print(" | sensor2 = " );                       
  Serial.print(sensorValue2);
  Serial.print(" | sensor3 = " );                       
  Serial.println(sensorValue3);

  int newWeight = (sensorValue0 + sensorValue1 + sensorValue2 + sensorValue3);
  Serial.println(newWeight);
  if (first) {
    lastWeight = newWeight;
    first = false;
  } else {
    if (newWeight > lastWeight + thresh) {
      wtv020sd16p.playVoice(lastTrack % numSongs);
      lastTrack = lastTrack + 1;
    }
    lastWeight = newWeight;
  }


  // wait 2 milliseconds before the next loop
  delay(1000);
}

Credits

Andrew Fang

Andrew Fang

6 projects • 2 followers
I am Andrew
Emily To

Emily To

12 projects • 3 followers
I am Emily
Paige Xio Alvarez

Paige Xio Alvarez

4 projects • 6 followers
Julia Solano

Julia Solano

3 projects • 12 followers
Designer based in Berkeley, California.
Stanford Stickney

Stanford Stickney

5 projects • 5 followers
I am a fun loving hardworking kid who enjoys life

Comments