Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void swiec(void);
- /* USER CODE END 0 */
- short int tab[2];
- int main(void)
- {
- /* USER CODE BEGIN 1 */
- /* USER CODE END 1 */
- /* MCU Configuration----------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
- /* USER CODE BEGIN Init */
- /* USER CODE END Init */
- /* Configure the system clock */
- SystemClock_Config();
- /* USER CODE BEGIN SysInit */
- /* USER CODE END SysInit */
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_DMA_Init();
- MX_ADC_Init();
- /* USER CODE BEGIN 2 */
- HAL_ADC_Start_DMA (&hadc,(uint32_t*)&tab,2);
- /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- //swiec();
- /* USER CODE END 3 */
- }
- }
- void swiec(void) {
- if (tab[0] > tab[1]) {
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_SET);
- HAL_Delay(200);
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);
- HAL_Delay(200);
- }
- else {
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET);
- HAL_Delay(200);
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
- HAL_Delay(200);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement