Robojax

Lesson 06: Introduction to Arduino Data Types

Lesson 06: Introduction to Arduino Data Types

Please select other codes for this lecture from the links below.

This code is part of Lecture 06 Data Types: Character

Char documentation: https://www.arduino.cc/reference/en/language/variables/data-types/string/


 /*
* This code is part of Step by Step Ardunio Course 
   Code: Lecture 06-5
 * Arduino Variable and Data Types: String
 
with over 100 lectures Free On  YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339 
 * Written by Ahmad Shamshiri for Robojax, robojax.com http:youTube.com/robojaxTV
 * Feb 10, 2019  
 Please watch video instruction here https://youtu.be/n0z6fjww8eA
 This code is available at http://robojax.com/course1/?vid=lecture06
 
 */
void setup() {

String string1 = "Hello String";                        // using a constant String
String string2 =  String('a');                          // converting a constant char into a String
String string3 =  String("This is a string");           // converting a constant string into a String object
String string4 =  String(string3 + " with more");     // concatenating two strings
String string5 =  String(13);                           // using a constant integer
String string6 =  String(45, HEX);                      // using an int and a base (hexadecimal)
String string7 =  String(255, BIN);                     // using an int and a base (binary)
String string8 =  String(5.698, 2);                     // using a float and the decimal places
	
 Serial.begin(9600);
 Serial.println("Robojax Step By Step Arduino Course");
 	//Robojax Step By Step Arduino Course http://robojax.com/L/?id=338

 Serial.print("String1:");
 Serial.println(string1);
 Serial.println();
  
 Serial.print("String2:");
 Serial.println(String('a'));
 Serial.println();

 Serial.print("string3:");
 Serial.println(string3);
 Serial.println();

 Serial.print("string3 + \" with more\":");
 Serial.println(string4);
 Serial.println();

 Serial.print("string5:");
 Serial.println(string5);
 Serial.println();

 Serial.print("String(45, HEX):");
 Serial.println(string6);
 Serial.println();

 Serial.print("String(255, BIN):");
 Serial.println(string7);
 Serial.println();

 Serial.print("String(5.698, 3):");
 Serial.println(string8);
 Serial.println(); 
}

void loop() {
  // put your main code here, to run repeatedly:

}