start

Dependencies:   DRV88255 mbed

Committer:
BillyGrande
Date:
Tue Jun 27 21:13:09 2017 +0000
Revision:
2:5dd057d67746
Parent:
1:924bead61d21
start

Who changed what in which revision?

UserRevisionLine numberNew contents of line
BillyGrande 1:924bead61d21 1 #include "calibration.h"
BillyGrande 1:924bead61d21 2 #include "DRV8825.h"
BillyGrande 1:924bead61d21 3 #include "motors.h"
BillyGrande 1:924bead61d21 4
BillyGrande 1:924bead61d21 5 extern Serial pc;
BillyGrande 1:924bead61d21 6 extern DRV8825 stpr_mtr1;
BillyGrande 1:924bead61d21 7 extern DRV8825 stpr_mtr2;
BillyGrande 1:924bead61d21 8
BillyGrande 1:924bead61d21 9 void calibrate(char motor, char* direction){
BillyGrande 1:924bead61d21 10 int i,j, dir;
BillyGrande 1:924bead61d21 11 pc.printf("Direction = %s\n", (strcmp(direction,"left")==0)?"left":"right");
BillyGrande 1:924bead61d21 12 pc.printf("Motor = %c\n", motor=='a' ? 'a':'b');
BillyGrande 1:924bead61d21 13 if((strcmp(direction,"right")==0 && motor=='a') || (strcmp(direction,"left")==0 && motor=='b')) dir=1; else dir=0;
BillyGrande 1:924bead61d21 14 for(j=0; j<200; j++) { //500 rotations
BillyGrande 1:924bead61d21 15 for (i = 500; i < MAX_SPEED; i+=100) {
BillyGrande 1:924bead61d21 16 if (motor=='a') stpr_mtr1.settings(1, dir, i);
BillyGrande 1:924bead61d21 17 else stpr_mtr2.settings(1, dir, i);
BillyGrande 1:924bead61d21 18 }
BillyGrande 1:924bead61d21 19 }
BillyGrande 1:924bead61d21 20 }
BillyGrande 1:924bead61d21 21
BillyGrande 1:924bead61d21 22 void test_interrupts() {
BillyGrande 1:924bead61d21 23
BillyGrande 1:924bead61d21 24 }
BillyGrande 1:924bead61d21 25
BillyGrande 1:924bead61d21 26