Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 votes
1 answer
43 views

String Comparison [closed]

I am trying to compare two string but each time i am getting awkward results. When i use Equals() function i always get the wrong answer and never satisfy the IF statement. When i use compareTo() ...
user avatar
1 vote
1 answer
575 views

Conversion from ASCII uint8_t to string

I am sending a string from a Raspberry Pi to an ESP32 via BT. I am getting one ASCII value per line. How to convert it into one whole String? I tried as follows, but I get an error while running the ...
user avatar
2 votes
2 answers
35 views

How do I fix my code so that it reads text from the serial monitor?

I have created a code that should print out "Enter true to deactivate alarm" in the serial monitor, then store the user's answer and print "alarm off" if they enter true and "...
user avatar
  • 21
0 votes
3 answers
101 views

String type replace function can't replace with no char

I want to replace the ":"(colon) in the MAC address with no char (remove the ":"). But I can't find any good solution. String.replace(), can't replace with (void). Note: String....
user avatar
2 votes
2 answers
59 views

Read & Write to EEPROM

I need to implement EEPROM Read & Write functionality to my project. I've been learning how to use the EEPROM on the last few days, however I'm struggling to Read & Write Strings to EEPROM. ...
user avatar
0 votes
1 answer
53 views

Optimised random alphanumeric string generator

I'm trying to build arduino nonce generator, but the only thing I found is this question on arduino forum but I can't find out how to make it work for me. I checked and Serial.available() is always 0 ...
user avatar
  • 305
1 vote
1 answer
233 views

What's is the best way to convert std::string to String?

Pardon me, I am a novice programmer. I was trying to use the toInt() function for a std::string but I noticed that toInt() only works for the String class. So, I have an std::string sliderValue and ...
user avatar
  • 13
0 votes
1 answer
100 views

String Split Issue

I am getting multiple messages from a GPS device at different frequencies. After getting strings I have to save this data on the SD card. It works well when we have the same frequencies messages but ...
user avatar
-1 votes
2 answers
231 views

İs that possible to a function return String OR Int depends on address

Well, I'm trying to use a HMI display and this HMI storing datas in separeta addreses. Such as integers addr. is between 0x80000 to 0x9ffff and also for string's addr is between 0 to 0x1ffff. At this ...
user avatar
  • 205
1 vote
1 answer
466 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....
user avatar
  • 205
0 votes
1 answer
541 views

Using index of to search for multiple characters

In my Arduino project, a string will be received. I understand using .indexof to find the placement of a certain character in the string. My problem is that I need to find the first occurrence of any ...
user avatar
  • 1
1 vote
1 answer
89 views

Find OK or ERROR in serial string

I am trying to figure out how to capture the OK or the ERROR from a SIM800l. I have tried mySerial.println("AT"); while (mySerial.available() > 0 ) { String str = mySerial.readString(); ...
user avatar
  • 141
12 votes
6 answers
4k 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'...
user avatar
  • 391
1 vote
1 answer
2k views

invalid conversion from 'char' to 'const char*' [-fpermissive] on a string

I am compiling some code I didn't write, and it bombs out with the error message invalid conversion from 'char' to 'const char*' [-fpermissive] on the line if (loginPassword == '\0') loginPassword = &...
user avatar
1 vote
1 answer
145 views

How to properly handle the Arduino String

I've read that the Arduino String is bad as it causes memory fragmentation, so I try to avoid them mostly. But I still have some occurences where I'm not quite sure if they are ok after all. The first ...
user avatar
1 vote
1 answer
432 views

Arduino Serial.readString() trouble

Hello everyone I write my code and have some troubles. When I write on in my serial monitor my buzzer condition wasn't changed. Can you help me realize the reason. I wrote code with int type and it ...
user avatar
1 vote
1 answer
91 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:...
user avatar
  • 21
0 votes
2 answers
59 views

Get a specific item from comma separated text

I use bluetooth (works like serial monitor). Let me say i send a text to my hc-05 (same as sending to serial monitor) My current code is displaying text from serial monitor/HC-05 TO LCD #include <...
user avatar
0 votes
1 answer
149 views

Remove unwanted characters from char type

I'm working on an ESP8266 module that needs to fetch date data from worldtimeapi, everything works fine but the problem is How do I strip of the time field off the datetime JSON response without loop. ...
user avatar
  • 15
1 vote
0 answers
39 views

Can't test for equality with string received from bluetooth module

I am trying to keep the program within a loop until the user inputs "ok" on the Bluefruit Connect App. I use the readString() function on the bluetooth object (ble) to read from it. Before ...
user avatar
0 votes
2 answers
1k views

How to read incoming HEX values from Serial.read() method?

Brief description about the problem History Communicating with a old VersaStat II used GPIB port but the GPIB ports PCI card stopped working but there was a another port 25 pin rs232 Serial ...
user avatar
  • 151
1 vote
2 answers
141 views

Arduino - Function -> return Cstr instead of string

I have following function for my Arduino: String readLine() { String received = ""; char ch; while (myFile.available()) { ch = myFile.read(); if (ch == '\n' or ch == '\r') { ...
user avatar
1 vote
2 answers
165 views

Firmata.SendString doesn't work with specific `char` variables

I have a Firmata sketch, that accepts string messages, partitions them and sends its' parts back to a Firmata client program. My problem is certainly at the sketch's side. The problem is that Firmata....
user avatar
  • 153
1 vote
1 answer
158 views

String comparison problem

I have this callback function in my Firmata sketch. It receives a string as a character array and does something with it. The problem is, that the string is being sent to the Arduino in T\0h\0i\0s\0 ...
user avatar
  • 153
0 votes
1 answer
79 views

Any explanation for this behavior?

For the below code snippet const char* fr_fbdb(char tag[30]) // fn for retrieving data { char full_path[120]; const char *_dt ; strcpy(full_path , base_path); strcat(full_path , tag); ...
user avatar
0 votes
0 answers
55 views

Erratic behavior in String based functions

I've been working on a cipher based project, and I wanted to prep the encrypted string for use with the RF24 library. Since the payload size for the RF24 module is 32 bytes, I wanted to stick with ...
user avatar
  • 17
0 votes
1 answer
2k views

What is the purpose of F() and FPSTR() in ESP8266WebServer -> FSBrowser?

I found this code sample from the FSBrowser (Flash File System) example in the ESP8266WebServer library: replyServerError(FPSTR(FS_INIT_ERROR)); replyBadRequest(F("DIR ARG MISSING")); I was ...
user avatar
  • 105
2 votes
1 answer
101 views

Why are characters with value above 127 "padded" with 1s to be 16 bits long, while ones with values 0-127 aren't?

I am using the Arduino IDE to run and monitor, with an Arduino Nano clone. This code shows what I mean by the question: char foo = 127; char bar = 128; Serial.println(String(foo, BIN)); Serial.println(...
user avatar
0 votes
1 answer
358 views

Reading a string from Firebase and storing it as a CString

I have a mobile app (done using MIT App Inventor) storing some values to a Firebase database. App inventor stores all the values as strings (i.e. with quotes, and strings have quotes enclosed within ...
user avatar
1 vote
0 answers
417 views

incompatible types in assignment of 'const String' to 'char [32] using server.arg

I am trying to create a class and getting getting the error incompatible types in assignment of 'const String' to 'char [32] when I declare char inString[32]; and try to set it as inString = server....
user avatar
  • 201
1 vote
2 answers
821 views

strcmp doesn't seem to work

I'm trying to compare a char array that I'm assembling to a string and I'm having trouble comparing the strings. I'm getting the data for the char array as a set of bytes and I'm compiling it into a ...
user avatar
1 vote
1 answer
299 views

Why use \" in arduino code?

While working with JSON parsing I noticed that the char type data string is written like this: char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\&...
user avatar
0 votes
2 answers
97 views

Is there a limitation of how many instances of the `String` class?

Platform Attiny85 with AttinyCores 1306 OLED i2c with Tiny4KDisplay Goal using a joystick for menu navigation up/down choose left enter (not finished yet) right back (not finished yet) inverse ...
user avatar
  • 103
1 vote
3 answers
113 views

Properly escaping very large strings

On an esp8266 I want to create a little webserver that shows me a dashboard with charts and stuff. For this I wanna include the echarts-library as it works offline. To access it the only way I can see ...
user avatar
2 votes
1 answer
367 views

Converting c string to integer to unsigned char

I'm Trying to grapple with types between two different libraries. The gist is that I'm using the ArduinoWebsockets library to receive information coming from my api that I then want to render out to ...
user avatar
2 votes
1 answer
395 views

Comparing a String after reading it from Serial fails

I have bought an Arduino starter kit online, everything seem to work but when I try for example to use ifs (and other conditional statements), the LEDs do not turn on. Here is a code for a little ...
user avatar
0 votes
1 answer
525 views

Converting 8 bit binary to a hexadecimal pair as unsigned char

I have a function: void Epd::SendData(unsigned char data) { digitalWrite(dc_pin, HIGH); SpiTransfer(data); } At the moment I am hardcoding data sent to it by calculating on paper and then writing ...
user avatar
  • 111
1 vote
2 answers
2k views

Read Comma Separated String

I have a string that looks like this "10.00,20.00,-50.00," in which these are angle values and they have 2 decimals and can be negative. I want to separate them into 3 separate floats. Here ...
user avatar
1 vote
1 answer
90 views

Arduino keypad variables to serial port

I've been trying, for over a week now, to create a program that will store my keypad presses into variable, and with a press of an enter, it will switch to the next variable to store the presses. The ...
user avatar
  • 11
1 vote
1 answer
231 views

Cannot compile F() macro with R"string"

I am trying to compile the following code: logger.log_info(F(R"(some text here that may take multiple lines and here it is done.)")); But the compiler exists with the following ...
user avatar
1 vote
1 answer
471 views

Why isn't this EEPROM.get() working?

I am trying to save a string/char to EEPROM with EEPROM.put() and then get the value, but it doesn't work and I get a blank value when I do a EEPROM.get(). I remember this is how it worked on arduino ...
user avatar
  • 242
0 votes
2 answers
491 views

Float array to comma separated string

I have a loop command reading temperature sensor data from 8 thermistors and are storing them as floats into an array. Instead of printing to Serial on each iteration, I would like to create a comma ...
user avatar
  • 163
0 votes
1 answer
112 views

Reading Serial String Gives Null Lines with JSSC

I need to send serial data to my Arduino UNO from within a java application. I am using JSSC for this. I wanted to verify that my data actually arrives correctly to the arduino before going to the ...
user avatar
  • 3
1 vote
1 answer
255 views

How do i improve this Code? (or how to pass a Char String into a Function to behave like a Variable)

Sorry i am a beginner and amateur when it comes to coding, can somebody help me to make the code inside the loop() less "monkey-like" by using a proper function? I have tried a lot and at ...
user avatar
  • 11
0 votes
2 answers
128 views

How can I copy and compare a string?

I have the following code (I realise String isn't very efficient, but this sketch doesn't have to be) debugOutput gets called every loop, but I only want to spam the serial bus (to debug) if the ...
user avatar
1 vote
0 answers
288 views

HC-12 problem with reading momentarily strings

I'm new here, so I hope my question is not naive. I'm using Arduino mega connected with a pulse sensor and a GPS (and other things that are not related to our problem), pulse sensor and GPS data are ...
user avatar
  • 11
0 votes
1 answer
1k views

Convert Binary to char

I'm reading a text file saved on my ESP8266 device (using LittleFS). while (myFile.available()) { Serial.write(myFile.read()); } My goal is to save file content ( each line ) to a String /...
user avatar
  • 792
1 vote
1 answer
66 views

String(int) function stopping the Arduino

Well I am trying make an application with arduino leonardo and GSM Shield. There are conditions if, else if, else .. etc if (smsMetni.indexOf("DURUM") != -1) { Serial.println("SMS ...
user avatar
  • 205
0 votes
1 answer
741 views

Convert string to array

I have a project and i need to convert string (contain numbers and letters) to array String name = "s111, s222, bbbb,cccc "; and i want array[0] = s111; array[1] = s222; array[2] = bbbb; ...
user avatar
  • 23
0 votes
2 answers
53 views

How to use "+" character as a String

Well I am trying to save phone number as a string. For ease of use I want to add "+" character programmatically. Like this: String cepNo ="+" + "901234567"; But program ...
user avatar
  • 205

1
2 3 4 5
7