diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index b779795..8bd0b38 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -35,7 +35,8 @@ extern "C" { /* USER CODE BEGIN PD */ #define Print2UART1 int __io_putchar(int data) //float duty = 58.52 // (((2396*4096)*65534)/65534)*100 -int duty = 59; +//int duty = 59; +float duty = 58.52; /* USER CODE END PD */ @@ -116,11 +117,12 @@ main(void) HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, 100); - rawValue = HAL_ADC_GetValue(&hadc1); + rawValue = (float)HAL_ADC_GetValue(&hadc1); HAL_Delay(500); //volts = rawValue; // TODO change this to an actual conversion + volts = rawValue / duty; //printf("The value is %hu volts.\r\n", volts); printf("The value is %f volts.\r\n", volts); @@ -129,7 +131,6 @@ main(void) __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, duty); // TODO dude what is going on // rawValue/4096*65545 - HAL_Delay(100); /* USER CODE END WHILE */