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
2
votes
3answers
14k views

How do I send a string from an Arduino Slave using SPI?

I have an Arduino Uno acting as a master with 3 Arduino Nano's acting as a slaves. Looking at this example: http://www.gammon.com.au/forum/?id=10892, it tells me how to send a string from the master ...
1
vote
1answer
778 views

RFM69HCW 915 MHz radio module: Sending a stream of int values rather than char[ ]

I'm trying to send a stream of int values (0-4096) from one arduino to another using an RFM69HCW module. Here's my main code: #include <RFM69.h> #include <SPI.h> #define NETWORKID 0 ...
0
votes
3answers
61 views

Merging strings and constants causing scope errors

I'm getting a few errors when merging strings with constants. Here's the pertinent code... #define STATION_ID ABC123 #define STATION_PASS XYZ987 void loop(){ String path = "/weatherstation/...
4
votes
3answers
2k views

eval() function for Arduino?

I plan to do the following: void setup(){ String term = "12 + (2 * 5)"; int result = eval(term); // eval function (from Python) Serial.println(result); // expecting 22 } However there is no ...
0
votes
1answer
641 views

two dimensional array with 3 characters per entry?

my plan is to create a two dimensional array with 3 characters in each cell. what i have tried: char keys[3][8][8] = { {' ','4','5','6','x','/',' ',' '}, {'x10','7','8','9',' ',' ',' ',' '}, {'...
0
votes
1answer
931 views

Difficulties with raw string literals

I have an application where I would like to include an external multiline script as a const in my sketch. As far as I understand from C++11, this should work: raw_string_literal_test.ino const char *...
1
vote
1answer
5k views

strtok problem while parsing String

Here is my code. The incoming string is "*CRB12344,Temp25,Humidity55,CC5#" I am unable to get value of Temp which is 25 and Humidity which is 55 and CC which 5. It only display the value of CR i.e ...
1
vote
1answer
707 views

Arduino SSCANF stop on comma delimiter

I have the following problem, the arduino is receiving a command like LCD,Display line text one, Display line text two I use an strcmp to match the beginning of the string that works but now I would ...
2
votes
1answer
66 views

Blank.txt at the End of Transmission

I'm using my HC-05 (Master) to receive strings from a sensor (Slave), each string is suppose to have 7 items divided by ',' like so "a,b,c,d,e,f,g". I also have to write these strings in a .txt file ...
2
votes
0answers
2k views

save bytes from Serial into ROM (EEPROM)

I am trying to save an incoming text from serial into the ROM of the Arduino using EEPROM. I found out that you can only save a byte at once. So I thought I could do it like that: #include <EEPROM....
1
vote
2answers
50 views

Why do i get additional characters when reading a file through a buffer if buffer size > 15?

This is a follow up question to How to speed up writing a file to a WifiClient? I modified the old code to read from one Stream and write to another which looked like this and worked fine albite ...
-1
votes
1answer
67 views

Replacing stock String.cpp with smaller version

Hey all I am wondering if it's possible to modify the WString.cpp file to only include the commands that I need for my project since that file is so large. I am using a Digispark arduino that is ...
3
votes
3answers
3k views

How to multiply strings?

I want to have a line like this Serial.println(count*"B"); So if count=6, it would print BBBBBB, etc. Is there anything like this for arduino?
-2
votes
1answer
111 views

Including string class in Eclipse Neon

Probably basic question but when I type include in class of my arduino project I get only error. How do I properly include this string class?
2
votes
1answer
603 views

Serial Communication Not Receiving Entire String

I have an Arduino connected to a pico motor driver that is supposed to take a number of steps for a specific number of triggers that gets from a source (i.e. waveform generator). I've setup the code ...
0
votes
1answer
9k views

Converting uint8_t to String - unexpected result

I'm working on a remote control code for ESP controller. Using ESPwebserver and Fastled. When I try to return a value of an uint8_t, as a POST response, i got strange result here is the relevant code: ...
0
votes
1answer
1k views

check string for specific characters?

I am just wondering if it is possible to check a string for specific characters. For example if my string is String mystr = "test"; and I wanted to check for the letter t at the beginning and if it ...
0
votes
2answers
169 views

Nano resets or freezes on calling a function

I'm controlling a light bulb with my Arduino Nano from serial or RF (via nRF24L01+) and I'm passing the commands as a string. After I get all the variables (3 ints) I try calling the function ...
2
votes
2answers
90 views

Help with a Memory Issue

Below is some code that I'm writing to concurrently run "animations" on the same strip of NeoPixels. When I try to make use of the Serial monitor to control the program functions, I just get a bunch ...
3
votes
2answers
536 views

Understanding memory fragmentation due to char arrays in functions

This is similar to: Is this function subject to memory fragmentation? I am trying to get my head around Memory fragmentation in Arduino's and embedded systems in general. Currently I have a ...
2
votes
2answers
3k views

The most effective way to format numbers on Arduino

I made a big search about how to Format Numbers with the Arduino. I want to format unsigned Longs into a String in this format: "23,854,972". The most of the snippets I found work only with the ...
1
vote
1answer
2k views

Parse HTTP Request Arduino

I am sending a HTTP Request to my WiFi module http://192.168.4.1/STA/ID=HelloWorld/Pass=Testin123 How can I parse above string in Arduino. First I need to check for STA, if it exists, continue to ...
3
votes
1answer
950 views

Declaring literal strings

When I want to write a literal string in Python, I use r before the string (or @ in C#): in [1]: print r'\no esca\pe ch\ara\cters' out [1]: \no esca\pe ch\ara\cters In straight c++ I can use R, but ...
0
votes
1answer
808 views

WebSocket client for ArduinoHttpClient conditional if with readString() incoming data buffer

I'm having issues implementing a web socket on the Arduino/Genuino to procress a string received and do something respectively. I'm using SimpleWebSocket example, edited for my purpose, from the ...
2
votes
5answers
9k views

Is possible to concatenate integers?

It's a basic one: I have two values from two different analogRead pins: int val1; int val2; For example, val1 = 10 and val2 = 10. How could I put these two values into a variable val3 = val1 + val2 ...
0
votes
1answer
4k views

Size of String array

I am trying to find out the size of an array like this: String days[3] = { "Mon", "Tue", "Wed" }; Serial.printf("Size of array: %2d\n", sizeof(days)); for (int i = 0; i < sizeof(days); i++) { ...
2
votes
1answer
78 views

Informations lost in a string

At first, I sorry if I make some English faults but I'm French. So, I'm making a connection between a client and an Arduino Uno. I receive all data that I need but when I send a response to my ...
1
vote
1answer
8k views

How to convert String to Double?

I found the .toFloat() but that's not accurate enough. String StrEx = "57.10598"; float FloatEx = StrEx.toFloat(); Serial.println(String(FloatEx)); //outputs 57.11 Serial.println(StrEx); //...
1
vote
1answer
5k views

how to send large strings (> 100 characters) from arduino serial monitor

I am a newbie to arduino programming. I wish to send big strings which are in range of 100 to 1000 characters to my arduino uno. I saw that arduino cannot read more than 63 characters at a time. The ...
0
votes
1answer
6k views

Remove certain characters from char*

I've got an array of char* with serial data that I'm trying to remove ':' from. I have tried to iterate through the char*, find and remove any colons but it just comes out as garbage. char* espData[...
0
votes
1answer
3k views

Arduino: put string through variable in array

I have a problem and I can't fix it. I'm busy with an java to arduino project. Java writes a string using writeString(); Arduino reads the serial monitor and put the incoming string into a function. ...
0
votes
1answer
9k views

Using Sprintf() to left pad a string?

I've been at this all day, and I just can't seem to wrap my mind around how to use sprintf() to set a width for my string so that my characters are right justified. What I'm trying to do is scooch ...
0
votes
1answer
4k views

convert String to unsigned long long

i want to convert string for example "68976543210" to unsigned long long(64 bit) in mega2560, do is possible? String x="68976543210"; unsigned long long y=?;
0
votes
1answer
1k views

error loading an array of strings

I'm trying to have a user enter a series of strings. This is my code. this is my error message - cannot convert 'String' to 'char*' in assignment char* titles[] = {"entry one", "entry two", "entry ...
0
votes
1answer
169 views

Strings that always stay empty

I wrote an app that listens on the network for command over UDP and sends back an answer. Whatever I try to put into my answer never get sent. The string is always empty. The following code prints a ...
1
vote
3answers
407 views

I need to build a char array from two integers

My C is rusty, so please forgive this simple problem. This line works: Tft.drawString("Test",200,200,2,WHITE); But, this has compile errors: String yStr = "Test"; Tft.drawString(yStr,200,200,2,...
3
votes
1answer
17k views

Split string into an array of string

I have a SIM900 module connected to an Arduino Uno, using an AT command for listing the SMS I get this output, how can i split this based on (,) to store each data in an array? AT+CMGL="ALL" +CMGL: ...
0
votes
1answer
2k views

build fixed size strings from floats

This is likely a duplicate, but I couldn't find the original question. This is really basic, but just can't figure it out. I'm trying to combine a few char arrays together. This is what I've tried so ...
0
votes
1answer
126 views

Find number in a reply returned via serial

I am communicating with my GoPro via ESP8266 and GET requests. One of the replies returns a set of predefined number and what I would like to do is extract the number on position "38". This is what ...
1
vote
1answer
133 views

Drop alpha character from serial input

I receive strings over the serial port like so: VLT=53.0, AMP=-30.2, AHR=-10, SOC=98, TMP=136, STS=192 I want to reduce the use of string functions with the idea of dropping all non-digits, keeping ...
1
vote
1answer
55 views

Why is the result shorter than expected when I do longString.toCharArray(bigCharArr, longLength)?

I'm running this on a Particle Photon, but I think the issue is just me failing at C++. I'm trying to retrieve some JSON data from a HTTP API, convert it to JSON, and then extract a few values for ...
1
vote
2answers
129 views

Serial Data Formatting not Correct?

I am writing two Arduino Uno programs. One is a remote with a joystick and the other has five LED's indicating which direction the joystick is pointing. They are Bluetooth, so everything is sent and ...
0
votes
1answer
29 views

Join Serial Data Seperated by Newlines?

I have two Arduinos connected through Bluetooth. One sends a string of data similar to 506:507:1\r\n. The data can vary similar to 0:1000:0\r\n. I already have functions to break that string down into ...
1
vote
1answer
8k views

Extracting a substring from original string

I am trying to extract a substring out of another string, but it doesn't seem to be working. I am new to programming in arduino and c++ in general. Here is my code: void setup() { Serial.begin(...
1
vote
2answers
3k views

Get strings from Serial.read()

I want to read strings from Serial.read() to send them later. To get the data from the Serial monitor I'm doing this: String stringOne = ""; int incomingByte; if (Serial.available() > 0) { ...
0
votes
1answer
103 views

Arduino join multiple strings and numbers and then seperate them

OK, I'm working on a remote controlled robot. Both the robot and the remote use Arduino with a Bluetooth shield. The Bluetooth is working and I need to send something similar to this over Bluetooth: ...
0
votes
1answer
9k views

How to convert array of chars to array of ints?

I have a rather newbie question but I can't figure it out. Lets say I have this char array: char array[] = "10,11,12,1,0,1,0"; How can I convert it to an array of int like this? int arrayINT[] =...
0
votes
1answer
26k views

How to convert String to byte array

I have the code, it's purpose is to receive the string from a comport like: Set@1234567890123456@1234567890123456@1234567890123456@1234567890123456 and translate it into four byte arrays byte user1[16]...
0
votes
1answer
48 views

Is this method to a String from a function going to cause memory corruption?

I'd like to define a function such that I return a string and a boolean indicating whether the result is valid. Like this: bool getStringOrTimeout(String *s) { ... if (timed_out) { return ...
2
votes
2answers
161 views

A question about chars and Serial

I have the following code: int count = 0; char serial_char; char serial_message[96]; void setup(){ Serial.begin(9600); } void loop(){ while(Serial.available() > 0){ serial_char = Serial....

1
3 4
5
6 7