A
A
Alexey Saprin2015-03-20 23:02:51
Arduino
Alexey Saprin, 2015-03-20 23:02:51

What are c++ data types?

Hello,
tell me what's the matter and how to simplify my rewards?
there is a variable uint8_t buffer;
and to compare it with my string this is what I need to do

String bff(reinterpret_cast<char*>(buffer));

char *cm1 = "blahblahblah";
String cmd1(cm1);
if (bff == cmd1){ ... }

why at least the comparison does not work if you declare cmd1 like this String cmd1("blahblah"); ? the essence of the task: get data through the serial port in arduino (if interested from the
esp8266 module) and compare them with my variable from the serial, an array of ascii codes is written to it, which, in general, is translated into char and string

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Evseev, 2015-03-21
@0crash0

1) uint8_t buffer or uint8_t *buffer?
2) if the latter, then use the memcmp function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question