Skip to main content

Questions tagged [string]

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

71 votes
12 answers
458k views

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 &...
ValrikRobot's user avatar
55 votes
12 answers
279k views

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); ...
sachleen's user avatar
  • 7,565
17 votes
1 answer
160k views

I'm looking to convert an int value to a char array. currently I've found the following will return [number] int num = [number] str = String(num); str.toCharArray(cstr,16); Serial.println(cstr); ...
ATE-ENGE's user avatar
  • 941
12 votes
6 answers
5k views

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'...
Nino's user avatar
  • 411
10 votes
5 answers
69k views

I wander what is the best option for formatting strings in Arduino for output. I mean what's a preferable way in the point of view of performance, memory usage – things like that. I see, people ...
zhekaus's user avatar
  • 459
10 votes
1 answer
22k views

I'm working on BLE project with espressif library. And It returns me founded BLE device. std::string getManufacturerData(); std::string getName(); int getRSSI(); BLEScan* getScan(); When ...
BK52's user avatar
  • 203
9 votes
3 answers
33k views

I'm using a Mega2560 and a generic SSD1306 OLED display with the Adafruit_SSD1306 (and by extension, Adafruit_gfx) library. I need to print a bunch of float values (ranging between 30.0 and 99.9) to ...
Bitbang3r's user avatar
  • 561
8 votes
3 answers
2k views

I have found that the n parameter of snprintf() seems to be ignored in my code. char asdf[10]; Serial1.println(snprintf(asdf, 2, "hello")); This prints 5 when I would expect it to print 2. What is ...
Westin's user avatar
  • 83
8 votes
2 answers
2k views

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 (...
kimliv's user avatar
  • 561
8 votes
1 answer
7k views

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 ...
Peter Bloomfield's user avatar
7 votes
7 answers
11k views

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 ...
Andrea Ciufo's user avatar
6 votes
3 answers
9k views

When a String variable is declared and modified inside a function, where does it go? To the heap(as string declaration is a part of dynamic memory allocation) or to the stack(as it is a part of ...
goddland_16's user avatar
6 votes
3 answers
5k views

I want to have a line like this Serial.println(count*"B"); So if count=6, it would print BBBBBB, etc. Is there anything like this for arduino?
Mirror318's user avatar
  • 163
6 votes
1 answer
4k views

I have a text file on an SD card, and I am trying to print the lines to the serial monitor. This Code Works: #include <SPI.h> #include <SD.h> File myFile; void setup() { Serial.begin(...
user3151828's user avatar
6 votes
1 answer
6k views

How to format an integer as 3 digit string? If I give 3 formated string should be 003 printf("%03d\n", 3); // output: 003 This doesn't work in Arduino.
user119o's user avatar
  • 225

15 30 50 per page
1
2 3 4 5
22