All Questions
16 questions
12
votes
6
answers
5k
views
Using String instead of C string, yet another attempt to touch a loaded issue
I've been reading a lot over the years why we should not use the notorious String class and how heap fragmentation is bad practice and not professional and we should never use it in our programs or we'...
1
vote
1
answer
634
views
Cannot compile F() macro with R"string"
I am trying to compile the following code:
logger.log_info(F(R"(some text here that may take
multiple lines
and here it is done.)"));
But the compiler exists with the following ...
0
votes
2
answers
193
views
Add char at intervals in a String
I'm trying to create a function that will take a String as an input, and at every 20 characters, it will instert "\n" so that the string doesn't go off the side of my screen (I'm using an ...
2
votes
2
answers
1k
views
Mixed structure with int and string
I want to create a structure like this:
struct commands
{
int cmd;
char descr[25];
};
commands cmds[] =
{
{16, "Hammond Organ"},
{17, "Percussive Organ"},
{18, "Rock Organ"},
{ 0, "" ...
1
vote
2
answers
1k
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 ...
3
votes
4
answers
15k
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(...
1
vote
0
answers
707
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));
...
0
votes
2
answers
500
views
How do i send ads1115 data over spi to master arduino
I am trying to send ADS 1115 data which is connected with Arduino mega_1 over I2C and arduino Mega_1 is connected with arduino Mega_0 over SPI.
Arduino Mega_1 is act as a slave and send ADS 1115 data ...
1
vote
2
answers
278
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 ...
2
votes
2
answers
7k
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 ...
2
votes
1
answer
93
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
1
answer
4k
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
1
answer
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[] = ...
5
votes
1
answer
36k
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
2
answers
138
views
Problems splitting a string to get authentication and command
Good afternoon,
In a nutshell I'm having some difficulty with splitting and returning part of a string.
Essentially I'm working on the code for transmitting a password (24 character string) and ...