Questions tagged [string]
A sequence of characters -- including letters, numbers and symbols -- often used for representing information in a human-readable format.
325 questions
0
votes
1
answer
115
views
Accessing invalid key in ArduinoJson causes ESP32 to reboot [closed]
I am running a project where I have multiple ESP32s communicate over WebSockets and I am using the Arduino IDE 2.3.4 for it. The communication primarily uses JSON and sends it as strings. To work with ...
-1
votes
1
answer
46
views
Fail to discard the character T from my transmitter Arduino
I wrote code for my transmitter Arduino. I want to send the data to the receiver Arduino through Tx and Rx serial.
The issue is that I could not discard the char "T" and it appears as output ...
0
votes
1
answer
2k
views
Construct Strings with UTF-8 characters from data
I am printing some ASCII art to the Serial monitor from Arduino UNO, with some success. However, using string literals uses more memory than I would like. I wanted to try constructing the strings/...
1
vote
1
answer
1k
views
Parse char* mac-string to uint8_t array
I have to handle a String coming in over UART containing a bunch of information, part of it is a MAC-address that I get by using String.substring(a, b) returning a 12-char String representing a mac-...
3
votes
1
answer
2k
views
if statement with string comparison
Code Snippet:
String a;
const int red_led_pin = 13;
void setup()
{
Serial.begin(115200);
Serial.println("Hello, ESP32-S2!");
pinMode(red_led_pin, OUTPUT);
}
void loop() {
...
0
votes
2
answers
479
views
Problem cleaning string read from serial buffer
I am trying to move a stepper motor when a specific command is send to Arduino Mega 2560. This command is read character by character and stored in a string variable. Whenever a new command is sent, ...
0
votes
2
answers
104
views
generate x item long list for gyverportal drop-down selection
I am trying to make a drop down selection with gyverportal. The issue is that I don't know how many items there are so the list cannot be hard coded. Here is an example from github:
GP.SELECT("...
2
votes
0
answers
360
views
Arduino filling serial buffer with nulls
I just wrote some code that just sends a string from Arduino to Processing.
Processing prints the string and displays the number of characters in the buffer...
After uploading the sketch to the ...
0
votes
2
answers
852
views
String() vs char for simple flow control
I am newbie in Arduino and writing a program where I want to control the flow by using Serial monitor input (PI controller).
I've read that using String() although easier it is slower than using char. ...
2
votes
1
answer
1k
views
Enable full float-capable snprintf() library with PlatformIO
I want to use snprintf() to format floats to a string.
I know the "normal" version of Arduino's avrlibc had all the float-formatting code removed to make it smaller.
I also know that at some ...
1
vote
1
answer
9k
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 ...
0
votes
3
answers
1k
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....
0
votes
1
answer
2k
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 ...
0
votes
1
answer
148
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
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
399
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();
...
1
vote
1
answer
7k
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
1
answer
3k
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 ...
0
votes
2
answers
243
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 <...
1
vote
0
answers
77
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 ...
1
vote
2
answers
1k
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
1
answer
327
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
0
answers
85
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 ...
2
votes
1
answer
167
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(...
1
vote
0
answers
1k
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....