All Questions
Tagged with programming string
37 questions
0
votes
1
answer
1k
views
Optimised random alphanumeric string generator
I'm trying to build arduino nonce generator, but the only thing I found is this question on arduino forum but I can't find out how to make it work for me. I checked and Serial.available() is always 0 ...
1
vote
2
answers
11k
views
Read Comma Separated String
I have a string that looks like this "10.00,20.00,-50.00," in which these are angle values and they have 2 decimals and can be negative. I want to separate them into 3 separate floats. Here ...
1
vote
1
answer
339
views
How do i improve this Code? (or how to pass a Char String into a Function to behave like a Variable)
Sorry i am a beginner and amateur when it comes to coding, can somebody help me to make the code inside the loop() less "monkey-like" by using a proper function?
I have tried a lot and at ...
3
votes
4
answers
3k
views
String to float on Arduino
I'm trying to convert a String to a float but I'm running into issues with precision, even with the Arduino's own String example I'm getting bad results.
Example 0:
Input string: 1.234567 After ...
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
votes
1
answer
973
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 ...
1
vote
1
answer
305
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....
2
votes
3
answers
733
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
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 ...
0
votes
1
answer
361
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
votes
1
answer
2k
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
vote
1
answer
128
views
SoftwareSerial + Serial.printlen() not working properly
I want to read a SMS message , find it's length and do some "substring();" operation on received SMS. My last two(2) statements do not work . How can I get correct answers? What are correct codes ?
...
1
vote
1
answer
1k
views
Select from Custom Array without Repeat
I found this great code to pick a random number from a "hat" without repeat:
/* RandomHat
Paul Badger 2007 - updated for Teensy compile 2017
choose one from a hat of n consecutive choices each ...
2
votes
3
answers
3k
views
How to compare two string?
I meet a terrible problem. I can't compare two string!
My job is simple, every 1ms use SoftwareSerial read_card(2, 3);to check if i read a id card.And don't read a card twice.Here are my code:
bool ...
1
vote
2
answers
512
views
Convert Bitstring to Textstring
I have an Arduino Uno which is going to receive a long binary string. I know that this string will correspond to English when decoded. How can I convert the incoming binary string to text, so that I ...