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

Comparing a text string to text output (DHT22)

Lately I've received a DHT22 sensor. I've started to create a small temperature and humidity monitor station. One of the things I noticed was if you pulled out the sensor while in use, it displayed "...
-1
votes
0answers
17 views

How to store SMS received by SIM800L into a String variable. (MY CODE ISN'T WORKING)

#include <SoftwareSerial.h> String incoming_char; SoftwareSerial gsm(9,10); // RX, TX void setup() { Serial.begin(9600); Serial.println("Testing GSM SIM800L"); gsm.begin(9600); gsm....
0
votes
1answer
19 views

String generator not working as expected

I'm trying to build a random string, save it to EEPROM as int, then read it back and output it. If I give it a predefined string then it works fine. But Something is wrong with the random string ...
0
votes
0answers
35 views

How to compare an incoming byte from cool terminal as modbus hex value and compare it with a predefined value in set in the program?

My Input from Cool terminal is 05 03 00 01 00 02 94 4F I should be able to read this input 05 03 00 01 00 02 94 4F compare with the same(05 03 00 01 00 02 94 4F). If the incoming value(05 03 00 ...
0
votes
1answer
27 views

Convert Float to hexadecimalValue

I am trying to convert float value to 4 byte hexadecimal value. For example my input is: 58.5 My expected output is: 426A0000 or like 0x42 0x6A 0x00 0x00 My program is: void setup() { Serial....
0
votes
0answers
39 views

Arduino Lib doesn't recognize String type

I use the following code snippet in a library I wrote: int MyClass::Send(MyMessage* message) { String rev = func(); // Do Work } And in a different library I wrote: String func(){ ...
1
vote
1answer
19 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
28 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
132 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
28 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
92 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
39 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
100 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
55 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); ...
1
vote
2answers
376 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
119 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
84 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
51 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
75 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
38 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
47 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
117 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
168 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
814 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
130 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
115 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
105 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
82 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
417 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
168 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
580 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
47 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
104 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
55 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
278 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
107 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
140 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
157 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
268 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
48 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
129 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
55 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
89 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. ...