Monday, January 12, 2009

Motor Update and Videos

So I managed to get both motors to work! Turns out with the digital write, the setup did matter, and we had to specify the left and right motors. However, with the analog setup, we did not have to specify; for the Arduino Pro/Blimpduino board, port 3 and 5 are pre-programmed as analog. Anyways, here's the code for an analog program I had the motor do. It amps up the motor over 10 seconds from 0 to full, holds for half a second, then cranks it back down to zero and holds again.

int rightmotor1 = 2;
int rightmotor2 = 3;
int leftmotor1 = 5;
int leftmotor2 = 4;

void setup()
{
pinMode(rightmotor1, OUTPUT);
pinMode(leftmotor2, OUTPUT);
digitalWrite(rightmotor1, LOW);
digitalWrite(leftmotor2, LOW);
}


void loop()
{
int i;
int j;
for(i=0; i<=255; i++)
{
analogWrite(rightmotor2, i);
analogWrite(leftmotor1, i);
delay(45);
}
analogWrite(rightmotor2, 255);
analogWrite(leftmotor1, 255);
delay(500);
for(j=255; j>=0; j--)
{
analogWrite(rightmotor2, j);
analogWrite(leftmotor1, j);
delay(45);
}
analogWrite(rightmotor2, 0);
analogWrite(leftmotor1, 0);

delay(2000);
}

I noticed some funny things. After three or four runs going from zero to full to back, the fans would stop following the program. I could audibly here it click and restart from the beginning. I turned the chip off, waited a minute, then restarted. It ran the program once, got almost through the second run and then clicked off and reset itself. I'm thinking possible over heating? Not too sure. I don't think we'll be able to run it at full blast all the time. Also, I noticed thats the motor starts, it stalls and does not move even though I can hear the motor whining. I am thinking that there is initial static friction that causes it not to open, or the current is too weak to trip the motor.

Videos will be uploaded momentarily

No comments:

Post a Comment