Nucleo-L476RG DAC

	/* USER CODE BEGIN 2 */
	HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
	uint32_t x = 0;
	/* USER CODE END 2 */

	/* Infinite loop */
	/* USER CODE BEGIN WHILE */
	while (1) {
		/* USER CODE END WHILE */

		/* USER CODE BEGIN 3 */
		HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, x);
		HAL_Delay(100);
		x+=100;
		if (x == 1000) {
			x = 0;
		}
	}
	/* USER CODE END 3 */

Leave a Reply

Your email address will not be published. Required fields are marked *