Go Down

Topic: How can I simplify this simple code? (Read 3596 times) previous topic - next topic


RadarProject - Arduino Autopilot for RC http://radarproject.wordpress.com/


Can someone please direct me to an article (Or give me an explanation) on why using String variables are usually bad in C++/Arduino?

There is a specific problem with the Arduino String class because it exposes a bug in the Arduino memory management. But using strings to represent numbers is generally a bad idea anyway because you then need to parse the string to get the number each time you need to use it. This slows your code down and introduces potential problems in any situation where the string might not contain a valid number. Best to treat numbers as numbers - if you're given a string, parse it to a number once and use the number from then on - if you need to output a string, format the number as a string at the point you need to output it.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131