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
1answer
358 views

Can't assign String to Array of String

I have to input 5 words and organize. In order to organize words, I have to get them into Array of String to compare. I succeed to get char[buffer] into String in_str but somehow in_str doesn't get ...
0
votes
1answer
2k views

string.indexOf() always returns a non-zero value

I am developing a hardware project which contains a facility to change the stored password by any user, if he/she knows the current password.The new password is stored in arduino eeprom. In the main ...
2
votes
1answer
2k views

Does the StringObject.reserve() function prevent memory fragmentation/leaks?

I'm currently writing and testing a professional Arduino application, I'm aware of the dangers of using the String class, so I began to implement C-style strings in some places, but it's just way ...
2
votes
2answers
8k views

function returning String-Array

i'm still new to arduino and also to C++ and have a short question. What i want to do is to write a function (in my case to parse the query-string of an URL) to get the parameter names and values (...
1
vote
1answer
1k views

remove weird chars from char array ESP32

When I'm converting a string to a char array there are always some weird chars at the end. I have to do it manualy because the convertTochar function crashes my ESP. String sssid = module.getCssid()...
0
votes
2answers
1k views

Keypad password check issue

I am working on a school project, basically I have to create a lock system that opens a fictive gate when the correct code is entered. We have been asked to simulate our system before actually ...
0
votes
2answers
470 views

Why I get error on string concatination?

exit status 1 invalid operands of types 'const char [5]' and 'const char [2]' to binary 'operator+' String message = "Page not found\n\n"; message += "URI: " + HTTP.uri() + "\n"; message += "...
1
vote
1answer
932 views

Ubuntu class string has no member remove

I am running some code that works fine on my windows system using the .remove method. On Ubuntu 16.04 I get the following errror: error: ‘class String’ has no member named ‘remove’ To see if it ...
0
votes
2answers
90 views

Where can I find the complete list of Arduino Serial Command & Query Strings?

I am planning to use the Arduino as a replacement for a USB-Controlled Digital I/O device, which will be integrated into an existing C++ software package that I created. I understand that the Arduino ...
0
votes
1answer
2k views

Printing char array from array of structs in progmem to serial

