接上一篇:【瑞萨 RA6E2】+机械臂游戏(原创)1-数字舵机
我在其他论坛的网名叫"jf_39110170"
源代码:

  • 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, AI6, BSP_IO_LEVEL_HIGH);        
  •                         R_BSP_SoftwareDelay(1,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI6, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(19,BSP_DELAY_UNITS_MILLISECONDS);
  •                   

  •         }
  •                  
  •                                 
  •                         
  •                       for ( v = 60; v > 40 ; v-- )
  •      {
  •                   
  •                         
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI1, BSP_IO_LEVEL_HIGH);
  •                         R_BSP_SoftwareDelay(2,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI1, 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);
  •                   

  •         }        
  •                                 
  •                                 
  •                                 
  •                                 
  •                                  for ( v = 60; v > 40 ; v-- )
  •      {
  •                   
  •                         
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI8, BSP_IO_LEVEL_HIGH);
  •                         R_BSP_SoftwareDelay(2,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI8, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(8,BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                                 
  •         for ( v = 60; v > 40 ; v-- )
  •      {
  •                                           R_IOPORT_PinWrite (&g_ioport_ctrl, AI1, BSP_IO_LEVEL_HIGH);        
  •                         R_BSP_SoftwareDelay(1,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI1, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(19,BSP_DELAY_UNITS_MILLISECONDS);
  •                   

  •         }
  •                  
  •                                 
  •                         
  •                       for ( v = 60; v > 40 ; v-- )
  •      {
  •                   
  •                         
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI6, BSP_IO_LEVEL_HIGH);
  •                         R_BSP_SoftwareDelay(2,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI6, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(8,BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                                 
  •         for ( v = 60; v > 40 ; v-- )
  •      {
  •                                           R_IOPORT_PinWrite (&g_ioport_ctrl, AI8, BSP_IO_LEVEL_HIGH);        
  •                         R_BSP_SoftwareDelay(1,BSP_DELAY_UNITS_MILLISECONDS);
  •                         R_IOPORT_PinWrite (&g_ioport_ctrl, AI8, BSP_IO_LEVEL_LOW);
  •                         R_BSP_SoftwareDelay(19,BSP_DELAY_UNITS_MILLISECONDS);
  •                   

  •         }        
  • 复制代码
    下一篇插入游戏功能。