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
32 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 ...
0
votes
1answer
93 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 ...
-1
votes
2answers
76 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 ...
2
votes
1answer
255 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....
0
votes
1answer
86 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 ...
1
vote
1answer
66 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(); ...
12
votes
6answers
3k 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'...
1
vote
1answer
279 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 = &...
1
vote
1answer
105 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 ...
2
votes
1answer
105 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 ...
2
votes
1answer
61 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:...
0
votes
2answers
49 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 <...
0
votes
1answer
71 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. ...
1
vote
0answers
31 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 ...
0
votes
2answers
436 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 ...
1
vote
2answers
68 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') { ...
1
vote
2answers
111 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....
1
vote
1answer
119 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 ...
0
votes
1answer
75 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); ...
0
votes
0answers
49 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 ...
1
vote
1answer
218 views

Error initializer-string for array of chars is too long using ESP32 Webserver

i tried to use an asynchronic webserver for a new project with friends using this tutorial. We want to run an FFT while also changing some settings via the webserver. Since the tutorial only put code ...
0
votes
1answer
747 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 ...
2
votes
1answer
81 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(...
0
votes
1answer
186 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 ...
1
vote
0answers
170 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....
1
vote
2answers
278 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 ...
1
vote
1answer
297 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\&...
0
votes
2answers
84 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 ...
1
vote
3answers
88 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 ...
2
votes
1answer
176 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 ...
2
votes
1answer
282 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 ...
0
votes
1answer
212 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 ...
1
vote
2answers
712 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 ...
1
vote
1answer
60 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 ...
1
vote
1answer
149 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 ...
1
vote
1answer
274 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 ...
0
votes
2answers
304 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 ...
0
votes
1answer
73 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 ...
1
vote
1answer
249 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 ...
0
votes
2answers
76 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 ...
1
vote
0answers
218 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 ...
0
votes
1answer
759 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 /...
1
vote
1answer
63 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 ...
0
votes
1answer
274 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; ...
0
votes
2answers
50 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 ...
1
vote
0answers
62 views

Arduino blocks when serving web pages

I have an Arduino sketch that serves an HTML web page using the standard Ethernet library (https://github.com/arduino-libraries/Ethernet) and the Ethernet Web Server library (https://github.com/khoih-...
1
vote
1answer
52 views

.toFloat() giving incorrect anwsers

I am broadcasting a fixed value float over a HC-12 radio which is then received by another HC-12 radio. I am then trying to convert that String to a Float which requires 6 decimal places. However, ...
0
votes
2answers
52 views

Add char at intervals in a String

I'm trying to create a function that will take a String as an input, and at every 20 characters, it will instert "\n" so that the string doesn't go off the side of my screen (I'm using an ...
1
vote
1answer
134 views

Having trouble with sprintf function and string class

in my code, I was using string class to make an array to store my menu items String menu[2] = {{"Menu 1"}, {"Menu2"}}; How do I convert this into char arrays and how do I call ...
1
vote
1answer
38 views

How do you make a Class variable array bigger?

I am making an infrared macro-keyboard, I want to store Unicode for the Keyboard class in an array inside a class I made called Keybindand to allow the user to program as many outputs as they want, I ...

1
2 3 4 5
7