Wednesday, July 30, 2008

Source code for evil teddy

#include <Wire.h>
#include <nunchuck_funcs.h>
#include <AFMotor.h>

AF_DCMotor armNeckMotor2(3, MOTOR12_64KHZ);
AF_DCMotor armNeckMotor1(2, MOTOR12_64KHZ);
AF_DCMotor eyesMouthMotor(1, MOTOR12_64KHZ);

int loop_cnt = 0;
float accelx,accely,accelz,joyx,joyy;
byte zbut,cbut;
int speakerPin = 2;
int lightPin = 14;

//These are to detect if buttons are pressed in rapid succession
int sequenceCount1 = 0;
int start1 = false;


void setup() {

Serial.begin(9600);

nunchuck_init_with_power();

eyesMouthMotor.setSpeed(200);
armNeckMotor1.setSpeed(200);
armNeckMotor2.setSpeed(200);

pinMode(speakerPin,OUTPUT);
pinMode(lightPin,OUTPUT);
}

void special()
{

digitalWrite(speakerPin, HIGH);
delay(50);
digitalWrite(speakerPin,LOW);

digitalWrite(lightPin,HIGH);

for (int i = 0; i < 15; i++)
{

eyesMouthMotor.run(BACKWARD);
delay(random(150,250));
eyesMouthMotor.run(FORWARD);
delay(random(75,125));
eyesMouthMotor.run(RELEASE);

}
delay(1000);
digitalWrite(lightPin,LOW);
}

void startTimer()
{
start1 = true;
sequenceCount1 = 0;
}

void stopTimer()
{
start1 = false;
sequenceCount1 = 0;
}


void loop() {
if (loop_cnt>100)
{
if (start1==true)
{
sequenceCount1++;

}

if (sequenceCount1>5)
{
stopTimer();
}

loop_cnt=0;

nunchuck_get_data();

accelx = nunchuck_accelx(); // ranges from approx 70 - 182


accely = nunchuck_accely(); // ranges from approx 65 - 173


accelz = nunchuck_accelz();

// 1 pressed, 0 free
zbut = nunchuck_zbutton();

// 1 pressed, 0 free
cbut = nunchuck_cbutton();

// 23<--125-->227
joyx = nunchuck_joyx();


// 227
// ^
//130
// v
//31
joyy = nunchuck_joyy();

if (cbut)
{
eyesMouthMotor.run(FORWARD);

startTimer();
}
else
{
eyesMouthMotor.run(RELEASE);
}
if (zbut)
{


if (sequenceCount1 > 1 && sequenceCount1 < 5)
{
special();
stopTimer();
}
else
{
eyesMouthMotor.run(BACKWARD);
delay(150);
eyesMouthMotor.run(FORWARD);
}
}

if (joyx>150 || joyx<100)
{

if (joyx>150)
{

armNeckMotor1.run(BACKWARD);

}
else
{
armNeckMotor1.run(RELEASE);
}


if (joyx<100)
{

armNeckMotor2.run(BACKWARD);

}
else
{
armNeckMotor2.run(RELEASE);
}

}
else if (joyy>150)
{


armNeckMotor1.run(BACKWARD);
armNeckMotor2.run(BACKWARD);

}
else if (accelx>160)
{
armNeckMotor1.run(FORWARD);
}
else if (accely>160)
{
armNeckMotor2.run(FORWARD);
}
else
{
armNeckMotor1.run(RELEASE);
armNeckMotor2.run(RELEASE);
}

//Serial.println(accelx,DEC);
//Serial.println(accely,DEC);
// Serial.println(accelz,DEC);
// Serial.println(joyx,DEC);
// Serial.println(joyy,DEC);
// Serial.println(zbut,DEC);
// Serial.println(cbut,DEC);


}
loop_cnt++;
delay(1);
}

Tuesday, July 29, 2008

It speaks!



I'll post as many details of the process as I can in the next few days. First, the list of parts (not including wiring, solder, etc...):

Arduino Diecimila
Adafruit Motor Shield
Wiichuck adapter
BJ Bearytales (Also available in the 9th circle of hell if Toy's R Us is out)
Wiichuck
Voice Recording Module

And other assorted accessories...

Monday, July 28, 2008

Evil Teddy is ALIVE!

BJ Bearytales + Arduino + Adafruit Motor Shield (which is fantastic, btw) + wiichuck = pure evil.

Tuesday, July 22, 2008

Braaaaaiiiiinnnns!

Evil robot teddy has had his brain removed. Next steps are to throw away the brain and create some motor controllers.

Teddy Brains

Teddy Brains

Friday, July 18, 2008

Public Service Announcement

If you don't want to have nightmares, then you should skin kids' toys alive.

Monday, July 14, 2008

no title necessary

"So I don't know about bores. Maybe you shouldn't feel too sorry if you see some swell girl getting married to them. They don't hurt anybody, most of them, and maybe they're secretly all terrific whistlers or something. Who the hell knows? Not me."
What I was Doing Ten Years Ago
Summer of '98... ask another time...

Five Snacks I Enjoy
1. Bread
2. Dark bitter chocolate
3. soynuts
4. cheese
5. popcorn

Five Things On My To-do List Today
1. work on the presentation for DC
2. work on the penta slides
3. call the insurance company
4. fill out reimbursement forms
5. go to the bank

(I accomplished exactly one of these today)


Five Favorite Recipes
1. popcorn
2. i don't cook


Five Jobs I’ve Had
1. paperboy
2. petsmart cashier/dog shit cleaner-upper
3. lowes cashier
4. data clerk
5. computer administrator
6. math teacher
7. mathematician


Five Bad Habits
1. beer
2. scotch
3. wine
4. sleep
5. but, god dammit, not cigarettes


All The Places I’ve Lived
1. Houston
2. Plano
3. Sherman
4. Lubbock
5. Wilmington
6. Somerville


Five Random Things About Me
1. i don't like the use of the word "random" when whats really meant is "offbeat" or "strange"
2. i considered a career as a blackula, but decided against it
3. clowns scare me
4. i often wonder what it would taste like to cut off my pinky finger and saute it in butter
5. i once pooped out a perfectly undigested cheerio.


Five People I’m Tagging
0. This vicious cycle stops with me

Sunday, July 13, 2008

Rogue Chipotle Ale

Here.

After trying it last night, I can't say that I liked it too much. The smokey flavor and the capsaicin-induced tingly lips were interesting, but I think I'm going to have to pass on this one in the future.