You can see from the pics I was just using the 5v from the uno to push the motor at this point. It did work, just no torque. I'll throw up some pics of the abortion that I have now whenever my new microcontroller gets here. Here's the sketch.
/* BLDC Driver
*/
int drivePin1 = 9; //set the pin numbers for coils
int drivePin2 = 10;
int drivePin3 = 11;
int delayTime = 90; //Pulse timing will replace with adjustable pwm
void setup(){
pinMode(drivePin1, OUTPUT);
pinMode(drivePin2, OUTPUT);
pinMode(drivePin3, OUTPUT);
}
void loop(){
for (int delayTime = 90; delayTime > 40; delayTime = delayTime - 1){
digitalWrite(drivePin1, HIGH);
digitalWrite(drivePin3, LOW);
delay(delayTime);
digitalWrite(drivePin2, HIGH);
digitalWrite(drivePin1, LOW);
delay(delayTime);
digitalWrite(drivePin3, HIGH);
digitalWrite(drivePin2, LOW);
delay(delayTime);
}
while (delayTime = 40){
digitalWrite(drivePin1, HIGH);
digitalWrite(drivePin3, LOW);
delay(delayTime);
digitalWrite(drivePin2, HIGH);
digitalWrite(drivePin1, LOW);
delay(delayTime);
digitalWrite(drivePin3, HIGH);
digitalWrite(drivePin2, LOW);
delay(delayTime);
}}
No comments:
Post a Comment