Water control / Mbed 2 deprecated Water_pump

Dependencies:   DRV88255 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers calibration.cpp Source File

calibration.cpp

00001 #include "calibration.h"
00002 #include "DRV8825.h"
00003 #include "motors.h"
00004  
00005 extern Serial pc;
00006 extern DRV8825 stpr_mtr1;
00007 extern DRV8825 stpr_mtr2;
00008  
00009 void calibrate(char motor, char* direction){
00010     int i,j, dir;
00011     pc.printf("Direction = %s\n", (strcmp(direction,"left")==0)?"left":"right");
00012     pc.printf("Motor = %c\n", motor=='a' ? 'a':'b');
00013     if((strcmp(direction,"right")==0 && motor=='a') || (strcmp(direction,"left")==0 && motor=='b')) dir=1; else dir=0;
00014     for(j=0; j<200; j++) {                           //500 rotations
00015         for (i = 500; i < MAX_SPEED; i+=100) {
00016             if (motor=='a') stpr_mtr1.settings(1, dir, i);
00017             else stpr_mtr2.settings(1, dir, i);
00018         }
00019     }
00020 }
00021  
00022 void test_interrupts() {
00023     
00024 }
00025  
00026