接上篇:【东芝步进电机驱动器】+游戏机器人控制(开源)1试用产品介绍

本篇主要是试验品搭建。如上方视频。

源代码:
int v;
  • R_BSP_PinAccessEnable();
  •     while(1) {
  •                        
  •                         for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •                          
  •         R_BSP_PinWrite(BSP_IO_PORT_01_PIN_13  , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_01_PIN_13   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(18, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •             R_BSP_PinWrite(BSP_IO_PORT_03_PIN_02   , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_03_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(19, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                                                        
  •                                
  •                                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •             R_BSP_PinWrite(BSP_IO_PORT_04_PIN_02   , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_04_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(19, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                                                        
  •                                
  •                                
  •                                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •         R_BSP_PinWrite(BSP_IO_PORT_01_PIN_02   , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_01_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(19, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  • ////                               
  •                          R_BSP_PinWrite( BSP_IO_PORT_03_PIN_03   , BSP_IO_LEVEL_LOW);
  •                                
  •        
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •         R_BSP_PinWrite(BSP_IO_PORT_01_PIN_13   , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_01_PIN_13   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(19, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                                
  •                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •                          
  •         R_BSP_PinWrite(BSP_IO_PORT_04_PIN_02  , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_04_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(18, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                                
  •                                
  •                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •                          
  •         R_BSP_PinWrite(BSP_IO_PORT_01_PIN_02  , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_01_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(18, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                     R_BSP_PinWrite(BSP_IO_PORT_03_PIN_03  , BSP_IO_LEVEL_HIGH);
  •      //   R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
  •                          
  •                
  •                                 for ( v = 80; v > 60 ; v-- )
  •      {
  •                   
  •                          
  •         R_BSP_PinWrite(BSP_IO_PORT_03_PIN_02  , BSP_IO_LEVEL_HIGH);
  •         R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MILLISECONDS);
  •                           R_BSP_PinWrite( BSP_IO_PORT_03_PIN_02   , BSP_IO_LEVEL_LOW);
  •         R_BSP_SoftwareDelay(18, BSP_DELAY_UNITS_MILLISECONDS);
  •         }
  •                  
  •                        
  • }
  •        
  •        
  • 复制代码
    代码添加到主函数中即可运行。
    东芝步进电机驱动器比较好上手,可以快速搭建出试验品,快速看到项目的可行性。