Dydaktyka
Dependencies: FastPWM mbed-src
Fork of 2015_04_17_quadro_bez_sterowania by
main.cpp
- Committer:
- Igor_W
- Date:
- 2014-12-17
- Revision:
- 2:9e6ed6302c78
- Parent:
- 1:5160ea45399b
- Child:
- 3:1425359662e4
File content as of revision 2:9e6ed6302c78:
#include "mbed.h" #define PWM_period 2500 int valPWM1 = 1000; int valPWM2 = 1000; int valPWM3 = 1000; int valPWM4 = 1000; PwmOut motor1 (D10); PwmOut motor2 (D11); PwmOut motor3 (D12); PwmOut motor4 (D13); int main() { motor1.period_us(PWM_period); motor2.period_us(PWM_period); motor3.period_us(PWM_period); motor4.period_us(PWM_period); while(1) { for (int i = 1000; i < 1500;i++) { valPWM1 = i; valPWM3 = i; valPWM2 = 2500 - i; valPWM4 = 2500 - i; motor1.pulsewidth_ms(valPWM1); motor2.pulsewidth_ms(valPWM2); motor3.pulsewidth_ms(valPWM3); motor4.pulsewidth_ms(valPWM4); } } }