A sequence of characters -- including letters, numbers and symbols -- often used for representing information in a human-readable format.
1
vote
1answer
56 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
47 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
29 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
23 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
51 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
62 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 ...
0
votes
2answers
50 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 ...
0
votes
0answers
22 views
How to randomise a string?
I have a String key = "JcIcLzjbT0". I want randomise and shuffle it. How to achieve that?
1
vote
1answer
103 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 ...
1
vote
1answer
38 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
24 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 ...
1
vote
5answers
99 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
47 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++) {
...
3
votes
1answer
46 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 ...
0
votes
0answers
179 views
Parsing GET function + ESP8266 + ARDUINO IDE
I am working on a ESP and making it a simple Http web server. I have successfully ON/OFF the led using the browser. I need to use PWM, instead of Switching the led. As of now When I hit http://192.168....
0
votes
0answers
53 views
Arduino UNO stops working after a while - SOLVED
So I was looking after this problem of course, but I cannot guess what the problem can be.
I am using Arduino UNO with a matrix module and it after I upload the program it works correctly always for ...
1
vote
1answer
257 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); //...
0
votes
1answer
89 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
137 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
59 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
0answers
159 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
282 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
35 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
80 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 ...
0
votes
1answer
143 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
40 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
50 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 ...
0
votes
1answer
18 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
25 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
31 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 ...
-1
votes
1answer
14 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
153 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
173 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
46 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
70 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
2k 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
22 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 ...
1
vote
2answers
74 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 = ...
3
votes
3answers
344 views
Send multiple sensor values over serial
I want to send a JSON string over serial from arduiono device to my computer. The JSON string contains a sensor value array. To fill this array I use String.concat("value") function. But If I have ...
0
votes
1answer
101 views
How to append float value of into a string ?
I have a float variable lng = 33.785469 and lat = 78.126548. Now can I convert them to String and append in a String variable "my_location" as "your location is \nlng = 33.785469 \nlat = 78.126548". I ...
1
vote
1answer
78 views
How to split a string received via a GSM module (message)
I am doing a motorcycle security system. In this system, I will receive a message from GSM in the form {password:operation (like start,stop,alarm):time}.
Example:(9990:start:30)
now i need to split ...
0
votes
4answers
108 views
Splitting String from Serial
I am currently working on a program for an Arduino uno and want to, in the program, when it receives a 16 digit number from a serial transmition, it will split the 16 digit number into 4 separate 4 ...
2
votes
2answers
1k views
How can I pass a char array as the parameter to a function?
I am creating a menu for adjusting system variables.
The menu is made up of pointers like so:
char* options4[] = {"hMin1", "hMax1", "refr1", "fSpeed1"};
I want to pass the selected string as the ...
0
votes
3answers
172 views
Arduino subtracting chars from strings
Hello I have an Arduino programme that has a string with the words hello in it.
I can add characters and other strings to the end of that one using:
String test = "hello";
test+=" jack";
it ...
0
votes
2answers
468 views
How to clear of contents of string in Arduino?
Currently I convert the characters in char received[20] to string using String randomString(received) and I am able to display it using Serial.println(randomString). After displaying the string, I ...
3
votes
1answer
82 views
What is the memory expense of creating a String from a char array?
I'm writing a little API for processing email messages in Arduinos. Obviously, I need to keep memory use down, but I also want to allow the end user to use the String functions (like indexOf) to ...
2
votes
4answers
1k views
What is better: one sprintf() or multiple strcat() and itoa()?
I was creating Arduino function which sends two int and additional chars between them and at the beginning and end of char array - then print that array to the serial port in almost real time. (For ...
-1
votes
3answers
332 views
Array of strings - how to determine the number of elements present
I would like to use an array of strings which I define as follows:
char* CommandQueue[]={"FirstCommend", "SecondCommend", "ThirdCommand", "Cmd4", "Cmd5"};
The purpose of this array is to hold ...
2
votes
1answer
109 views
Run code via NRF24L01+ command “dynamically”?
I'm trying to make a home automation setup but I'm having a bit of trouble.
I want to be able to send commands of varying sizes to my arduino, separated by "|" and after receiving it completely it ...
4
votes
2answers
778 views
Simple URL decoding
How can I do a readable, small, smart and good URL decoder in Arduino?
Now I'm using this code:
String GetRidOfurlCharacters(String urlChars)
{
urlChars.replace("%0D%0A", String('\n'));
...