First attempt at Milestone_1. Commit for progress information

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut DirectionPin1(D4);
00004 PwmOut PwmPin1(D5);
00005 DigitalOut DirectionPin2(D7);
00006 PwmOut PwmPin2(D6);
00007 
00008 
00009 
00010 int main()
00011 {
00012 PwmPin1.period_us(120); //60 microseconds pwm period, 16.7 kHz 
00013     for(;;)
00014     {
00015         float u = -0.4f; //determine useful value, this is not final
00016         DirectionPin1 = u > 0.0f; //either true or false
00017                     // True = CW, for False = CW
00018         PwmPin1 = fabs(u); //PWM duty cycle can only be positive, floating point absolute value
00019         
00020         float v = 0.5f;
00021         DirectionPin2 = v > 0.0f;
00022                     // FIXED! True = CCW, Flase = CW
00023         PwmPin2 = fabs(v);
00024     }
00025 }