![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First attempt at Milestone_1. Commit for progress information
Revision 0:7fd3327ceec4, committed 2018-09-28
- Comitter:
- ThomBMT
- Date:
- Fri Sep 28 13:43:53 2018 +0000
- Commit message:
- This is the first version of Milestone_1. We are able to control the direction of rotation of both motors individualy. However we do not fully understand how we can edit the rotationfreq. or the dutycycles of both motors
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 28 13:43:53 2018 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +DigitalOut DirectionPin1(D4); +PwmOut PwmPin1(D5); +DigitalOut DirectionPin2(D7); +PwmOut PwmPin2(D6); + + + +int main() +{ +PwmPin1.period_us(120); //60 microseconds pwm period, 16.7 kHz + for(;;) + { + float u = -0.4f; //determine useful value, this is not final + DirectionPin1 = u > 0.0f; //either true or false + // True = CW, for False = CW + PwmPin1 = fabs(u); //PWM duty cycle can only be positive, floating point absolute value + + float v = 0.5f; + DirectionPin2 = v > 0.0f; + // FIXED! True = CCW, Flase = CW + PwmPin2 = fabs(v); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 28 13:43:53 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file