Page 180 - MDP2022-2
P. 180
} else if (motor_state == 2) {
HAL_GPIO_WritePin(MOTOR_1_GPIO_Port, MOTOR_1_Pin, 0);
HAL_GPIO_WritePin(MOTOR_2_GPIO_Port, MOTOR_2_Pin, 1);
HAL_Delay(2200);
motor_state = 0;
}
if (Wifi.usartBuff == 'a') {
Wifi_SendString("led ON\r\n");
HAL_GPIO_WritePin(LIGHT_1_GPIO_Port, LIGHT_1_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LIGHT_2_GPIO_Port, LIGHT_2_Pin, GPIO_PIN_SET);
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'A') {
Wifi_SendString("led OFFr\n");
HAL_GPIO_WritePin(LIGHT_1_GPIO_Port, LIGHT_1_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LIGHT_2_GPIO_Port, LIGHT_2_Pin, GPIO_PIN_RESET);
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'b') {
Wifi_SendString("curtain ON\r\n");
motor_state = 1;
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'B') {
Wifi_SendString("curtain OFF\r\n");
motor_state = 2;
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'c') {
Wifi_SendString("heating_pad ON\r\n");
HAL_GPIO_WritePin(BLANKET_GPIO_Port, BLANKET_Pin, SET);
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'C') {
Wifi_SendString("heating_pad OFF\r\n");
HAL_GPIO_WritePin(BLANKET_GPIO_Port, BLANKET_Pin, RESET);
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'd') {
Wifi_SendString("door ON\r\n");
door_state = 1;
Wifi.usartBuff = 0;
HAL_UART_Receive_IT(&_WIFI_USART, &Wifi.usartBuff, 1);
} else if (Wifi.usartBuff == 'D') {