<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Arduino%2FC2%2FDisplay-counter-using-Arduino%2FEnglish-timed</id>
		<title>Arduino/C2/Display-counter-using-Arduino/English-timed - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Arduino%2FC2%2FDisplay-counter-using-Arduino%2FEnglish-timed"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;action=history"/>
		<updated>2026-04-22T13:07:12Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;diff=44877&amp;oldid=prev</id>
		<title>Sandhya.np14 at 08:34, 23 October 2018</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;diff=44877&amp;oldid=prev"/>
				<updated>2018-10-23T08:34:37Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;amp;diff=44877&amp;amp;oldid=44777&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Sandhya.np14</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;diff=44777&amp;oldid=prev</id>
		<title>Pratik kamble: Created page with &quot;{| Border = 1 | '''Time''' |'''Narration'''  |- | 00:01 | Welcome to the''' Spoken Tutorial''' on''' Display counter using Arduino.'''  |- |00:07 |In this tutorial, we will le...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Arduino/C2/Display-counter-using-Arduino/English-timed&amp;diff=44777&amp;oldid=prev"/>
				<updated>2018-10-16T05:47:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| Border = 1 | &amp;#039;&amp;#039;&amp;#039;Time&amp;#039;&amp;#039;&amp;#039; |&amp;#039;&amp;#039;&amp;#039;Narration&amp;#039;&amp;#039;&amp;#039;  |- | 00:01 | Welcome to the&amp;#039;&amp;#039;&amp;#039; Spoken Tutorial&amp;#039;&amp;#039;&amp;#039; on&amp;#039;&amp;#039;&amp;#039; Display counter using Arduino.&amp;#039;&amp;#039;&amp;#039;  |- |00:07 |In this tutorial, we will le...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| Border = 1&lt;br /&gt;
| '''Time'''&lt;br /&gt;
|'''Narration'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:01&lt;br /&gt;
| Welcome to the''' Spoken Tutorial''' on''' Display counter using Arduino.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|00:07&lt;br /&gt;
|In this tutorial, we will learn to:&lt;br /&gt;
&lt;br /&gt;
Connect an''' LCD''' and a '''Push button''' to''' Arduino''' board and&lt;br /&gt;
 &lt;br /&gt;
Write a program to increase the count whenever the '''pushbutton''' is pressed'''.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:22&lt;br /&gt;
| To follow this tutorial, you should have:&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of''' Electronics '''and&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of''' C''' or''' C++''' programming language&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:34&lt;br /&gt;
| To record this tutorial, I am using:&lt;br /&gt;
&lt;br /&gt;
'''Arduino UNO Board'''&lt;br /&gt;
'''Ubuntu Linux 14.04''' operating system and&lt;br /&gt;
'''Arduino IDE'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:47&lt;br /&gt;
| In an earlier tutorial in this series, we had created a circuit using '''Arduino''' and '''LCD'''.&lt;br /&gt;
We will use the same '''circuit''' in this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:00&lt;br /&gt;
| Here, we will add a '''pushbutton''' and make a simple counter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:06&lt;br /&gt;
|We have already learnt about the working of pushbutton in an earlier tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:12&lt;br /&gt;
| Now let us learn the connection circuit details.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:17&lt;br /&gt;
| A '''pushbutton '''is connected to a '''100 ohm resistor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:22&lt;br /&gt;
|The''' pushbutton''' is connected to '''pin '''number''' 7 '''and a '''100 ohm resistor''' is connected to the '''ground'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:31&lt;br /&gt;
|All other connections are exactly the same as in our previous experiment.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:37&lt;br /&gt;
| This is the live setup of the connection, as shown in the circuit diagram.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:44&lt;br /&gt;
| Now we will write a program in the '''Arduino IDE.'''So let’s switch to the '''Arduino IDE'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:54&lt;br /&gt;
| First, we need to include the '''Liquid crystal library.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:59&lt;br /&gt;
| Type the code as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:02&lt;br /&gt;
|I have initialized a variable '''lcd '''of type''' LiquidCrystal. '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:08&lt;br /&gt;
|Here, '''pin '''number''' 12''' is initialized as '''Register''' '''Select '''and '''pin '''number''' 11''' as '''Enable.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:19&lt;br /&gt;
|The next 4 parameters represent '''data lines''' of '''LCD.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:25&lt;br /&gt;
| In the '''void setup function''', type '''lcd.begin 16 comma 2 '''as shown.&lt;br /&gt;
This command initializes the '''LCD''' with rows and columns.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:41&lt;br /&gt;
| Next we will setup the '''pin '''number''' 7''' as '''INPUT'''.Type the code as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:49&lt;br /&gt;
|In another way, we can store the '''pin''' number in a variable '''pbutton.'''&lt;br /&gt;
Let us define the '''pbutton '''variable as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:01&lt;br /&gt;
| Now we will write the code for '''void loop.'''&lt;br /&gt;
Whenever the '''pushbutton''' is pressed, one count is increased on the '''LCD'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:11&lt;br /&gt;
| We will write a simple '''if statement''' to check whether the '''pushbutton''' is pressed or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:19&lt;br /&gt;
| Before displaying the count, let us check the status of the button.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:25&lt;br /&gt;
|This command will set the cursor position in the '''LCD'''.&lt;br /&gt;
&lt;br /&gt;
'''lcd.print''' will print the message.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|03:35&lt;br /&gt;
| We will now '''compile''' and '''upload''' the program. Now, I will press the '''pushbutton'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:43&lt;br /&gt;
| Here we see the message '''“button pressed”''' in the '''LCD'''. &lt;br /&gt;
It shows that the '''pushbutton''' is working successfully.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:54&lt;br /&gt;
| Next we will modify the program to set a '''counter'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:58&lt;br /&gt;
| We need a variable for counter. Now, we will initialize the variable '''count''' to '''zero'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:08&lt;br /&gt;
| Modify the '''print''' statement as shown here.&lt;br /&gt;
&lt;br /&gt;
'''count++ '''will increase the count by one, each time the button is pressed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:21&lt;br /&gt;
|Let us now '''compile''' and '''upload''' the program. Now, I will press the '''pushbutton'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:29&lt;br /&gt;
| It didn't work as expected. We see a different count displayed here.&lt;br /&gt;
Why is this so?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:37&lt;br /&gt;
| This is because we specified the status for button pressed.&lt;br /&gt;
But we didn't mention the status for button released.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:46&lt;br /&gt;
|The output shows the incremented number based on the button pressed time.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:52&lt;br /&gt;
| So, we will write a '''while statement,''' as shown here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:57&lt;br /&gt;
|This will display the count when the '''pushbutton''' is in pressed state. &lt;br /&gt;
&lt;br /&gt;
That means the '''pin 7''' is in '''HIGH''' mode.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:07&lt;br /&gt;
|When you release the button, the state is '''LOW''' and it will come out of the '''while''' '''loop'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:14&lt;br /&gt;
| Let me explain the program.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:17&lt;br /&gt;
|The program starts with initialization of the '''LCD'''. We have the variable '''pbutton '''and''' count.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:26&lt;br /&gt;
|Inside the '''void setup function''', we have initialized the '''LCD''' with 16 columns and 2 rows.&lt;br /&gt;
Then the '''pinMode''' is input for the '''pin '''number''' 7'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:42&lt;br /&gt;
|In the''' void loop function''', we are checking the condition whether the '''pushbutton''' is '''HIGH''' or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:49&lt;br /&gt;
|When the '''pushbutton''' is pressed, the cursor is set to position zero comma zero.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:56&lt;br /&gt;
|The '''lcd.print statement '''will print the count value.&lt;br /&gt;
Initially '''count''' is zero. '''Count plus plus''' would be 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:09&lt;br /&gt;
|When the button is released, it will break the '''while''' '''loop''' and come out of the loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:15&lt;br /&gt;
|Again, if you press the button, the next iteration begins and it increases the count.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:23&lt;br /&gt;
| Let us '''compile''' and '''upload''' the program.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:27&lt;br /&gt;
| Now I'll press the button once and release it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:32&lt;br /&gt;
| Again I'll press and release the button.You can see that the count is increased whenever the button is pressed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:42&lt;br /&gt;
| This brings us to the end of this tutorial. Let us summarize.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:47&lt;br /&gt;
|In this tutorial, we learnt to:&lt;br /&gt;
&lt;br /&gt;
Connect an''' LCD''' and '''pushbutton''' to''' Arduino''' board and&lt;br /&gt;
 &lt;br /&gt;
Write a program to display the count''' '''whenever the pushbutton is pressed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:03&lt;br /&gt;
| Do the following assignment.&lt;br /&gt;
&lt;br /&gt;
Change the same program to display the count as 2,4,6 and so on.&lt;br /&gt;
&lt;br /&gt;
'''Compile''' and '''upload''' the program and&lt;br /&gt;
&lt;br /&gt;
Observe the count displayed in the '''LCD'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:21&lt;br /&gt;
| The video at the following link summarizes the Spoken Tutorial project. Please download and watch it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:29&lt;br /&gt;
| The''' Spoken Tutorial Project''' Team:&lt;br /&gt;
conducts workshops and gives certificates.For more details, please write to us.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:38&lt;br /&gt;
| Please post your timed queries in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:42&lt;br /&gt;
| Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.More information on this mission is available at this link.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:53&lt;br /&gt;
|This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, '''IIT Bombay'''. Thanks for watching.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pratik kamble</name></author>	</entry>

	</feed>