Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //W mainie po TIM1_INIT
- HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
- TIM_OC_InitTypeDef sConfigOC;
- sConfigOC.OCMode = TIM_OCMODE_PWM1;
- htim1.Instance->CCR1 = 0;
- sConfigOC.Pulse = pulse;
- sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
- sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
- //w while
- else if (strcmp(payload, "pulse") == 0) {
- Tx_Send("Pulse\r\n");
- while(USART_linia(payload) == 0){
- for (pulse = 0; pulse < 31999; pulse += 50) {
- stan = 1;
- while (stan) {
- if (czasUplyniety > 20) {
- __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, pulse);
- czasUplyniety = 0;
- stan = 0;
- }
- }
- }
- mig=31999;
- for (pulse = 0; pulse < 31999; pulse += 50) {
- stan1 = 1;
- while (stan1) {
- if (czasUplyniety > 20) {
- __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, mig);
- czasUplyniety = 0;
- stan1 = 0;
- }
- }
- mig-=50;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement