Back to Step by Step Course by Robojax

Lesson 57: Using Array and Loop with Arduino

If you don't like to see ads while video is being played you can purchase YouTube premium Here

Lesson 57: Using Array and Loop with Arduino

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

Part 6: Arduino Practial Programming

In this lesson we learn how what an array is and how to define it. Please watch full details video. list of tipcs listed below.
Code in this page: reading age and marks.

  • 00:00 what is array?
  • 02:52 Reading Array values
  • 04:41 Updating array values
  • 06:44 Defining empty array : integer
  • 08:31 Defining empty array: float
  • 10:58 Working with loops
  • 15:30 Reading values of array (code in this page)
  • 16:51 Demo: Reading values
  • 17:34 filling up an array with float data type
  • 18;48 reading and printing each element of array
  • 19:55 Project: 4 LEDs with array
  • 21:22 Project: wiring
  • 23:26 demo: 4 LEDs
  • 23:46 demo 2: 4 LEDs
  • 24:05 code: 2
  • 24:51 Comparing two codes

  int age[] = { 25, 21, 23, 30 } ;

void setup() {
  Serial.begin(9600);// initialize serial monitor
  
 Serial.println(age[1]);// print value of age of index 1 (prints 21)
 Serial.println(age[0]);// print value of age of index 0 (prints 25)
 Serial.println(age[2]);// print value of age of index 2 (prints 23)
 Serial.println(age[3]);// print value of age of index 3 (prints 30) 
 Serial.println("=============");   
 
 age[1] = 42;
 age[3] = 22;
 age[0] = 18;
 age[2] = 20; 

 Serial.println(age[1]);// print value of age of index 1 (prints 42)
 Serial.println(age[0]);// print value of age of index 0 (prints 18)
 Serial.println(age[2]);// print value of age of index 2 (prints 20)
 Serial.println(age[3]);// print value of age of index 3 (prints 22)   
 Serial.println("============="); 
 // defining emptry array for 4 falues
 // age[] has been used above so we can't re-define it.
 // we have use new name. I am using marks.
 float marks[4];// 
 marks[0]= 49.5;
 marks[1]= 45.7;
 marks[2]= 36.2;
 marks[3]= 40.7; 
  
 Serial.println(marks[1]);// print value of marks of index 1 (prints 45.7)
 Serial.println(marks[0]);// print value of marks of index 0 (prints 49.5)
 Serial.println(marks[2]);// print value of marks of index 2 (prints 36.2)
 Serial.println(marks[3]);// print value of marks of index 3 (prints 40.7)     
}

void loop() {
    

}



   

The least I expect from you is to thumb up the video and subscribe to my channel. I appriciate that. .I have spent months making these lectures and writing code. You don't lose anything by subscribging to my channel. Your subscription is stamp of approval to my videos and more people can find them and in it turn it helps me. Thank you

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

Right Side
footer