CzarnyBarszcz

ADC _potencjometr

Jan 24th, 2022
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. /* USER CODE BEGIN PV */
  2. char msg[10];
  3. uint16_t raw;
  4. /* USER CODE END PV */
  5.  
  6. ...
  7. (main)
  8.  
  9. while(1){
  10. HAL_ADC_Start(&hadc1);
  11. HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
  12. raw = HAL_ADC_GetValue(&hadc1); // polecam podzielić sobie tą zmienna np zeby była od 0 do 100 bo moze sb zmieniac wartosci
  13. sprintf(msg, "%hu\r\n", raw);
  14. //BSP_LCD_DisplayStringAtLine(0, (uint8_t*)msg); // zeby wyswietlic wartosc
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment