| | |
| | | /* USER CODE END Header */ |
| | | /* Includes ------------------------------------------------------------------*/ |
| | | #include "main.h" |
| | | #include "adc.h" |
| | | #include "usart.h" |
| | | #include "gpio.h" |
| | | |
| | | /* Private includes ----------------------------------------------------------*/ |
| | |
| | | { |
| | | |
| | | /* USER CODE BEGIN 1 */ |
| | | |
| | | uint32_t lux, noisy; |
| | | /* USER CODE END 1 */ |
| | | |
| | | /* MCU Configuration--------------------------------------------------------*/ |
| | |
| | | |
| | | /* Initialize all configured peripherals */ |
| | | MX_GPIO_Init(); |
| | | MX_USART1_UART_Init(); |
| | | MX_ADC1_Init(); |
| | | /* USER CODE BEGIN 2 */ |
| | | |
| | | init_relay(); |
| | | init_led(); |
| | | |
| | |
| | | /* USER CODE BEGIN WHILE */ |
| | | while (1) |
| | | { |
| | | /* Blink Red Led */ |
| | | turn_led(Led_R, ON); |
| | | HAL_Delay(200); |
| | | turn_led(Led_R, OFF); |
| | | HAL_Delay(200); |
| | | adc_sample_lux_noisy(&lux, &noisy); |
| | | printf("Lux:%lu Noisy:%lu\r\n", lux, noisy); |
| | | |
| | | /* Blink Green Led */ |
| | | toggle_led(Led_G); |
| | | HAL_Delay(200); |
| | | toggle_led(Led_G); |
| | | HAL_Delay(200); |
| | | |
| | | /* Blink Blue Led */ |
| | | blink_led(Led_B, 200); |
| | | HAL_Delay(5000); |
| | | |
| | | /* USER CODE END WHILE */ |
| | | |