Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Left-Right Game

Project Members: 
Andrew McDiarmid
k7lim

Description

Using two DC motors and a belt, we constructed a game to teach young children left and right. A Processing application sends a code to the belt to vibrate the left or right motor, then the player chooses which motor vibrated. The selectors are placed vertically on the screen so the only mapping is linguistic. Choosing correctly raises the score; incorrectly lowers it.

Components used

Arduino diecimila

Breadboard

Two DC motors

Two transistors

Two diodes

Two AA batteries

Hemp belt

Arduino code

/*
 * LRbelt
 * Andrew McDiarmid
 *
 * Receives a byte of serial data, either 'R' or 'L', ans spins
 * the appropriate motor on a belt worn by the user.
 *
 * Accompanying Processing code controls bytes sent to arduino
 */

int rightMotorPin = 6;
int leftMotorPin = 9;
char sideToVibrate;

void setup() {
  Serial.begin(9600);
  digitalWrite(rightMotorPin, LOW);
  digitalWrite(leftMotorPin, LOW);
  Serial.print("go");                                 //Tell Processing "I'm ready."
 
}
void loop() {
  if(!Serial.available()) {
    return;
  } else {
      sideToVibrate = (char) Serial.read();
  }
  if (sideToVibrate == 'R'){
    for (int i = 0; i < 256; i++){
      analogWrite(rightMotorPin, i);
      delay(10);
    }
      delay(100);
      digitalWrite(rightMotorPin, LOW);
  } else if (sideToVibrate == 'L'){
       for (int i = 0; i < 256; i++){
      analogWrite(leftMotorPin, i);
      delay(10);
       }
      delay(100);
      digitalWrite(leftMotorPin, LOW);
    } else {                                             //Gives a haptic error if a
    for (int i = 0; i < 3; i++){                    //char that's not 'L' or 'R'
      digitalWrite(rightMotorPin, HIGH);      //is received.
      digitalWrite(leftMotorPin, HIGH);
      delay(500);
      digitalWrite(rightMotorPin, LOW);
      digitalWrite(leftMotorPin, LOW);
      delay(500);
    }     
  }
}
 

Processing code

link

Photos

link


Comments

Comments from TAs

Good project -- and nice collaboration to make both of your motors vibrate together. I actually found playing your game in class to be quite engaging, and I already know my right from my left! You did a good job of making the play challenging and of making it difficult to guess what was going to come next.


Powered by Drupal - Design by Artinet