Anna & Esme

From BenningtonWiki
Jump to: navigation, search

Midterm Project

Concept

Play: inviting the user to play with some toy, that toy triggering another toy to interact with the first toy / user.

Fool's errand: the toys may lead user on an interminable loop of play, without a distinct end-point.

Familiarity: everyone likes toys; initial invitation to user would be an irresistible toy. Toy on toy relationship would trigger childish instincts and reactions from the toys, thus invite user to continue playing.

Influences

Bopit.jpg

Design

A long, rectangular box to hold arduinos, wires, sensors, etc. Two toys sit atop either end of the box, allowing wires to connect to their bases. Base has imprints of where each toy should go.

When Dog A is lifted the LED flowers on its side light up and Dog B spins its head. When Dog B is lifted the LED flowers on its side light up and Dog A spins its head. The heads spinning is caused by the servo motors inside each dog.

When both dogs are lifted, an arduino tone plays.


Materials

Cardboard box, two toy dogs, two photoresistors, speaker, LEDs attached to fake flowers


Sensors

Photo resistors in base senses when toy is lifted or set on top (thus blocking or revealing light). Photoresistor controls servo motor tone/melody: "Composing for Arduino" "Play Melody"

Execution

Toys.jpg

Deaddog.jpg

Dogsinside.jpg


Photo on 2012-04-01 at 19.44.jpg

Photo on 2012-04-01 at 19.44 -2.jpg


Final Code Also need pitches.h : http://arduino.cc/en/Tutorial/tone


   #include "pitches.h"
 
 const int threshold = 100; 
 const int LEDA = 7;
 const int LEDB = 4;

 const int MOTOR = 11; // the pin for dog A
 int val = 0;       // variable used to store the value
                   // coming from the sensor

                
 const int MOTOR2 = 3; // the pin for dog B
 int val1 = 0;       // variable used to store the value
                   // coming from the sensor
                   
                   
const int SPEAKER = 8;      // pin number for the speaker
const int noteDuration = 1000;   // play notes for 20 ms

// notes to play, corresponding to the 3 sensors:
int notes[] = {
  NOTE_E3};

 
 void setup() {

     
   pinMode(MOTOR, OUTPUT); // MOTOR is as an OUTPUT
                        // Note: Analogue pins are
                        // automatically set as inputs
                        
                        
   pinMode(MOTOR2, OUTPUT); // MOTOR2 is as an OUTPUT
                        // Note: Analogue pins are
                        // automatically set as inputs
                        
  pinMode(LEDA, OUTPUT); 
  pinMode(LEDB, OUTPUT);
  
  pinMode(SPEAKER, OUTPUT);
  
 }

 void loop() {
  
   val = analogRead(0); // read the value from the sensor
   if (val > threshold){                                 
       digitalWrite(MOTOR2, val/4);
    }
  
   else { 
     digitalWrite(MOTOR2, LOW); 
   }

   analogWrite(LEDA, val/4);
                           
   delay(10); // stop the program for
             // some time

     
      val1 = analogRead(2); // read the value from
                       // the sensor
             if (val1 > threshold) {
               digitalWrite(MOTOR, val1/4);
              }
             
             else{
               digitalWrite(MOTOR, LOW);
             }  
             
   analogWrite(LEDB, val1/4);
 
                           
   delay(10); // stop the program for
             // some time


 if ((val1 > threshold) && (val > threshold)) {
   
   
             digitalWrite(MOTOR, LOW);
             digitalWrite(MOTOR2, LOW);
             analogWrite(LEDA, LOW);
             analogWrite(LEDB, LOW);       
    
   // iterate over the notes of the melody:
   for (int thisNote = 0; thisNote < 1; thisNote++) {

     // to calculate the note duration, take one second
     // divided by the note type.
     //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    // int noteDuration = 100; 
     tone(8, NOTE_E3, noteDuration);

     //pause for the note's duration plus 30 ms:
     delay(noteDuration +30);
   
                                            
   } }}
 

Doglift 1.jpeg
Doglift 2.jpeg