(I apologize if this is a c++ question, I'm too green to know if this is unique to the Arduino IDE) I've moved an array of structs into my PROGMEM because I was running into memory issues: #define ...
0
votes
1answer
108 views

Cannot convert Serial String into char

I am trying to write a program to control 4 motors through the Serial port. I planned on achieving this by sending the motors' speed and direction instructions as a string, which is then converted ...
1
vote
1answer
5k views

Put integer and double into char array

I want to print text and numbers mixed in a table with Serial.print(); from a char array. My problem is the conversion between the different data types. My idea is to print the data of the rows in a ...
1
vote
1answer
113 views

SoftwareSerial + Serial.printlen() not working properly

I want to read a SMS message , find it's length and do some "substring();" operation on received SMS. My last two(2) statements do not work . How can I get correct answers? What are correct codes ? ...
4
votes
3answers
40k views

Very Basic Arduino Uno Serial.readString() operation

I am very new to Arduino Programming. I am trying to identify the input string from serial monitor and printing the output to the console accordingly Code is : void setup() { Serial.begin(...
-5
votes
1answer
98 views

Creating String Arrays and passing each index value to a variable after a given period [closed]

Is there a way to take an input string, store it into a array and then pass each index of that array to a variable to hold before being overwritten by the next array index value? For example: A ...
0
votes
2answers
499 views

Strings from serial are not equal

In my code I have that string:String code = rs1 + rs2 + rs3; //rs1=034, rs2=000, rs3=017 It means that code = "034000017". But if I run if (code.equals("034000017")) Serial.println("OK"); There is ...
1
vote
3answers
349 views

How do I combine a variable and characters into a string with Arduino?

I am building some sensors with Arduinos, which each have a unique integer address from 1-9 (This address is an int variable stored in a struct 'Matrix', the variable name is Matrix.Address). The ...
0
votes
2answers
62 views

Issue with length of string value

I have been getting some weird issues with a sketch I put together(apart from memory low warnings, it was working fine) When im about to post data to my php server - it seems not all the information ...
1
vote
1answer
949 views

Select from Custom Array without Repeat

I found this great code to pick a random number from a "hat" without repeat: /* RandomHat Paul Badger 2007 - updated for Teensy compile 2017 choose one from a hat of n consecutive choices each ...
2
votes
2answers
709 views

Send String to a function inside a class

I made a little class for handling menus. When creating a new instance, I pass a reference to the oled object made in main.cpp. Yet when I want to render a string using a variable, it throws an error. ...
2
votes
3answers
3k views

How to compare two string?

I meet a terrible problem. I can't compare two string! My job is simple, every 1ms use SoftwareSerial read_card(2, 3);to check if i read a id card.And don't read a card twice.Here are my code: bool ...
0
votes
1answer
202 views

Urgent need of help splitting a JSON formatted string received by UDP

I guess that my problems are because I'm new to C, but after spending three evenings without success I thought I'd give it a try to ask here! I receive a JSON-formatted string in a UDP message. It ...
11
votes
1answer
96k views

Convert int to char[]

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); ...
1
vote
1answer
247 views

Check to see that String only contains .csv style numbers

I'm looking to determine if an Arduino String contains any other character than those that would be in the [number],[number]'\r''\n'where [number] could be positive or negative. I know I can run a ...
2
votes
1answer
6k views

Sending string over serial to nodejs app. Why does it get chunked?

I'm sending a string from my sketch over Serial port as follows: Serial.println(F("Found ILI9341 LCD driver")); On the other side, I have a nodejs app using the serialport npm module, with something ...
1
vote
2answers
355 views

Convert Bitstring to Textstring

I have an Arduino Uno which is going to receive a long binary string. I know that this string will correspond to English when decoded. How can I convert the incoming binary string to text, so that I ...
-7
votes
1answer
317 views

Library not found

The error is: C:\Users\jerem\Desktop\ARDUINO\LCD_TEXT_JA\libraries\sketch_jun06a\sketch_jun06a.ino:5:28: fatal error: LiquidCrystal .h: No such file or directory #include <LiquidCrystal .h> ...
0
votes
1answer
514 views

error using String class to convert a double to a string

i wanted to convert a double to a string i tested several examples online i allawys get the same error. the code : void setup() { Serial.begin(9600); } void loop() { double val =3.2222; ...
0
votes
2answers
87 views

replacing #define with typedefs for bracket scope

I have a project in which basically i have to concatenate existing code. Each code comes with its own #defines. But defines are not touched by the compiler, but the preprocessor. Each snippet of the ...
1
vote
1answer
256 views

Cannot correctly access element in array when given index

I have the following strings which are stored in the program memory. They are basically just morse code definitions, with another array of characters where each character in the array has the same ...
2
votes
2answers
887 views

serial write pixels of a bmp image [closed]

I'm looking for a way to read a 24 bpp bmp file from a SD cart, and than convert it to text and write it to the serial monitor. So the output should look something like this: R255,B255,G255 And that ...
-1
votes
2answers
2k views

ESP8266 - Parsing last char from a string

I'm trying to parse the last character from the string of the reply from server and print them to serial monitor. My arduino code: // This will send the request to the server client.print(String("...
0
votes
2answers
1k views

Having problems with I2C - Slave is receiving "b ~ ,,,"

so I'm facing a pretty large problem. I'm experimenting with I2C and using one Arduino that acts as a countdown timer to send the current reading on the timer to another Arduino. I'm pretty new to ...
0
votes
1answer
1k views

Char Array Buffers String UINT8

So, I have an ATTiny85 sending data, awesome. I would like to have it send a message that consists of a few concatenated parts. I have been reading about strings, buffers, chars, toCharArray and more ...
1
vote
1answer
558 views

Strings becoming empty (Arduino Uno)

I'm running a modifed code on Arduino Uno + WiFi shield (updated), and I have seen strange behaviors with String ; here is my code, the goal is to parse a HTML request to know which page was requested ...
-1
votes
3answers
6k views

Arduino : How to write a variable value into a text file and modify it in the SD card? [closed]

I want to write a variable value into a text file in the SD card and modify it while reading if needed. I found a text reading code which reads a desired line in the text file.(not tested) //reading ...
1
vote
2answers
215 views

Confusion about String handling

I am trying to execute some webbased calls, but my string keep "disappearing", and I am highly confused about why. I can println a string directly, but if I have it in a variable, it will disappear :...
0
votes
2answers
409 views

Benchmarking String.toInt() vs Checking individual characters gives unexpected result

I'm trying to check whether the input string contains all digits or not. I achieved this using 2 different algos. One is to convert the string to integer using String.toInt() and then checking if its ...
2
votes
1answer
113 views

Sending a string to arduino and is not reacting to it

I am trying to move servos with a VR headset, I am using the Unreak 4 Arduino Plugin, but that is not the problem. I send the rotation Y and Z from the headset, convert them to int and then send them ...
6
votes
6answers
9k views

Understanding why should avoid “String” and alternative solutions

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-...
5
votes
3answers
6k views

Arduino String memory allocation

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 ...
5
votes
1answer
4k views

Format Integer in Arduino

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

Reading a 10-byte buffer out of a PROGMEM string stored in a string table

I'm storing a large snippet of text in three separate PROGMEM char arrays: const char script1[] PROGMEM = "...."; const char script2[] PROGMEM = "...."; const char script3[] PROGMEM = "...."; The ...
0
votes
1answer
79 views

Why is my Serial port not printing the right output?

am working with and Arduino nano and according to this, I can append strings to numbers by doing: stringThree = stringOne + 123; but when I do: sensorValue = analogRead(A0); String x1 = "{\"Volt\":"+...
0
votes
2answers
5k views

Using StringStream in Arduino sketch

I learned about StringStream today at work. #include <iostream> #include <sstream> #include <stdio.h> #include <string.h> using namespace std; char* getSql() { float ...
0
votes
1answer
362 views

Using strings inside mBlock extensions code

The following question is about a 3rd party Arduino programming enviroment mBlock and creating extensions for it. I hope that there are some of you out there, who are fammiliar with it. I was ...
0
votes
1answer
898 views

Why is integer-to-string not working in this sketch?

I am using a Pro Mini to read analog values and to send them via serial. Goal of the sketch is to stream these values to Serial as fast as possible, to obtain a steady stream of at least 1000 ...
1
vote
2answers
234 views

Push to 2D array (log) but last value pushed is everywhere

I have this simple that is supposed to keep a log for me with a fixed number of entries. When I add to the log the oldest replaced is by the second oldest etc and the new entry added. Except when I ...
0
votes
1answer
174 views

String use in arduino IDE (this question for understanding) [duplicate]

I'm using arduino several month now, And i don't understand when i can use the arduino object of String. I'll explain, I read a lot and the it's look like that this object is a good way to read/write ...
0
votes
1answer
1k views

Storing latitude and longitude floats as chars with specified precision

I am receiving lat and long data from a GPS and want to store these numbers in the middle of a sequence of chars. E.g. lat = -23.123456 long = 135.123456 I am after something like "Your coordinates ...

1 2 3
4
5
7