![]() i do know how to make this with while(Serial.available()0) but i want to try make it with if EXP: int radius float area float pi 3.14 String msg1 'Enter the radius of circle: ' String. The error says that String(float&) is ambiguous, so I'm guessing you have another namespace with a String definition in it which is conflicting with the Arduino version. So the problem is i want to write an Ask-Wait-Read code with if and serial.available() but when i ask, the message loops and even if i enter the data it doesn't work. (Quite often when you reduce it to the simplest example, you learn what the problem is anyway!) Generally with these sorts of problems, you should reduce the code to the simplest example which shows the error and post that whole example in the thread. the definitions of some_float and some_value I've tried create a string and add the message i, but surprisingly message i becomes an int when added. This tutorial shows you how to initialize String objects. Convert the Serial.Println to string Ask Question Asked 7 years, 8 months ago Modified 7 years, 8 months ago Viewed 1k times 0 I'm working with VirtualWire and I'm trying to get a string value out of the Serial.println in the loop. You can append characters to Strings, combine Strings through concatenation, get the length of a String, search and replace substrings, and more. The last example you gave that gives 'similar errors' looks like it should work when you remove the extra open bracket, according to the docs.ĮDIT: in reference to the new error message "> call of overloaded ‘String(float&)’ is ambiguous" can you paste some additional code to show at least: The String object allows you to manipulate strings of text in a variety of useful ways. ![]() String stringOne = String(5.698, 3) // using a float and the decimal places There is an example of this on the doc page you linked: You'll need to convert your float into a String then add the two Strings together. The docs say the + operator only supports adding two String types together. ![]() Next, as the error says, you are attempting to add a float value to a String type. ![]() First, you have an extra open bracket in all of your tests. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |