Difference between revisions of "Arduino/C2/First-Arduino-Program/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) (Created page with " {| border=1 |'''Time''' | '''Narration''' |- | 00:01 | Welcome to the''' Spoken Tutorial''' on''' First Arduino Program.''' |- | 00:06 | In this tutorial, we will learn how...") |
Sandhya.np14 (Talk | contribs) |
||
Line 10: | Line 10: | ||
|- | |- | ||
| 00:06 | | 00:06 | ||
− | | In this tutorial, we will learn how to: | + | | In this tutorial, we will learn how to: |
+ | write an '''Arduino''' program, | ||
− | '''Compile''' and''' upload''' the program and Blink an''' LED''' | + | '''Compile''' and''' upload''' the program |
+ | and Blink an''' LED'''. | ||
|- | |- | ||
| 00:19 | | 00:19 | ||
− | | Here, I am using: '''Arduino UNO Board''' | + | | Here, I am using: |
+ | '''Arduino UNO Board''', | ||
|- | |- | ||
|00:23 | |00:23 | ||
− | | '''Ubuntu Linux | + | | '''Ubuntu Linux 14.04 operating system''' and |
+ | '''Arduino IDE'''. | ||
|- | |- | ||
|00:30 | |00:30 | ||
− | | To follow this tutorial, you should have: | + | | To follow this tutorial, you should have: basic knowledge of Electronics, |
|- | |- | ||
|00:36 | |00:36 | ||
− | | | + | | basic knowledge of writing a''' C''' or''' C++''' program, |
|- | |- | ||
|00:41 | |00:41 | ||
− | | | + | | and, '''Arduino UNO Board''' with''' USB power cable'''. |
|- | |- | ||
Line 52: | Line 56: | ||
|- | |- | ||
| 01:11 | | 01:11 | ||
− | | You can change the name by clicking on '''File '''and then on '''Save'''. | + | | You can change the name by clicking on '''File '''and then on '''Save'''. |
|- | |- | ||
Line 66: | Line 70: | ||
|- | |- | ||
| 01:35 | | 01:35 | ||
− | | Now, we will write an''' Arduino''' program to | + | | Now, we will write an''' Arduino''' program to blink the '''LED.''' |
|- | |- |
Revision as of 07:33, 23 October 2018
Time | Narration |
00:01 | Welcome to the Spoken Tutorial on First Arduino Program. |
00:06 | In this tutorial, we will learn how to:
write an Arduino program, Compile and upload the program and Blink an LED. |
00:19 | Here, I am using:
Arduino UNO Board, |
00:23 | Ubuntu Linux 14.04 operating system and
Arduino IDE. |
00:30 | To follow this tutorial, you should have: basic knowledge of Electronics, |
00:36 | basic knowledge of writing a C or C++ program, |
00:41 | and, Arduino UNO Board with USB power cable. |
00:46 | Let us open the Arduino IDE to write our first program. |
00:52 | Here, we can see various menus in the Menu bar. |
00:57 | In Arduino environment, each program is saved as Sketch. |
01:03 | By default, it creates the name as Sketch underscore and a name. |
01:11 | You can change the name by clicking on File and then on Save. |
01:18 | Type the filename as BlinkLed.
Now click on the Save button. |
01:26 | This is the default program environment with two empty functions -void setup and void loop. |
01:35 | Now, we will write an Arduino program to blink the LED. |
01:41 | I have placed my IDE and the Arduino board side by side. |
01:47 | This will help us to see the execution of the program and the output in the board. |
01:54 | For this LED program, I want to blink pin number 13. |
02:00 | It is a digital input/output pin connected to this LED internally. |
02:07 | Notice the highlight with the marker. |
02:10 | Now, we have to write our code. |
02:13 | void setup function stands for setting up a microcontroller. |
02:18 | In our case, pin number 13 has to be set up first. |
02:24 | To do this, we will use an in-built function called pinMode. |
02:31 | It has two parameters - pin number comma mode. |
02:36 | So, type pinMode open brackets 13 comma output close brackets semicolon |
02:48 | Why should we keep the mode as output? |
02:51 | This is because the pin number 13 is internally connected to the LED. |
02:58 | It will glow when the voltage is high but it will not glow when the voltage is zero. |
03:05 | We have to configure mode as ‘output’ to serve voltage to the LED. |
03:12 | Next we will write code to the void loop function. |
03:17 | Before we blink a LED, let us glow a LED. |
03:22 | There is a function called digitalWrite which will write to a digital pin. |
03:29 | This function has two parameters as pin number and value or state. |
03:36 | Already, we know the pin number as 13. The value should be HIGH or LOW. |
03:44 | So, type: digitalWrite open brackets 13 comma HIGH close brackets semicolon |
03:55 | We want to glow the LED. So, the voltage should be HIGH. |
04:00 | That's all. The code is very simple. |
04:04 | Next step is to compile the program. |
04:08 | Click on the Tick icon on the Menu bar to verify the program. |
04:14 | This will compile our program into binary format which is understandable by the microcontroller. |
04:22 | You can see the compilation status at the bottom of the IDE. |
04:27 | Next we need to upload the program to the microcontroller. |
04:32 | Click on Right arrow button on the menu bar to upload.
Alternately, you can select Sketch menu and then upload. |
04:48 | You can see the TX RX blinks for a while. This indicates the transmission is ON. |
04:57 | Now you can see the LED is glowing. |
05:01 | How to turn off the LED?
We have to modify this program such that the second parameter value is LOW. |
05:11 | Now, let us compile and upload this program. |
05:16 | You can see the LED is off now. |
05:20 | We know how to turn ON and OFF the LED. |
05:25 | Next we will modify the program to make the LED to blink. |
05:31 | That is ON and OFF, with one second interval. |
05:36 | We will change the program as shown: Delay is a built-in function which pauses the program for certain amount of time. |
05:46 | I will type: delay open brackets 500 close brackets semicolon
Here 500 means, 500 milliseconds, that is, half a second of delay. |
06:01 | Next, type as digitalWrite open brackets 13 comma LOW close brackets semicolon |
06:12 | This makes the digital pin 13 to OFF mode. |
06:17 | How long we want to turn it OFF?
Type: delay open brackets 500 close brackets semicolon |
06:28 | Again, we want to OFF it for 500 milliseconds. |
06:34 | Let me explain the Void loop program line by line again. |
06:40 | Void loop is an infinite loop and it will execute continuously. |
06:45 | The pin number 13 connected to the LED will be in HIGH state for 500 milliseconds. And then in the LOW state for 500 milliseconds. |
06:57 | This program is executed repeatedly in the loop. |
07:02 | Let us upload the program. |
07:05 | We can see our LED is blinking. |
07:10 | This brings us to the end of this tutorial. Let us summarise. |
07:16 | In this tutorial, we learnt about: How to write an Arduino program |
07:21 | Compile and upload the program and Blink an LED |
07:27 | Do the following Assignment. Change the delay timing to 1500 in the above Blink LED program |
07:37 | Compile and upload the program
And Observe the blinking in the LED |
07:45 | The video at the following link summarizes the Spoken Tutorial project.
Please download and watch it. |
07:53 | The Spoken Tutorial Project Team: conducts workshops using spoken tutorials and gives certificates on passing online tests.
For more details, please write to us. |
08:06 | Do you have questions in THIS Spoken Tutorial? Please visit this site. |
08:13 | Choose the minute and second where you have the question.
Explain your question briefly. Someone from our team will answer them. |
08:24 | Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.
More information on this mission is available at this link. |
08:35 | This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.
Thanks for watching. |