Advertisement
baldengineer

Floating point fail

Feb 26th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. void setup() {
  2.   // put your setup code here, to run once:
  3.   Serial.begin(9600);
  4.   char buffer[20];
  5.   float myFloat = 3.145;
  6.   Serial.println("Serial print...");
  7.   Serial.println(myFloat);
  8.   Serial.println("now with sprintf");
  9.   sprintf(buffer, "Value: %f", myFloat);
  10.   //sprintf(buffer, "Value:");
  11.   Serial.println(buffer);
  12. }
  13.  
  14. void loop() {
  15.   // put your main code here, to run repeatedly:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement