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
51 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
86 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 ...
1
vote
0answers
39 views

Serial1.readString() on arduino mega returns an empty string

i have been trying to read text message from a sim module over serial1 of arduino mega, when i use the code msg = Serial1.readString(); the readString return an empty string i dont know if this is a ...
1
vote
1answer
45 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 ...
1
vote
1answer
48 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
votes
2answers
54 views

Convert string to integer

I'm using two ESp32 in a server and client configuration and i'm sending data between them in form of strings but i want to convert the recieved data which is fom of strings but it contains numbers ...
0
votes
2answers
41 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
41 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
30 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
3answers
234 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
49 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
88 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
104 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
72 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); ...
1
vote
0answers
45 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
125 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
431 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
58 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
121 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
62 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
97 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
296 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
75 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
82 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
99 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
236 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
107 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
300 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
51 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
121 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
175 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
171 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
50 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
245 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
62 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 ...
0
votes
0answers
159 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
0answers
138 views

arduino split string into an array [duplicate]

i have problem with change srting to array my string input is like this B109DAE1B71B638E it come from Serial.readString and i want to change this string to array byte like this byte in01[] = { 0xB1, ...
0
votes
1answer
641 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
62 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
157 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
49 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
60 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
42 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
51 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
113 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
36 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
vote
3answers
143 views

Formatting variables from a variadic function

I have a function that concatenates a print line, however I am having trouble getting some of the strings to format correctly. Using Serial.print formats the output from keypad.getKey() correctly, ...
0
votes
1answer
46 views

ESP32 Cannot assign value to string. Getting wrong value

Hello I have problems with strings in my sketch. I assingn values to my string (for example tempStrReturn) in the functions setNr1, setNr2. If i pass the value 1 to the function i get "" or "...
1
vote
0answers
49 views

LiquidCrystal swap lines with interrupt

#include <Wire.h> #include <LiquidCrystal.h> int temp; const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); char Nick[15] = {' ', ' ', '...
1
vote
2answers
65 views

Nothing received from function returning array of strings

My read function returns an array of strings. i.e ssid and password String* configuration::read() { String rw_ssid = ""; String rw_pswd = ""; const int keys = 2; String read_ssid_pswd ...

1
2 3 4 5
7