Question: /* Basic_Strings sketch */ String text1 = This string; String text2 = has more text; String text3; // to be assigned within the sketch

/*
Basic_Strings sketch
*/
String text1 = "This string";
String text2 = " has more text";
String text3; // to be assigned within the sketch
void setup()
{
Serial.begin(9600);
Serial.print( text1);
Serial.print(" is ");
Serial.print(text1.length());
Serial.println(" characters long.");
Serial.print("text2 is ");
Serial.print(text2.length());
Serial.println(" characters long.");
text3 = text1+text2;
Serial.println("text3 contains: ");
Serial.println(text3);
Serial.println(text2.indexOf('m'));
Serial.println(text3.indexOf('m'));
}
void loop()
{
}
code 1
Modify the code according to the lecture in a way that it stops once the variable is close to
zero.
Code 2
when the variable is close to zero print the message in the serial monitor and stop
decrementing.
Code 3
Use addition operator to combine the values of text1 and text2
Make the program find the index of character m in both strings text2 and text3.
Change the data types String to char to try array of characters to assign text and
messages to the variables text1,text2 and text3
Replace text#.length() in the original code with strlen(text#)
Replace text#.concat(text#) in the original code with strcpy(text#,text#)
Using strcmp function, compare text3 with text1+text2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!