源代码:
void hal_entry(void)
  • {
  •     /* TODO: add your own code here */
  •         int v;
  •        
  •           while(1)
  •                 {
  •                       for ( v = 60; v > 40 ; v-- )
  •      {
  •                   
  •                          
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI5, BSP_IO_LEVEL_HIGH);
  •                         R_BSP_SoftwareDelay(2,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI5, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(8,BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                                
  •         for ( v = 60; v > 40 ; v-- )
  •    {
  •                                           R_IOPORT_PinWrite (&g_ioport_ctrl, AI5, BSP_IO_LEVEL_HIGH);        
  •                         R_BSP_SoftwareDelay(1,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI5, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(19,BSP_DELAY_UNITS_MILLISECONDS);

  •    }
  • }
  • 复制代码
    AI5为设置的舵机端口号。

    用WCHLINK下载

    谢谢!
    下一篇继续