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
14 views

I can't receive string that I have sent through nrf correctly

I'm using arduino uno and nrf24l01. to monitor sensor data. But this is the message that master receives: ⸮ this is my slave code. void monitoring() { delay(10); radio.stopListening(); ...
0
votes
1answer
18 views

Arduino - Extracting Multiple Strings from Serial Read

I am trying to write an Arduino code that reads a long string, example <11,22,33>, through the Serial Monitor and then stores the 11,22, and 33 into separate bins of a matrix array. So the user ...
0
votes
2answers
88 views

Yet another basic and silly question about C++ strings

I made a sketch like this: void setup() { // put your setup code here, to run once: Serial.begin(9600); char str1[64] = "test with spaces"; char str2[32] = "test with spaces"; Serial....
0
votes
0answers
31 views

First sprintf-call works, second (identical) does not

In my current project I'm using an Arduino Nano, an RTC-Module, SD-Module and an OLED-Display to log time-values. I'm currently trying to implement following function: char *onString = (char*)...
0
votes
2answers
23 views

How to Sort a String with Number by Ascending

I have trouble figuring out how to sort a String that has a Number in it. The String im sending looks like 112:AAAA and 111:EEEE, how would I sort it so that the 111 will be the first in an array but ...
0
votes
1answer
89 views

How to decrease delay for String concatenation + Arduino Due

In my project I need to add a delimiter between integer numbers. In the following code. I add a "," between integer numbers obtained from inputsig matrix. The problem is that concatenation of these ...
0
votes
0answers
36 views

Have ESP8266 read 'text/event-stream` from flask in single request

I have a route in Flask which serves an event-stream: @app.route('/input/<string:blah>') def index(blah): def generate_random_data(): while True: r = random.random() * ...
2
votes
1answer
64 views

char buffer to String in Arduino UNO

String getAPIData() { char res_buffer[450]; int numdata = inet.httpGET("myserver.com", 80, "/call.php?id=1&q=1&code=1001", res_buffer, 450); String result = String(res_buffer); Serial....
0
votes
1answer
42 views

Second item in array not gets assigned from struct object, ArduinoJson

I got the below code generated this amazing tool. const size_t capacity = JSON_ARRAY_SIZE(2) + JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(4) + 2*JSON_OBJECT_SIZE(7); DynamicJsonDocument doc(capacity); ...
0
votes
2answers
217 views

Convert String to IPAddress

How can i convert a String to IPAddress on arduino / esp ? etc. "192.168.1.2" -> IPAddress(192, 168, 1, 2) Tried this void setup() { Serial.begin(115200); IPAddress apip; const char *...
-1
votes
1answer
29 views

arduino mega multi integer values reading on other arduino mega

I need two Arduino communications. The master arduino from the slave arduino needs to read 16 signals. The sample serial port output from the slave is as follows. @ 125 @ 13 @ 874 @ 1023 & 950 @...
1
vote
2answers
116 views

How to actually concatenate two Strings?

I'm using the SPISlave library, and I have the following code snippet: String arg; SPISlave.onData([arg](uint8_t *data, size_t len) { data[len] = 0; arg += String((char *)data); // ... } The ...
1
vote
2answers
85 views

How do I implement reverse enumeration?

Basically I'm trying to output a string based upon a value in an array, the following code is what I have come up with to achieve my desired result, but I have a feeling that there is a better way to ...
0
votes
0answers
30 views

How to create parametric variable in class decleration

I hope the subject of this question if correct. in timeOUT constructor, 3 more instances of other class are defined: endTimeOUT_inFlash(key1), inCodeTimeOUT_inFlash(key2), updatedTimeOUT_inFlash(...
0
votes
1answer
31 views

Update `char* `

I have a class containing few char* variables: char* msgTopic = "myHome/MSGS"; char* groupTopic = "myHome/All"; char* errorTopic = "myHome/Err"; but, I wish to have it defined outside the ...
0
votes
1answer
66 views

From Strings to int problem

I create applications for a computer that is to be used to control the robot arm. I wanted to make the first attempt to run the application not on the motor, but on the diode and check if it will ...
0
votes
2answers
42 views

Parsing Arduino Receiving Strings

I'm currently using google geolocation to get location data to one nodemcu and sending it through serial to another Arduino. The serial command I'm getting right now is, 1.450187T103.824745 I'm ...
1
vote
1answer
54 views

How to stringtok this long string? [closed]

I have a string, "id,port,password,ssid,delay,flag,class,category" Please tell me how can stringtok this and find out the "flag" value(0 or 1)? Here is what I tried: void setup() { char input[]...
1
vote
1answer
66 views

Change data-type String

I'm currently working with an ESP8266 NodeMCU V3 and an IR transmitter breakout board. The module receives NEC IR commands trough a HTTP request and then sends them trough the IR transmitter. Getting ...
0
votes
0answers
37 views

BLE splitting string data

I am working with BLE 4.2 (ESP32) that sends IMU (accel, gyro, mag) data to my mobile app (Android). Unfortunately, I can send only 20 bytes in one packet. This is the code I have: (I am connecting ...
0
votes
0answers
44 views

Sensor to detect whether string is in tension?

I need a sensor to detect whether there is tension on a string or not. I do not need an accurate measurement of the amount of tension- just whether the string is being pulled on or is taut. ...
1
vote
2answers
105 views

Compute SHA256 of string and output to string

In my Arduino project I want to compute the SHA256 hash of a string and store the result to a string, and do this recursively many times (i.e. compute hash of hash of hash etc...). So my goal is to ...
0
votes
0answers
139 views

string.charAt() is not returning the correct value

I know this is a super basic question, and I did try debugging, but somehow I think I am missing the way variable stores value in Arduino. int enablePin = 2; // ebanble pin for slave String ...
0
votes
1answer
559 views

How to compose an HTTP GET request URL with key/value parameters

I am experimenting with some code running on an ESP8266 board to retrieve data using a web API. I would like to store the host address and key/value parameters (API key etc.) of the GET request as ...
0
votes
1answer
110 views

Send Strings via SPI both ways using two Arduino UNOs(Master to Slave & Slave to Master)

I need to create a two way String exchanger via SPI with two Arduino UNOs. Strings and their lengths are independent variables of the main loop and they can change with every iteration. I need both of ...
0
votes
0answers
99 views

Compare barcode scanner string with existed string

I have a project which is reading barcode scanner result then compare with an existed string. I have used the library USB host shield in order to read data from barcode scanner then I would like to ...
0
votes
1answer
93 views

ESP8266 crashes when trying to copy a string into a big char

I'm trying to parse with tinyxml2 a modest XML (3.4kb) to retrieve some data. My ESP8266 crashes every time I try to use the toCharArray method. here's my code // here I'm getting an http request ...
0
votes
1answer
71 views

Problem with String& argument of a function

I am trying to send SMSs using a GSM module with Arduino Mega. I have followed a tutorial and downloaded the SIM908IDE100 library. I am using the function SendSMS(String&, const char [27]);. It ...
2
votes
4answers
296 views

How to compare a string

How to compare a string coming from serial monitor with some predefined text stored as a local variable? If I say: int led = 2; String a = " abcds"; void setup(){ Serial.begin(9600); } void loop(...
0
votes
1answer
156 views

Mqtt not subscribe on topic that's converted from String to char array

I am still not sure what should be the exact Title for this question, because I don't know where the problem is. I am using #include <MQTTClient.h> mqtt library to subscribe on a topic. This ...
1
vote
0answers
517 views

String.format(“%i”,i) equivalent

How do I format an arduino String when I do not want to print it? I know that one can use printf() or other methods to print a formated string and unfortunately that's all I find with google. But that'...
0
votes
0answers
36 views

Problem: char string not working with SoftwareSerial.h

I am creating a program to display text on an OLED display and then have it sent to a thermal printer. The issue is my second char string: word_buffer When I try to use word_buffer for any reason it ...
0
votes
1answer
91 views

Parsing Data and Comparing two string in arduino

I am working on my final assignment. The problem is I want to make a prototype tool, with 2 string compare. If I send data "OK DISC DISCLOSED: 341513DB689AOK RSSI: -056 OK NAME: CarBT1 OK DISCE" will ...
1
vote
2answers
51 views

String Comparison Result [closed]

I've following code: char a[5] = "bang"; char b[5] = ""; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run ...
0
votes
1answer
260 views

Weird behavior with char/uint8 arrays

So I'm trying to read an 8-byte character string from an I2C device and print it to the serial console. This raw 8-char array is not terminated when it comes from the device, so I'm pretty sure I need ...
-1
votes
1answer
99 views

How to parse multi line serial data with an unknown number of lines? [closed]

Here's the example data I've read in H-Term: \r\n \r\n NO:0015\r\n G: 5.97kg\r\n T: 0.00kg\r\n N: 5.97kg\r\n \r\n \r\n How to save the number including "kg" to each variable (NO, G,...
0
votes
1answer
137 views

Large(ish) strings failing to send over WiFi101 using WiFiServer

I've based a sketch off the vanilla WiFi101 server examples. If I define a const char array like this: const char HTML_index[] = "<html><head></head><body>test</body>&...
0
votes
1answer
1k views

Splitting a Serial.readString into string array

I am working on a project where I need to split incoming data from serial (time to be exact, so aa:bb:cc) and need to split it into aa then bb and cc, ideally into an array. I know I could use ...
1
vote
2answers
156 views

How to combine strings and text together?

I'm trying to combine two strings (strings/int) together with text in below code: int foo = String((char*)payload).indexOf(' '); int message1; int message2; message1 = String((char*)payload)....
-1
votes
1answer
250 views

Attempting to read random string from SD card

I was wondering if anyone knew how to read in a random string from a file named "PhraseList.csv" or "PhraseList.xlsx" (whatever is easier)? There is a list of 10k. #include <SD.h> #include <...
1
vote
1answer
45 views

Assign and control Digital pin from String

Here is modified version of Blink example #define D8 13 String p = "D8"; // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin ...
0
votes
0answers
121 views

append a String on ArduinoJson Object value

I've a json string request coming from server and I convert it into json object StaticJsonBuffer<500> jsonStaticBuffer; JsonObject& root = jsonStaticBuffer.parseObject(String(msg)); ...
1
vote
2answers
52 views

Command through Serial monitor does not properly work in Arduino

I am executing a function in Arduino by giving String input to the serial monitor. The issue here is when i enter "SHOW$" (without quotes) the function showData() works but when i enter the same "...
0
votes
0answers
86 views

How to store an array of doubles? As array of doubles, Strings or const char *? Then convert back to use?

This seems like an old, solved problem, but I can't find any simple answers. I'm reading latitude and longitude data as Strings from a file (about 50 points), but they are really double float numbers. ...
1
vote
2answers
54 views

Help to delimit and read specific contents of incoming HTTP string

I am sending strings to an Esp8266 via web browser. The below code returns the following in serial monitor if I send in browser: Send from browser to esp8266 - http://192.168.1.220/s1s2s3s4s5d1 ...
0
votes
2answers
360 views

String compare when using Serial

I try to detect commands given by user in Serial Monitor, but strcmp fails to flag as identical. What do I do wrong ? Is there a better way not reading as String and convert to char for comparison ? ...
3
votes
1answer
57 views

How to define and use a list/array of chars using `Serial.print` [closed]

I wish to define a list of months names and access it when printing a report. Array was defined as follows: const char months []= {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov',...
2
votes
1answer
457 views

Using c_str() on String for IPAddress with NTPClient provides wrong values

Libraries NTPClient Board Olimex ESP32-POE board Behaviour I have written a code that connects the board to a local NTP Server (which is an embedded board). I tried assigning the IP Address of ...
2
votes
2answers
3k views

Problems on convert byte[] to String

I'm reading a RFID Card from RC522 and send the data to my computer. My problem is the conversion of byte[] to String or std::string. #define SIZE_BUFFER 18 #define MAX_SIZE_BLOCK 16 byte ...
0
votes
3answers
315 views

Arduino IDE c++ 11 raw string literal have issues with // in http://, complier thinks // is comment

char webpage[] PROGMEM = R"=====( <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js"></script> </head> <body> &...