Advertisement
androng

Untitled

Feb 28th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <Streaming.h>
  2.  
  3. void setup() {
  4. Serial.begin(115200);
  5.  
  6. double f = 45.123456789;
  7.  
  8. f = f*f;
  9.  
  10. Serial << _DEC(f) << endl;
  11.  
  12. char buffer[20];
  13. dtostrf(f,3,10,buffer); /* sprintf does not work with floats on Arduino */
  14. /* Outputs the full seven digits of precision from single-precision float f*/
  15. Serial.println(buffer);
  16.  
  17.  
  18. // for(byte b = 0; b < 20; b++){
  19. // Serial.write(buffer[b]);
  20. // }
  21. // Serial << endl;
  22. }
  23.  
  24. void loop() {
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement