Questions tagged [string]
A sequence of characters -- including letters, numbers and symbols -- often used for representing information in a human-readable format.
27 questions
71
votes
12
answers
458k
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 &...
3
votes
4
answers
16k
views
How to compare a string
How to compare a string coming from serial monitor with some predefined text stored as a local variable?
If I say:
int led = 2;
String a = " abcds";
void setup(){
Serial.begin(9600);
}
void loop(...
1
vote
2
answers
23k
views
float precision in arduino
I am reading a string which i have to convert into a float with a maximum of precision.I didn't want to use toFloat() function since it make a truncation so i made my own code.
My problem is that the ...
3
votes
2
answers
2k
views
What is the memory expense of creating a String from a char array?
I'm writing a little API for processing email messages in Arduinos. Obviously, I need to keep memory use down, but I also want to allow the end user to use the String functions (like indexOf) to ...
12
votes
6
answers
5k
views
Using String instead of C string, yet another attempt to touch a loaded issue
I've been reading a lot over the years why we should not use the notorious String class and how heap fragmentation is bad practice and not professional and we should never use it in our programs or we'...
7
votes
7
answers
11k
views
Understanding why should avoid “String” and alternative solutions
Why “Strings” are bad for Arduino?
Which is the most efficient and fastest solution to read and store the data from Accelerometer and GPS?
Stings are evil for Arduino
An Uno or other ATmega328-based ...
3
votes
1
answer
1k
views
Using UART to Set RTC
I'm using an Adafruit NRF8001 Low Energy Bluetooth module and a Real Time Clock module with my Arduino board. I want to connect to the BLE module using UART to set the clock. I'll also be using UART ...
2
votes
1
answer
6k
views
How to transmit string data using the rc-switch library?
I am using the rc-switch library for sending and receiving data. In rcswitch library, there is no method to send string data. I am using below method to send the string message in char buffer.
...
1
vote
2
answers
2k
views
Convert comma-delimited Arduino String of hex values to array of bytes
My apologies if this is a naive question. How do I convert a String which has hex values to a byte array that has those hex values?
This:
String s = "0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff"...
1
vote
1
answer
478
views
Substring: What is causing my output to be truncated?
I suspect that I might be using too many resources, because of the strings, but I am new to Arduino, so not sure where I am going wrong. Any help would be appreciated.
What it should do when complete:...
1
vote
1
answer
2k
views
How to convert a String to Hex array
I am trying use a HMI display. If I want to send a data, for example I want to write "TOPWAY" to 0x00000080 address it should like that:
Serial.write(0xaa); // packet head
Serial....
1
vote
1
answer
5k
views
strtok problem while parsing String
Here is my code. The incoming string is "*CRB12344,Temp25,Humidity55,CC5#"
I am unable to get value of Temp which is 25 and Humidity which is 55 and CC which 5. It only display the value of CR i.e ...
1
vote
2
answers
4k
views
Get strings from Serial.read()
I want to read strings from Serial.read() to send them later.
To get the data from the Serial monitor I'm doing this:
String stringOne = "";
int incomingByte;
if (Serial.available() > 0) {
...
0
votes
3
answers
3k
views
How to replace String objects with char arrays while still using string methods
I am running the following code on my ESP8266 (AI-Thinker ESP8266MOD).
I send an HTTP GET request and a pin is set to high for a 1/2 second.
However, after some time (sometimes 1hr, 2hrs, 12hrs, ...