In celebration of the 50th anniversary of Apollo 11's Moon Walk, we are offering $50 off our SparkFun Inventor's Kit for RedBot and the Arduino Engineering Kit while supplies last! Use promo code APOLLO11 at checkout until 11:59 p.m. MT to get yours today!
Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
October 19, 2017
about 2 years ago
Thank you for your quick reply and for solution !
I found a solution but your solution is the right.
this is my solution:
double B = (int) (currentReading * 1000.0 ) / setting_division_value ;
double C = (B * 1000.0 + 0.5) / 1000.0 ;
double D = (C / 1000.0) * setting_division_value ;
double R = (D * 1000.0 + 0.5) / 1000.0 ;
"setting_division_value" is saved in the memory by the user.
Can anyone help me to solve this problem.
I want to round three decimals with the number assigned by a graduator 2 gr ,5 gr, 10 gr, 50 gr ,100 gr.
For example, if we have currentReading 1.251 kg and we want the accuracy of 5 gr the total weight must be displayed 1.250 and if we have currentReading 1.253 kg weight must be displayed 1.255 and so on..
Thanks in advance!
No public wish lists :(
Forgot your password?
No account? Register one!