Dydaktyka

Dependencies:   FastPWM mbed-src

Fork of 2015_04_17_quadro_bez_sterowania by Quadrocopter

Committer:
Igor_W
Date:
Thu Dec 18 09:13:10 2014 +0000
Revision:
3:1425359662e4
Parent:
2:9e6ed6302c78
Child:
4:a5b51a651db7
hi

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:50d2b9c62765 1 #include "mbed.h"
Igor_W 3:1425359662e4 2 #include "FastPWM.h"
Igor_W 2:9e6ed6302c78 3 #define PWM_period 2500
Igor_W 2:9e6ed6302c78 4
Igor_W 2:9e6ed6302c78 5
Igor_W 2:9e6ed6302c78 6 int valPWM1 = 1000;
Igor_W 2:9e6ed6302c78 7 int valPWM2 = 1000;
Igor_W 2:9e6ed6302c78 8 int valPWM3 = 1000;
Igor_W 2:9e6ed6302c78 9 int valPWM4 = 1000;
Igor_W 2:9e6ed6302c78 10
Igor_W 3:1425359662e4 11 /*
Igor_W 2:9e6ed6302c78 12 PwmOut motor1 (D10);
Igor_W 2:9e6ed6302c78 13 PwmOut motor2 (D11);
Igor_W 2:9e6ed6302c78 14 PwmOut motor3 (D12);
Igor_W 2:9e6ed6302c78 15 PwmOut motor4 (D13);
Igor_W 3:1425359662e4 16 */
Igor_W 3:1425359662e4 17 FastPWM motor1(D10);
mbedAustin 1:5160ea45399b 18
mbed_official 0:50d2b9c62765 19 int main() {
Igor_W 2:9e6ed6302c78 20
Igor_W 3:1425359662e4 21
Igor_W 3:1425359662e4 22
Igor_W 3:1425359662e4 23 motor1.period(PWM_period);
Igor_W 3:1425359662e4 24 motor1.pulsewidth(valPWM1);
Igor_W 3:1425359662e4 25
Igor_W 3:1425359662e4 26 /* motor1.period_us(PWM_period);
Igor_W 2:9e6ed6302c78 27 motor2.period_us(PWM_period);
Igor_W 2:9e6ed6302c78 28 motor3.period_us(PWM_period);
Igor_W 2:9e6ed6302c78 29 motor4.period_us(PWM_period);
Igor_W 3:1425359662e4 30 */
Igor_W 2:9e6ed6302c78 31 while(1) {
Igor_W 2:9e6ed6302c78 32
Igor_W 3:1425359662e4 33 /* for (int i = 1000; i < 1500;i++)
Igor_W 2:9e6ed6302c78 34 {
Igor_W 2:9e6ed6302c78 35
Igor_W 2:9e6ed6302c78 36 valPWM1 = i;
Igor_W 2:9e6ed6302c78 37 valPWM3 = i;
Igor_W 2:9e6ed6302c78 38 valPWM2 = 2500 - i;
Igor_W 2:9e6ed6302c78 39 valPWM4 = 2500 - i;
Igor_W 2:9e6ed6302c78 40
Igor_W 2:9e6ed6302c78 41 motor1.pulsewidth_ms(valPWM1);
Igor_W 2:9e6ed6302c78 42 motor2.pulsewidth_ms(valPWM2);
Igor_W 2:9e6ed6302c78 43 motor3.pulsewidth_ms(valPWM3);
Igor_W 2:9e6ed6302c78 44 motor4.pulsewidth_ms(valPWM4);
Igor_W 3:1425359662e4 45 }*/
Igor_W 2:9e6ed6302c78 46
Igor_W 2:9e6ed6302c78 47 }
mbed_official 0:50d2b9c62765 48 }