Skip to content

Instantly share code, notes, and snippets.

@djhunter67
Created October 14, 2022 18:01
Show Gist options
  • Save djhunter67/e71e4bed32e1b0ca91c94adc40c09934 to your computer and use it in GitHub Desktop.
Save djhunter67/e71e4bed32e1b0ca91c94adc40c09934 to your computer and use it in GitHub Desktop.
Scale a voltage divided input into an 10-bit ADC on Metro Mini
float scaling_ratio()
{
// ADC_REF_VOLTAGE 3.291
double scaler = 7.6666666666666666666;
float multiplicative_ratio = scaler;
float LSB = (ADC_REF_VOLTAGE / 1024);
float scaling_ratio = LSB * multiplicative_ratio;
return scaling_ratio;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment