Send a binary number in content using


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

However, when using"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"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?

Maybe try sprintf ?


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 = "";
  emailSubject = "My Subject";
  emailMessage = "My binary number is: ";
  emailMessage += String(bFlag);, emailSubject, emailMessage);
1 Like

Thanks your suggestion!
Similar to yours.

String message;
message = String(bFlag, BIN);, subject, message);

Successful to send out binary!

1 Like