Recent Changes - Search:

ENTER NEW DAILY DATA HERE:

PmWiki

pmwiki.org

edit SideBar

ElmoSlaveHeaderFile

This is the most recent declareElmoSlavePins.h file as of 2.24.09

// declareElmoSlavePins.h

//THIS FILE DEFINES NAMES FOR ALL ARDUINO PINS TO MAKE THE ARDUINO CODE EASIER TO READ.

//NOTE: ARDUINO PINS ARE THE PIN NUMBERS USED IN THE ARDUINO CODE.
//THESE DO NOT MATCH THE ACTUAL PIN NUMBERS OF THE ATMEGA168 MICROCONTROLLER.
//SEE THE ElmoHack CIRCUIT SCHEMATIC FOR THE PIN MAPPING BETWEEN ARDUINO AND ATMEGA168.

//ARM SENSOR WIRING:
//Note, in each of the #defines below, the numbers in parentheses are the angles in degrees, as written on the sensors.
#define armReachBack 6 //brown wire is tied to pin 6, and goes low when arm is all the way back (-20 180+)
#define armUp 7 //red wire is tied to pin 7, and goes low when arm is pointing straight up (0 90~180)
#define armStraightAhead 8//yellow wire is tied to pin 8, and goes low when arm is pointing straight ahead (90 90)
#define armDown 9 //green wire is tied to pin 9, and goes low when is pointing straight down (150 0)
//orange wire from arm sensor is ground

//LEG SENSOR WIRING:
#define bodyBentMax 14 //blue wire is tied to pin 14, and goes low when the body is bent 135 degrees - maximum bend forward
#define bodyBent90 15 //green wire is tied to pin 15, and goes low when the body is bent exactly 90 degrees
#define bodyBentMin 16 //yellow wire is tied to pin 16, and goes low when the body is bent 30 degrees - minimum bend forward
#define bodyStraight 17 //orange wire is tied to pin 17, and goes low when the body is straight (no bend)
#define bodyKickedBack 18 //red wire is tied to pin 18, and goes low when the leg kicks back -30 degrees (this motion give Elmo momentum to stand)
//brown wire from leg sensor is ground

//ARM AND LEG MOTOR WIRING:
// (The L293 is a 16-pin IC that interfaces our microcontroller with Elmo's motors.
//  It is a push-pull, four-channel motor driver IC configured as two bridges each with an enable pin.
//  This is perfect for our application: independent control of two motors to spin either forward or reverse, with PWM speed control)
#define armSpeed 10 //Tie L293 pin 1 (enable for left bridge) to Arduino pin 10
#define armMotorPlus 2 //Tie L293 pin 2 (driver input for top of left bridge) to Arduino pin 2.
                       //Tie L293 pin 3 (driver output for top of left bridge) to Arm Motor + (green wire)
#define armMotorMinus 3 //Tie L293 pin 7 (driver input for bottom of left bridge) to Arduino pin 3.
                        //Tie L293 pin 6 (driver output for bottom of left bridge) to Arm Motor - (white wire)
#define legSpeed 11 //Tie L293 pin 9 (enable for right bridge) to Arduino pin 11
#define legMotorPlus 4 //Tie L293 pin 15 (driver input for top of right bridge) to Arduino pin 4.
                       //Tie L293 pin 14 (driver output for top of right bridge) to Leg Motor + (yellow wire)
#define legMotorMinus 5 //Tie L293 pin 10 (driver input for bottom of right bridge) to Arduino pin 5.
                        //Tie L293 pin 11 (driver output for bottom of right bridge) to Leg Motor - (brown wire)

//COMMANDS
#define forward 1
#define reverse 0
#define ELMO 2
#define ALL 199
#define MOVE 255
#define arm 10
#define body 20
#define shakeTheArm 30
#define shakeTheLeg 40
#define fall 50
#define stand 60

This declaration file must be included in your sketch for the Elmo Slave codes to work

// declareElmoSlavePins.h

//THIS FILE DEFINES NAMES FOR ALL ARDUINO PINS TO MAKE THE ARDUINO CODE EASIER TO READ.

//NOTE: ARDUINO PINS ARE THE PIN NUMBERS USED IN THE ARDUINO CODE.
//THESE DO NOT MATCH THE ACTUAL PIN NUMBERS OF THE ATMEGA168 MICROCONTROLLER.
//SEE THE ElmoHack CIRCUIT SCHEMATIC FOR THE PIN MAPPING BETWEEN ARDUINO AND ATMEGA168.

//ARM SENSOR WIRING:
//Note, in each of the #defines below, the numbers in parentheses are the angles in degrees, as written on the sensors.
#define armReachBack 6 //brown wire is tied to pin 6, and goes low when arm is all the way back (-20 180+)
#define armUp 7 //red wire is tied to pin 7, and goes low when arm is pointing straight up (0 90~180)
#define armStraightAhead 8//yellow wire is tied to pin 8, and goes low when arm is pointing straight ahead (90 90)
#define armDown 9 //green wire is tied to pin 9, and goes low when is pointing straight down (150 0)
//orange wire from arm sensor is ground

//LEG SENSOR WIRING:
#define bodyBentMax 14 //blue wire is tied to pin 14, and goes low when the body is bent 135 degrees - maximum bend forward
#define bodyBent90 15 //green wire is tied to pin 15, and goes low when the body is bent exactly 90 degrees
#define bodyBentMin 16 //yellow wire is tied to pin 16, and goes low when the body is bent 30 degrees - minimum bend forward
#define bodyStraight 17 //orange wire is tied to pin 17, and goes low when the body is straight (no bend)
#define bodyKickedBack 18 //red wire is tied to pin 18, and goes low when the leg kicks back -30 degrees (this motion give Elmo momentum to stand)
//brown wire from leg sensor is ground

//ARM AND LEG MOTOR WIRING:
// (The L293 is a 16-pin IC that interfaces our microcontroller with Elmo's motors.
//  It is a push-pull, four-channel motor driver IC configured as two bridges each with an enable pin.
//  This is perfect for our application: independent control of two motors to spin either forward or reverse, with PWM speed control)
#define armSpeed 10 //Tie L293 pin 1 (enable for left bridge) to Arduino pin 10
#define armMotorPlus 2 //Tie L293 pin 2 (driver input for top of left bridge) to Arduino pin 2.
                       //Tie L293 pin 3 (driver output for top of left bridge) to Arm Motor + (green wire)
#define armMotorMinus 3 //Tie L293 pin 7 (driver input for bottom of left bridge) to Arduino pin 3.
                        //Tie L293 pin 6 (driver output for bottom of left bridge) to Arm Motor - (white wire)
#define legSpeed 11 //Tie L293 pin 9 (enable for right bridge) to Arduino pin 11
#define legMotorPlus 4 //Tie L293 pin 15 (driver input for top of right bridge) to Arduino pin 4.
                       //Tie L293 pin 14 (driver output for top of right bridge) to Leg Motor + (yellow wire)
#define legMotorMinus 5 //Tie L293 pin 10 (driver input for bottom of right bridge) to Arduino pin 5.
                        //Tie L293 pin 11 (driver output for bottom of right bridge) to Leg Motor - (brown wire)
Edit - History - Print - Recent Changes - Search
Page last modified on February 24, 2009, at 10:21 AM