user50403: After using int to display text in serial monitor, now i am trying to use string but there is something wrong.
The expected reslut is "Led1 is on" in serial monitor but what i get is "285". 
This is the code involving strings.
String(ledPin1="Led1 is on");
Serial.println(ledPin1);

while this is the full code
int numledPin1Blinks=5;
int ledPin1Blinks=2;
int i;
int j;
int waiTtimeoff2=1000;
int waitTimeOn2=1000;
int ledPin2=10;
int ledPin1=13;
int waiTtimeOn1=1000;
int waiTtimeOff1=1000;
void setup() 
{pinMode(10,OUTPUT);
pinMode(13,OUTPUT);
Serial.begin(9600);
String(ledPin1="Led1 is on");

}

void loop()
{Serial.println(ledPin1);
for (i=1;i<=3;i=i+1){
Serial.print("   You are on blink 
no#:  ");
Serial.println(i);
digitalWrite(ledPin1,HIGH);
delay(waiTtimeOn1);
digitalWrite(ledPin1,LOW);
delay(waiTtimeOff1);}
Serial.println(" ");

Serial.println("Led 2 is on!");
for (j=1;j<=4;j=j+1){
Serial.print(" You are on blink no 
#:");
Serial.println(j);
digitalWrite (ledPin2,HIGH);
delay(waitTimeOn2);
digitalWrite (ledPin2,LOW);
delay(waiTtimeoff2);}
Serial.println(" ");

}


user4143: Your syntax is incorrect. You are assigning the address of a static string literal to an integer, then using the results of that assignment (the address of the string literal, as it "falls through" to the left) to create a new String object. That String object is then being thrown away.
You need to create a new String variable (not re-use one that you actively use for another part of your program) and assign a string literal to it:
String led1Message = "LED 1 is on";

Then you can print that variable instead:
Serial.println(led1Message);

HOWEVER String objects are very very fragile on the Arduino and should be avoided. Forget trying to learn to use them, since you will only have to un-learn them at a later date.  Skip them and start straight away with C-strings (NULL-terminated char arrays).  Also learn about PROGMEM.
For instance, the above could be written as:
const char led1Message[] PROGMEM = "LED 1 is on";

And then use a casting to get println to grab it from flash:
Serial.println((__FlashStringHelper*)led1Message);

This uses pretty much zero RAM, which on an Arduino is very important. Even more important it doesn't cause heap fragmentation which can cause your program to crash randomly.

50403: <p>After using int to display text in serial monitor, now i am trying to use string but there is something wrong.
The expected reslut is "Led1 is on" in serial monitor but what i get is "285". 
This is the code involving strings.</p>

<pre><code>String(ledPin1="Led1 is on");
Serial.println(ledPin1);
</code></pre>

<p>while this is the full code</p>

<pre><code>int numledPin1Blinks=5;
int ledPin1Blinks=2;
int i;
int j;
int waiTtimeoff2=1000;
int waitTimeOn2=1000;
int ledPin2=10;
int ledPin1=13;
int waiTtimeOn1=1000;
int waiTtimeOff1=1000;
void setup() 
{pinMode(10,OUTPUT);
pinMode(13,OUTPUT);
Serial.begin(9600);
String(ledPin1="Led1 is on");

}

void loop()
{Serial.println(ledPin1);
for (i=1;i&lt;=3;i=i+1){
Serial.print("   You are on blink 
no#:  ");
Serial.println(i);
digitalWrite(ledPin1,HIGH);
delay(waiTtimeOn1);
digitalWrite(ledPin1,LOW);
delay(waiTtimeOff1);}
Serial.println(" ");

Serial.println("Led 2 is on!");
for (j=1;j&lt;=4;j=j+1){
Serial.print(" You are on blink no 
#:");
Serial.println(j);
digitalWrite (ledPin2,HIGH);
delay(waitTimeOn2);
digitalWrite (ledPin2,LOW);
delay(waiTtimeoff2);}
Serial.println(" ");

}
</code></pre>
 4143: <p>Your syntax is incorrect. You are assigning the address of a static string literal to an integer, then using the results of that assignment (the address of the string literal, as it "falls through" to the left) to create a new String object. That <code>String</code> object is then being thrown away.</p>

<p>You need to create a <em>new</em> <code>String</code> variable (not re-use one that you actively use for another part of your program) and assign a string literal to it:</p>

<pre><code>String led1Message = "LED 1 is on";
</code></pre>

<p>Then you can print <em>that</em> variable instead:</p>

<pre><code>Serial.println(led1Message);
</code></pre>

<p><strong>HOWEVER</strong> <code>String</code> objects are very very fragile on the Arduino and should be avoided. Forget trying to learn to use them, since you will only have to un-learn them at a later date.  Skip them and start straight away with C-strings (NULL-terminated <code>char</code> arrays).  Also learn about <a href="https://www.arduino.cc/reference/en/language/variables/utilities/progmem/" rel="nofollow noreferrer"><code>PROGMEM</code></a>.</p>

<p>For instance, the above could be written as:</p>

<pre><code>const char led1Message[] PROGMEM = "LED 1 is on";
</code></pre>

<p>And then use a casting to get <code>println</code> to grab it from flash:</p>

<pre><code>Serial.println((__FlashStringHelper*)led1Message);
</code></pre>

<p>This uses pretty much zero RAM, which on an Arduino is very important. Even more important it doesn't cause heap <a href="https://en.wikipedia.org/wiki/Fragmentation_(computing)" rel="nofollow noreferrer">fragmentation</a> which can cause your program to crash randomly.</p>
