Page 325 - MDP2022-2
P. 325

*  @retval  int
                */
            int  main(void)
            {
                /*  USER  CODE  BEGIN  1  */
                  HAL_GPIO_WritePin(GPIOA,  GPIO_PIN_6,  GPIO_PIN_RESET);
                  HAL_GPIO_WritePin(GPIOA,  GPIO_PIN_7,  GPIO_PIN_RESET);
                  HAL_GPIO_WritePin(GPIOA,  GPIO_PIN_9,  GPIO_PIN_SET);                  //motor  disable  pin.  but
            don't  use
                  HAL_GPIO_WritePin(GPIOA,  GPIO_PIN_10,  GPIO_PIN_RESET);
                /*  USER  CODE  END  1  */


                /*  MCU  Configuration--------------------------------------------------------*/


                /*  Reset  of  all  peripherals,  Initializes  the  Flash  interface  and  the  Systick.  */
                HAL_Init();


                /*  USER  CODE  BEGIN  Init  */


                /*  USER  CODE  END  Init  */


                /*  Configure  the  system  clock  */
                SystemClock_Config();


                /*  USER  CODE  BEGIN  SysInit  */


                /*  USER  CODE  END  SysInit  */


                /*  Initialize  all  configured  peripherals  */
                MX_GPIO_Init();
                /*  USER  CODE  BEGIN  2  */
                  HAL_GPIO_WritePin(GPIOC,  GPIO_PIN_8,  GPIO_PIN_SET);
                /*  USER  CODE  END  2  */

                /*  Infinite  loop  */
                /*  USER  CODE  BEGIN  WHILE  */
                while  (1)
                {
                        //*******************************************gimoring

                  if(togglePIN  ==  0  &&  count  ==  0  &&  HAL_GPIO_ReadPin(GPIOC  ,  GPIO_PIN_6)  ==
            GPIO_PIN_SET){      //GPIOC  pin6  ==  arduino's  STM  start  signal
                              start=1;                  //motor  start  flag
                        togglePIN=1;
                        }else  if(togglePIN  ==  1  &&  count  ==  50  &&  HAL_GPIO_ReadPin(GPIOC  ,  GPIO_PIN_6)  ==
   320   321   322   323   324   325   326   327   328   329   330