Page 178 - MDP2022-2
P. 178
int count = 0;
int tt[3] = { 100, 250, 400 };
tone_tick = HAL_GetTick();
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
htim3.Instance->ARR = (1000000 / tt[0]) - 1;
htim3.Instance->CCR1 = htim3.Instance->ARR / 2;
HAL_Delay(150);
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
htim3.Instance->ARR = (1000000 / tt[1]) - 1;
htim3.Instance->CCR1 = htim3.Instance->ARR / 2;
HAL_Delay(150);
htim3.Instance->ARR = (1000000 / tt[2]) - 1;
htim3.Instance->CCR1 = htim3.Instance->ARR / 2;
HAL_Delay(150);
htim3.Instance->ARR = (1000000 / 600) - 1;
htim3.Instance->CCR1 = htim3.Instance->ARR / 2;
HAL_Delay(150);
htim3.Instance->ARR = 0;
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
Wifi_RxClear();
sprintf(msg, "IOT INIT:%d%d%d%d%d", lingt_state, curtain_state, heating_pad, door_state, musi
c_state);
Wifi_SendString(msg);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1) {
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(DOOR_GPIO_Port, DOOR_Pin, door_state);
set_ledPattern1();
//set_led_pattern2();
buff = get_button();
if (buff == '*') {
if (strcmp(lock_num, insert_num) == 0) {