• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESPNow sending double precision floating number

Q&A Forum › Category: ESP32 › ESPNow sending double precision floating number
0 Vote Up Vote Down
ahenable asked 5 months ago

Using learn esp32 with arduino IDE
mod 10_1_2 sender
Changed Ln 21 float to double
Changed Ln 67 myData.c = 3.141592654
mod 10_1_3 receiver
Ln 16 from float to double c;
still receiving truncated  3.14 instead of 3.141592654
Could you help me to understand why.
Zoltan

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
I’m not sure what might be the issue.
Have you tried to send it as a char array and then convert it to a float number? That can be a workaround…
 
Regards,
Sara

0 Vote Up Vote Down
ahenable answered 5 months ago

I have done something similar to your solution.
as a float it sends out 3.14 NOT 3.141592654
Than
I defined as a double and multiplied the value by 1000 and on receive defined as double I divided by 1000
so I got the precision I wanted but it is not an elegant solution
 

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
Unfortuantely, I think these two solutions are the only way to go.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.