diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index 5c2a04a..917678a 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -56,7 +56,7 @@ UART_HandleTypeDef huart1; uint16_t rawValue; float val; float volts; -float duty; +uint16_t duty; /* * We are going to set this value repeatedly as such: * CCR @@ -142,11 +142,14 @@ main(void) //HAL_Delay(500); //duty = (((float)rawValue / 4096) * 65534); - duty = (val/4096)*65534; - printf("Duty: %f\r\n", duty); - + //duty = (val/4096)*65534; + duty = rawValue * 16; __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, duty); + //duty = (duty/65534) * 100; + //printf("Duty: %f%c\r\n", duty, 37); + printf("Duty: %hu%c\r\n", duty, 37); + //printf("\r\n"); HAL_Delay(1000);