Balancing Bot using MAX32630FTHR
Dependencies: mbed BMI160 SDFileSystem max32630fthr
Revision 14:3ffd5961aa8e, committed 2018-12-04
- Comitter:
- Normanski
- Date:
- Tue Dec 04 09:49:00 2018 +0000
- Parent:
- 13:40631fdbece2
- Commit message:
- Initial
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 40631fdbece2 -r 3ffd5961aa8e main.cpp --- a/main.cpp Mon Feb 06 20:38:25 2017 +0000 +++ b/main.cpp Tue Dec 04 09:49:00 2018 +0000 @@ -126,6 +126,40 @@ MAX32630FTHR pegasus; pegasus.init(MAX32630FTHR::VIO_3V3); + /* + * Do motor driver testing here. + * P4_0 = FWD1(Logic_LvL) + * P5_6 = REV1(Logic_LvL) + * P5_5 = FWD2(Logic_Lvl) + * P5_4 = REV2(Logic_Lvl) + * Logic Table: + * OpMode: FWD (M1=VDD, M2=GND) + * - FWD# = 1 + * - REV# = 0 + * - bEN = 0 + * OpMode: REV (M1=GND, M2=VDD) + * - FWD# = 0 + * - REV# = 1 + * - bEN = 0 + * OpMode: BREAK (M1=GND, M2=GND) + * - FWD# = 0 + * - REV# = 0 + * - bEN = 0 + */ + DigitalOut FWD1(P4_0, 0); + DigitalOut REV1(P5_6, 0); + DigitalOut FWD2(P5_5, 0); + DigitalOut REV2(P5_4, 0); + + FWD1 = 0; + REV1 = 0; + FWD2=0; + REV2=0; + while(1) + { + + } + /*************************************/ static const float MAX_PULSEWIDTH_US = 40.0F; static const float MIN_PULSEWIDTH_US = -40.0F; @@ -265,6 +299,7 @@ if(failures == 0) { + printf("I got through! :)"); printf("ACC Range = %d\n", accConfig.range); printf("ACC UnderSampling = %d\n", accConfig.us); printf("ACC BandWidthParam = %d\n", accConfig.bwp); @@ -429,6 +464,7 @@ //based on sign of error signal (negation of pitch since setPoint = 0) if(pulseWidth > MAX_PULSEWIDTH_US) { + rightDir = FORWARD; leftDir = FORWARD; pulseWidth = 40.0F; @@ -510,6 +546,7 @@ { while(1) { + printf("I'M STUCKED!"); rLED = !rLED; wait(0.25); }