![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Starter code for brushless motor controller
Diff: main.cpp
- Revision:
- 12:6ad981ef8cc9
- Parent:
- 11:5ff18183764a
--- a/main.cpp Wed Feb 19 21:01:00 2020 +0000 +++ b/main.cpp Sun Feb 23 14:55:44 2020 +0000 @@ -126,15 +126,12 @@ pc.printf("Rotor origin: %x\n\r",orState); //orState is subtracted from future rotor state inputs to align rotor and motor states - MotorPWM.pulsewidth_us(PWM_PRD/2); //Poll the rotor state and set the motor outputs accordingly to spin the motor while (1) { intState = readRotorState(); if (intState != intStateOld) { motorOut((intState-orState+lead+6)%6); //+6 to make sure the remainder is positive - if (intState == 4 && intStateOld == 3) TP1 = !TP1; intStateOld = intState; - pc.printf("%d\n\r",intState); } } }