Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static uint16_t convert_float(uint16_t adcValue)
- {
- float exponent = (adcValue + 1) / 128.0f;
- float result = 256.0f * powf(2.0f, exponent) - 1.0f;
- return (uint16_t)(result + 0.5f);
- }
- void setup()
- {
- // put your setup code here, to run once:
- volatile uint16_t result = 0;
- for (uint16_t i = 0; i < 1024; i++) {
- result += convert_float(i);
- }
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement