Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
calibration.cpp
- Committer:
- BillyGrande
- Date:
- 2017-06-27
- Revision:
- 1:924bead61d21
File content as of revision 1:924bead61d21:
#include "calibration.h"
#include "DRV8825.h"
#include "motors.h"
extern Serial pc;
extern DRV8825 stpr_mtr1;
extern DRV8825 stpr_mtr2;
void calibrate(char motor, char* direction){
int i,j, dir;
pc.printf("Direction = %s\n", (strcmp(direction,"left")==0)?"left":"right");
pc.printf("Motor = %c\n", motor=='a' ? 'a':'b');
if((strcmp(direction,"right")==0 && motor=='a') || (strcmp(direction,"left")==0 && motor=='b')) dir=1; else dir=0;
for(j=0; j<200; j++) { //500 rotations
for (i = 500; i < MAX_SPEED; i+=100) {
if (motor=='a') stpr_mtr1.settings(1, dir, i);
else stpr_mtr2.settings(1, dir, i);
}
}
}
void test_interrupts() {
}