Page 568 - MDP2020-1
P. 568

|    인천전자마이스터고등학교  ·············································································································
            562

            버튼  누르면    on
                                            motor_flag  =  1;
                            }



                            if(motor_flag  ==  1)  {
                                    motor_count++;


                                    if(motor_count  ==  4*10000)  {//1초  정방향

                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_14,GPIO_PIN_SET);
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_13,GPIO_PIN_RESET);
                                                    }
                                    if(motor_count  ==  10*10000)  {//2초  정지
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_13,GPIO_PIN_SET);
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_14,GPIO_PIN_RESET);

                                                    }
                                    if(motor_count  ==  30*10000)  {//5초  역방향
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_14,GPIO_PIN_SET);
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_15,GPIO_PIN_RESET);

                                                    }
                                    if(motor_count  ==  36*10000)  {//2초  정지
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_15,GPIO_PIN_SET);
                                      HAL_GPIO_WritePin(GPIOB,  GPIO_PIN_14,GPIO_PIN_RESET);
                                      motor_count  =  0;
                                      motor_flag  =  0;

                                    }
                            }
                    }
            }
            /*  USER  CODE  END  4  */
   563   564   565   566   567   568   569   570   571   572   573