Untitled
unknown
plain_text
a month ago
1.3 kB
2
Indexable
Never
if(htim == &htim6)//bate { if(battery <= 14 && battery > 0) { battery -= 1; sprintf(msg,"current battery : %d\r\n",battery); HAL_UART_Transmit(&huart3,(uint8_t*)msg,strlen(msg),HAL_MAX_DELAY); if(battery >= 12) { HAL_GPIO_WritePin(GPIOA,GPIO_PIN_6,SET); HAL_UART_Transmit(&huart3,tx1,sizeof(tx1),HAL_MAX_DELAY); } else if(battery < 12 && battery >= 10) { HAL_GPIO_WritePin(GPIOA,GPIO_PIN_13,SET); HAL_UART_Transmit(&huart3,tx2,sizeof(tx2),HAL_MAX_DELAY); } else if(battery <= 7 && battery > 10) { HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2,SET); HAL_UART_Transmit(&huart3,tx4,sizeof(tx4),HAL_MAX_DELAY); } else if(battery < 7 && z!=1) { HAL_UART_Transmit(&huart3,tx6,sizeof(tx6),HAL_MAX_DELAY); if(HAL_UART_Receive(&huart3,&ch,sizeof(ch),HAL_MAX_DELAY)==HAL_OK) { switch(ch) { case 'R': HAL_UART_Transmit(&huart3,tx7,sizeof(tx7),HAL_MAX_DELAY); battery = 13; break; case 'P': HAL_UART_Transmit(&huart3,tx8,sizeof(tx8),HAL_MAX_DELAY); battery = 12; break; case 'N': HAL_UART_Transmit(&huart3,tx9,sizeof(tx9),HAL_MAX_DELAY); z=1; } } } } }
Leave a Comment