BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Send a binary number in content using Blynk.email?


#1

Hi

I have stored a volatile byte called [bFlag]
It should be a binary number during my calculation (e.g. 1010)

However, when using
Blynk.email("email address", "Subject", bFlag)
If bFlag is now equal to 0010, the email will send the content into “2”, which means decimal.

Even I used
Blynk.email("email address", "Subject", (bFlag, BIN))

The email still send out a decimal number.
BTW, I can see the binary number in serial monitor by using
Serial.println(bFlag, BIN);

What should I do if I really want to send out a binary number?


#2

Maybe try sprintf ?

Pete.


#3

Convert your binary to a String and concat any additional strings together before building the email?

This is untested and off the cuff… so may work or may just be blowing magic smoke :stuck_out_tongue_winking_eye:

  emailAddress = "me@here.com";
  emailSubject = "My Subject";
  emailMessage = "My binary number is: ";
  emailMessage += String(bFlag);

  Blynk.email(emailAddress.c_str(), emailSubject, emailMessage);

#4

Thanks your suggestion!
Similar to yours.

String message;
message = String(bFlag, BIN);
Blynk.email(address, subject, message);

Successful to send out binary!