Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static uint16_t convert_float(uint16_t adcValue)
  2. {
  3.     float exponent = (adcValue + 1) / 128.0f;
  4.     float result = 256.0f * powf(2.0f, exponent) - 1.0f;
  5.     return (uint16_t)(result + 0.5f);
  6. }
  7.  
  8. void setup()
  9. {
  10.     // put your setup code here, to run once:
  11.     volatile uint16_t result = 0;
  12.     for (uint16_t i = 0; i < 1024; i++) {
  13.         result += convert_float(i);
  14.     }
  15. }
  16.  
  17. void loop()
  18. {
  19.   // put your main code here, to run repeatedly:
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement