Add cylinder control and material 1 picking function: 1. Add PG8 pin for cylinder control (close=1, open=0) 2. Fix material positions distances 3. Fix material 3 direction (right) 4. Add Machine_PickMaterial1() function 5. Auto execute picking after reaching center in main.c
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "machine.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -101,9 +101,14 @@ int main(void)
|
||||
/* Power-on initialization: Move stepper motor to origin from any position */
|
||||
if (Machine_MoveToOrigin() == 0)
|
||||
{
|
||||
/* 成功到达原点,移动到中心点(中心点就是原点位置) */
|
||||
/* Successfully reached origin, move to center (center is the origin position) */
|
||||
Machine_MoveToCenter();
|
||||
/* 成功到达原点,移动到中心点 */
|
||||
/* Successfully reached origin, move to center */
|
||||
if (Machine_MoveToCenter() == 0)
|
||||
{
|
||||
/* 成功到达中心点,执行1#料取料流程 */
|
||||
/* Successfully reached center, execute material 1 picking process */
|
||||
Machine_PickMaterial1();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -224,6 +229,9 @@ static void MX_GPIO_Init(void)
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_8, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : PD7 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
@@ -238,6 +246,13 @@ static void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PG8 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PG15 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
|
||||
Reference in New Issue
Block a user