user-1: Please explain in detail. How the Hexadecimal code has been assigned?
Edit: This is the code:
#include <Wire.h> 
void setup() 
{
   Wire.begin(); 
   Serial.begin(9600); 
   delay(1000); 
   Serial.println("AT+CMGF=1"); //set to SMS mode
   delay(1000);
   Serial.println("AT+CMGS=\"+918460588440\""); //set the phone number (wrapped in double quotes)
   delay(1000);
   Serial.println("hello world. this is arduino");
   delay(1000);
   Serial.write(0x1A); // sends ctrl+z end of message
   delay(1000);
   Serial.write(0x0D); // Carriage Return in Hex
   delay(1000);
   Serial.write(0x0A);
}
void loop() {}


user4143: They are all to do with where in the alphabet they are.  There are 26 letters in the English alphabet, and Z is the 26th.  The 26 in hexadecimal is 0x1A.
A carriage return is a CTRL-M, and a line feed is a CTRL-J.  M is the 13th letter of the alphabet, and 13 in hexadecimal is 0x0D.  J is the 10th letter - 10 is 0x0A in hexadecimal.
Why are they CTRL-M and CTRL-J?  Well, that all stems from the old teletype interfaces used on the very early computers.  That's what they used, and that's what's stuck, and finally made it into the ASCII standard.

-1: <p>Please explain in detail. How the Hexadecimal code has been assigned?</p>

<p>Edit: This is the code:</p>

<pre><code>#include &lt;Wire.h&gt; 
void setup() 
{
   Wire.begin(); 
   Serial.begin(9600); 
   delay(1000); 
   Serial.println("AT+CMGF=1"); //set to SMS mode
   delay(1000);
   Serial.println("AT+CMGS=\"+918460588440\""); //set the phone number (wrapped in double quotes)
   delay(1000);
   Serial.println("hello world. this is arduino");
   delay(1000);
   Serial.write(0x1A); // sends ctrl+z end of message
   delay(1000);
   Serial.write(0x0D); // Carriage Return in Hex
   delay(1000);
   Serial.write(0x0A);
}
void loop() {}
</code></pre>
 4143: <p>They are all to do with where in the alphabet they are.  There are 26 letters in the English alphabet, and Z is the 26th.  The 26 in hexadecimal is 0x1A.</p>

<p>A carriage return is a CTRL-M, and a line feed is a CTRL-J.  M is the 13th letter of the alphabet, and 13 in hexadecimal is 0x0D.  J is the 10th letter - 10 is 0x0A in hexadecimal.</p>

<p>Why are they CTRL-M and CTRL-J?  Well, that all stems from the old teletype interfaces used on the very early computers.  That's what they used, and that's what's stuck, and finally made it into the ASCII standard.</p>
