Phoebe LinHaley RowlandAnna CareyTessira Crawfordlee_hamstra
Created February 19, 2015

Emonion: A Cathartic Onion-Cutting Experience

A working prototype of a cutting board that plays your own sad song for when you cut an onion

Full instructions provided408
Emonion: A Cathartic Onion-Cutting Experience

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Tactile switches
×2
LCD display
×1
LCD display
×1

Story

Read more

Custom parts and enclosures

H1-1.stl

STL files

H2-2.stl

Code

emOnion_code.txt

Plain text
Arduino code
// transistor controlled audio

#include <LiquidCrystal.h> // include LCD library

LiquidCrystal lcd (7,6,5,4,3,2); // initialize LCD object on relevant pins

const int PLAY=9;    // transistor controlling PLAY on pin 9
const int NEXT=10;    // transistor controlling NEXT on pin 8
const int PREV=8;   // transistor controlling PREVIOUS on pin 10

const int NEXTBUT=11; // NEXT button on pin 11
const int PREVBUT=12; // PREVIOUS button 2 on pin 12
const int PLAYPOT=0; // Play pressure sensor on analog pin 0

boolean last_NEXTBUT = LOW;    // booleans for debounce function
boolean current_NEXTBUT = LOW;
boolean last_PREVBUT = LOW;
boolean current_PREVBUT = LOW;

int user = 1;

boolean playing = false;

void setup()
{
  pinMode(PLAY, OUTPUT);
  pinMode(NEXT, OUTPUT);
  pinMode(PREV, OUTPUT);
  
  pinMode(NEXTBUT, INPUT);
  pinMode(PREVBUT, INPUT);
  
  lcd.begin(16, 2);
  lcd.print("    emOnion");
  delay(2000);
  lcd.clear();
  display_username(user);
  delay(1000);


}


void loop()
{


  if(analogRead(PLAYPOT) > 120)
  {
    if (playing == false){
    digitalWrite(PLAY, HIGH);
    delay(100);
    digitalWrite(PLAY, LOW);
    delay(200);
    playing = !playing;
    }
    
    
  }
  
  current_NEXTBUT = debounce(NEXTBUT, last_NEXTBUT);
  if(last_NEXTBUT == LOW && current_NEXTBUT == HIGH)
  {
    if (playing == true)
    {
      playing = !playing;
    }
    
    user = user++;
    if(user > 3){
      user = user - 3;
    }
    
    lcd.clear();
    display_username(user);
    
    if(playing == true)
    {
      digitalWrite(NEXT, HIGH);
      delay(100);
      digitalWrite(NEXT, LOW);
 
      digitalWrite(PLAY, HIGH);
      delay(200);
      digitalWrite(PLAY, LOW);
    }
    else
    {
      digitalWrite(NEXT, HIGH);
      delay(100);
      digitalWrite(NEXT, LOW);
      
      digitalWrite(PLAY, HIGH);
      delay(200);
      digitalWrite(PLAY, LOW);
    }

  }
  
  current_PREVBUT = debounce(PREVBUT, last_PREVBUT);
  if(last_PREVBUT == LOW && current_PREVBUT == HIGH)
  {
    
     if (playing == true)
    {
      playing = !playing;
    }
    
    user = user--;
    if(user < 1){
      user = 3;
    }
    
    lcd.clear();
    display_username(user);
    
    if(playing == true)
    {
      digitalWrite(PREV, HIGH);
      delay(100);
      digitalWrite(PREV, LOW);
    
      digitalWrite(PLAY, HIGH);
      delay(200);
      digitalWrite(PLAY, LOW);
    }
    else
    {
      digitalWrite(PREV, HIGH);
      delay(100);
      digitalWrite(PREV, LOW);
      
      //digitalWrite(PLAY, HIGH);
      //delay(200);
      //digitalWrite(PLAY, LOW);
    }
  }


}

// debounce function
//boolean switchPin;
boolean debounce(boolean switchPin, boolean last)
{
  boolean current = digitalRead(switchPin);
  if (last != current)
  {
    delay(15);
    current = digitalRead(switchPin);
  }
}


void display_username(int i)
{
  if (i==1){
    lcd.print("Onioner:");
    lcd.setCursor(0,1);
    lcd.print("Lee");
  }
  else if (i==2){
    lcd.print("Onioner:");
    lcd.setCursor(0,1);
    lcd.print("Tessira");
  }
  else if (i==3){
    lcd.print("Onioner:");
    lcd.setCursor(0,1);
    lcd.print("Chris");
  }
}

Credits

Phoebe Lin

Phoebe Lin

13 projects • 3 followers
Haley Rowland

Haley Rowland

4 projects • 9 followers
Anna Carey

Anna Carey

6 projects • 1 follower
Tessira Crawford

Tessira Crawford

3 projects • 5 followers
lee_hamstra

lee_hamstra

3 projects • 0 followers

Comments