Questions tagged [string]

A sequence of characters -- including letters, numbers and symbols -- often used for representing information in a human-readable format.

Filter by
Sorted by
Tagged with
1
vote
1answer
7k views

How to use String.substring?

I have the following code in which requestLine is always empty and I can't figure out why. request contains a raw HTTP request, and I want to get the first line of the request which contains the ...
8
votes
2answers
2k views

Convert a Bitstring into an integer value

I have got a String filled up with 0 and 1 and would like to get an Integer out of it: String bitString = ""; int Number; int tmp; bitString = ""; for (i=1;i<=10;i++) { tmp= analogRead (...
4
votes
1answer
3k views

Check contents of buffer after serial read

I would like to test the contents of data received over a serial connection. In my loop() I store the data in bffr; and afterwards I would like to test to see if there are some predefined words in it. ...
62
votes
12answers
384k views

How do I split an incoming string?

I am sending a list of servo positions via the serial connection to the arduino in the following format 1:90&2:80&3:180 Which would be parsed as: servoId : Position & servoId : Position ...
1
vote
1answer
3k views

Nothng Written to Serial when using sprintf

I'm using sprintf to use a format specifier myTemplate with some strings. The result will then be written to Serial. Although the sketch compiles fine, it does not write any thing to the serial, ...
8
votes
1answer
6k views

Is it better to use c_str or toCharArray?

When reading/trying a recent answer, I was surprised to see that Arduino's String class supports the c_str() method, just like the C++ std::string class. As expected, it appears to get a pointer to ...
51
votes
13answers
250k views

How do I print multiple variables in a string?

Say I have some variables that I want to print out to the terminal, what's the easiest way to print them in a string? Currently I do something like this: Serial.print("Var 1:");Serial.println(var1); ...

1
3 4 5 6
7