<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-758053256516536559</id><updated>2024-11-06T08:24:29.292+05:30</updated><category term="Arduino"/><category term="Basic"/><category term="Digital"/><category term="Arduino Projects"/><title type='text'>IETian Arun</title><subtitle type='html'>Welcome to IETian In this blog you will find Electronics projects , Arduino projects, circuits and learn about many more things</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-7895472712434912017</id><published>2020-05-06T13:50:00.001+05:30</published><updated>2020-05-06T13:50:25.761+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>State exchange Detection (part Detection) for pushbuttons</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Country exchange Detection (part Detection) for pushbuttons&lt;br&gt;
As soon as you have got a pushbutton running, you frequently want to do a little motion primarily based on how frequently the button is driven. To try this, you want to know whilst the button adjustments state from off to on, and remember how usually this change of state occurs. That is called country change detection or facet detection. In this academic we discover ways to test the state trade, we send a message to the Serial display with the applicable facts and we depend four state modifications to turn on and off an LED.&lt;br&gt;
&lt;br&gt;
Hardware Required&lt;br&gt;
Arduino or Genuino Board&lt;br&gt;
Non permanent button or switch&lt;br&gt;
10k ohm resistor&lt;br&gt;
Hook-up wires&lt;br&gt;
Breadboard&lt;br&gt;
Circuit&lt;br&gt;
&lt;br&gt;
Join three wires to the board. The primary goes from one leg of the pushbutton through a pull-down resistor (right here 10k ohm) to floor. The second is going from the corresponding leg of the pushbutton to the 5 volt deliver. The 0.33 connects to a digital I/O pin (right here pin 2) which reads the button&#39;s state.&lt;br&gt;
&lt;br&gt;
Whilst the pushbutton is open (unpressed) there may be no connection among the two legs of the pushbutton, so the pin is connected to ground (via the pull-down resistor) and we read a LOW. While the button is closed (pressed), it makes a connection among its&amp;nbsp; legs, connecting the pin to voltage, in order that we read a high. (The pin is still connected to ground, however the resistor resists the float of cutting-edge, so the path of least resistance is to +5V.)&lt;br&gt;
&lt;br&gt;
If you disconnect the virtual I/O pin from the whole thing, the LED may blink inconsistently. This is because the input is &quot;floating&quot; - that is, now not linked to either voltage or floor. It will extra or less randomly return either excessive or LOW. That is why you want a pull-down resistor inside the circuit.&lt;br&gt;
&lt;br&gt;
Schematic&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPc02yzLuQjt9rSbFqQIG1vm7aF9hzSKoyhggiuojWfh2MPvlaBSXO9GGXWUQDNiAToLYQ7JoN5pVJM_GeLCEvICS8sMfSFiJQucLtPYw4TXLpyiGqJli2YcXCKO4qLOtjjsJ7-Ixf-Eg/s1600/1587880416939953-0.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img border=&quot;0&quot;   src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPc02yzLuQjt9rSbFqQIG1vm7aF9hzSKoyhggiuojWfh2MPvlaBSXO9GGXWUQDNiAToLYQ7JoN5pVJM_GeLCEvICS8sMfSFiJQucLtPYw4TXLpyiGqJli2YcXCKO4qLOtjjsJ7-Ixf-Eg/s1600/1587880416939953-0.png&quot; width=&quot;400&quot;&gt;
  &lt;/a&gt;
&lt;/div&gt;&lt;br&gt;
&lt;br&gt;
Code&lt;br&gt;
The cartoon beneath always reads the button&#39;s kingdom. It then compares the button&#39;s nation to its nation the closing time thru the principle loop. If the cutting-edge button state isn&#39;t like the last button nation and the contemporary button nation is high, then the button changed from off to on. The sketch then increments a button push counter.&lt;br&gt;
&lt;br&gt;
The caricature additionally assessments the button push counter&#39;s cost, and if it&#39;s an even more than one of 4, it turns the LED on pin 13 ON. Otherwise, it turns it off.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
/*&lt;br&gt;
&amp;nbsp; state alternate detection (aspect detection)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;regularly, you do not need to realize the kingdom of a digital enter all of the time,&lt;br&gt;
&amp;nbsp;but you simply need to recognize while the enter changes from one country to every other.&lt;br&gt;
&amp;nbsp;As an example, you want to recognize when a button goes from OFF to ON.&amp;nbsp; That is called&lt;br&gt;
&amp;nbsp;state alternate detection, or edge detection.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;This example suggests a way to locate while a button or button changes from off to on&lt;br&gt;
&amp;nbsp;and on to off.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;The circuit:&lt;br&gt;
&amp;nbsp;* pushbutton connected to pin 2 from +5V&lt;br&gt;
&amp;nbsp;* 10K resistor attached to pin 2 from floor&lt;br&gt;
&amp;nbsp;* LED connected from pin 13 to floor (or use the integrated LED on&lt;br&gt;
&amp;nbsp; &amp;nbsp;maximum Arduino forums)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;created&amp;nbsp; 27 Sep 2005&lt;br&gt;
&amp;nbsp;modified 30 Aug 2011&lt;br&gt;
&amp;nbsp;with the aid of Tom Igoe&lt;br&gt;
&lt;br&gt;
This example code is inside the public domain.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Http://www.Arduino.Cc/en/academic/ButtonStateChange&lt;br&gt;
&lt;br&gt;
&amp;nbsp;*/&lt;br&gt;
&lt;br&gt;
// this consistent won&#39;t alternate:&lt;br&gt;
Const int&amp;nbsp; buttonPin = 2;&amp;nbsp; &amp;nbsp; // the pin that the pushbutton is attached to&lt;br&gt;
Const int ledPin = thirteen;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// the pin that the LED is hooked up to&lt;br&gt;
&lt;br&gt;
// Variables will exchange:&lt;br&gt;
Int buttonPushCounter = zero;&amp;nbsp; &amp;nbsp;// counter for the range of button presses&lt;br&gt;
Int buttonState = 0;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// contemporary country of the button&lt;br&gt;
Int lastButtonState = 0;&amp;nbsp; &amp;nbsp; &amp;nbsp;// previous state of the button&lt;br&gt;
&lt;br&gt;
Void setup()&lt;br&gt;
&amp;nbsp; // initialize the button pin as a enter:&lt;br&gt;
&amp;nbsp; pinMode(buttonPin, input);&lt;br&gt;
&amp;nbsp; // initialize the LED as an output:&lt;br&gt;
&amp;nbsp; pinMode(ledPin, OUTPUT);&lt;br&gt;
&amp;nbsp; // initialize serial communique:&lt;br&gt;
&amp;nbsp; Serial.Begin(9600);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Void loop()&lt;br&gt;
&amp;nbsp; // examine the pushbutton enter pin:&lt;br&gt;
&amp;nbsp; buttonState = digitalRead(buttonPin);&lt;br&gt;
&lt;br&gt;
&amp;nbsp; // compare the buttonState to its preceding nation&lt;br&gt;
&amp;nbsp; if (buttonState != lastButtonState)&lt;br&gt;
&amp;nbsp; &amp;nbsp; // if the kingdom has modified, increment the counter&lt;br&gt;
&amp;nbsp; &amp;nbsp; if (buttonState == excessive)&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // if the modern nation is high then the button&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // wend from off to on:&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; buttonPushCounter++;&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Serial.Println(&quot;on&quot;);&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Serial.Print(&quot;quantity of button pushes:&amp;nbsp; &quot;);&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Serial.Println(buttonPushCounter);&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // if the modern-day kingdom is LOW then the button&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // wend from on to off:&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Serial.Println(&quot;off&quot;);&lt;br&gt;
&amp;nbsp; &amp;nbsp;&lt;br&gt;
&amp;nbsp; &amp;nbsp; // delay a little bit to keep away from bouncing&lt;br&gt;
&amp;nbsp; &amp;nbsp; postpone(50);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;nbsp; // save the modern-day nation because the ultimate nation,&lt;br&gt;
&amp;nbsp; //for next time thru the loop&lt;br&gt;
&amp;nbsp; lastButtonState = buttonState;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp; // turns on the LED each 4 button pushes by means of&lt;br&gt;
&amp;nbsp; // checking the modulo of the button push counter.&lt;br&gt;
&amp;nbsp; // the modulo feature offers you the remainder of&lt;br&gt;
&amp;nbsp; // the department of two numbers:&lt;br&gt;
&amp;nbsp; if (buttonPushCounter % four == zero)&lt;br&gt;
&amp;nbsp; &amp;nbsp; digitalWrite(ledPin, excessive);&lt;br&gt;
&amp;nbsp; &amp;nbsp;else&lt;br&gt;
&amp;nbsp; &amp;nbsp; digitalWrite(ledPin, LOW);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/7895472712434912017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/country-exchange-detection-part.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/7895472712434912017'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/7895472712434912017'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/country-exchange-detection-part.html' title='State exchange Detection (part Detection) for pushbuttons'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPc02yzLuQjt9rSbFqQIG1vm7aF9hzSKoyhggiuojWfh2MPvlaBSXO9GGXWUQDNiAToLYQ7JoN5pVJM_GeLCEvICS8sMfSFiJQucLtPYw4TXLpyiGqJli2YcXCKO4qLOtjjsJ7-Ixf-Eg/s72-c/1587880416939953-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-3792297125467830119</id><published>2020-04-26T16:26:00.000+05:30</published><updated>2020-04-26T16:53:49.265+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino Projects"/><title type='text'>How to make  Line Follower Robot using Arduino</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h2 class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;How to make &lt;span style=&quot;color: red;&quot;&gt;Arduino&lt;/span&gt; Line Follower Robot&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;A
 line follower robot, as the name suggests, is an automated guided 
vehicle, which follows a visual line embedded on the floor or ceiling. 
Typically, the visual line is the path in which the line follower robot 
goes and it will be a black line on a white surface but another path (a 
white line on a black surface) is also possible. Some advanced line 
follower robots use invisible magnetic fields as their paths.&lt;br /&gt;&lt;br /&gt;Large
 line follower robots are commonly used in industries to aid the 
automated production process. They are also used in military 
applications, human support purposes, delivery services, etc.&lt;br /&gt;&lt;br /&gt;The
 line follower robot is the first robot to get its first robotic 
experience with beginners and students. In this project, we have 
designed a simple line follower robot using Arduino and some other 
components.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB5AyiDwP8s9jZso2JA2GPPnrnSm8PK9pyNcEUWYon_mPFP6EtvLuKQkB-Bc8TQDOvMsFz4-qTzzyDz3ynC9KDBGa2e77H0Dv8ZAurCfxaTyPDu-691dFD9-wSfvuYz2DS89glQGycfxU/s1600/Arduino-Line-Follower-Robot-Image-6-760x440.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;440&quot; data-original-width=&quot;760&quot; height=&quot;369&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB5AyiDwP8s9jZso2JA2GPPnrnSm8PK9pyNcEUWYon_mPFP6EtvLuKQkB-Bc8TQDOvMsFz4-qTzzyDz3ynC9KDBGa2e77H0Dv8ZAurCfxaTyPDu-691dFD9-wSfvuYz2DS89glQGycfxU/s640/Arduino-Line-Follower-Robot-Image-6-760x440.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Line Follower Robot 1&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFSqHhOVJ1nU3mZknJazsXFGI-8iq671LI8eiI-52iBj_C6JtXhrwkJnSfgYUnR4-e7_M5s4X12wibX-WILnKjCHm11qthkoMhDIb8qcP0MXbB-wRCqVQxmNWJ0ILk_0v3BcbfUbb_AAo/s1600/Arduino-Line-Follower-Robot-Image-7-760x440.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;440&quot; data-original-width=&quot;760&quot; height=&quot;370&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFSqHhOVJ1nU3mZknJazsXFGI-8iq671LI8eiI-52iBj_C6JtXhrwkJnSfgYUnR4-e7_M5s4X12wibX-WILnKjCHm11qthkoMhDIb8qcP0MXbB-wRCqVQxmNWJ0ILk_0v3BcbfUbb_AAo/s640/Arduino-Line-Follower-Robot-Image-7-760x440.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Line Follower Robot 2&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEDZMLT6KQq2PopI198VJl6pVJ95UeRscuUrrBEE29KhkdpA-t5EM7GSV4Cf_xwFXnW6pqhPYlXYB5GcLPwQAklckRFqBJiLgIELBAokF6JHL8DFzIeVdrJ52uxeuoUVxviZQ2m8AnBhA/s1600/Arduino-Line-Follower-Robot-Image-8-760x440.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;440&quot; data-original-width=&quot;760&quot; height=&quot;370&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEDZMLT6KQq2PopI198VJl6pVJ95UeRscuUrrBEE29KhkdpA-t5EM7GSV4Cf_xwFXnW6pqhPYlXYB5GcLPwQAklckRFqBJiLgIELBAokF6JHL8DFzIeVdrJ52uxeuoUVxviZQ2m8AnBhA/s640/Arduino-Line-Follower-Robot-Image-8-760x440.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Line Follower Robot 3&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRMbeI38DPrDzQThTWTH5-300GaUGXLIb7XDE17EZz4o0uAJHfOWRoCD0Ynbw5YQGNpR1czx5Ae5U69_I7xbuRaZ-VBz0h2HL19U_AFrnM28cJsgWBI11td0iWOkCSdNQBUgvzvyFn8T8/s1600/Arduino-Line-Follower-Robot-Image-9-760x440.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;440&quot; data-original-width=&quot;760&quot; height=&quot;370&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRMbeI38DPrDzQThTWTH5-300GaUGXLIb7XDE17EZz4o0uAJHfOWRoCD0Ynbw5YQGNpR1czx5Ae5U69_I7xbuRaZ-VBz0h2HL19U_AFrnM28cJsgWBI11td0iWOkCSdNQBUgvzvyFn8T8/s640/Arduino-Line-Follower-Robot-Image-9-760x440.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Line Follower Robot 4&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;How to make Arduino LFR (Line Follower Robot) : Essential components&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #444444;&quot;&gt; 1. Arduino UNO (or Arduino Nano) [Buy Here]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.L293D Motor Driver IC [Buy Here]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Gear x 2&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4. Robot Chassis&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5. IR sensor module x 2&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6. Black tape (electrical insulation tape)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7. Connecting the wires&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8. Power Supply&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9. Battery Connector&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10.Battery&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;How to make Arduino Line Follower Robot : circuit diagram&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: right; margin-left: 1em; text-align: right;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYL22kVXf8cRmqhfXjJh2mGF0X3cO-l4wQAkBdPDFJfhTboYNbWLT00cKx4RgW_VLTPcm9pVna9sxt7t_juB-jka3Hf6d7u0zAGlsaQ8m9obWJa8bxShlk-L4NHzREtqLcprE6ekwZmmY/s1600/Arduino+lfr+Circuit.jpg&quot; style=&quot;clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;431&quot; data-original-width=&quot;750&quot; height=&quot;366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYL22kVXf8cRmqhfXjJh2mGF0X3cO-l4wQAkBdPDFJfhTboYNbWLT00cKx4RgW_VLTPcm9pVna9sxt7t_juB-jka3Hf6d7u0zAGlsaQ8m9obWJa8bxShlk-L4NHzREtqLcprE6ekwZmmY/s640/Arduino+lfr+Circuit.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Arduino Line Follower Robot Circuit&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Note:
 We have used a prefabricated IR sensor module consisting of an IR LED 
and a photo diode. If you do not have it, we have explained how to make 
yourself.&lt;br /&gt;&lt;br /&gt;Project block diagram&lt;br /&gt;&lt;br /&gt;The line follower robot 
manufactured in this project is divided into 4 blocks. The following 
image depicts the block diagram for the line follower robot.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5-caOWXUKZvX2FDPb06sBOBCy2y6ViweHndd4GvE1RHXkf4_a_75nd9vKQ5hjXn18v7GNk_lNN8rOr1aq74vWhDXsThQ2pNPUHoexD-DM_szuz5uZGBmt6sNtLmFXr218Vk2Gu_MYpYo/s1600/arun+Block-Diagram-768x147.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;147&quot; data-original-width=&quot;768&quot; height=&quot;122&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5-caOWXUKZvX2FDPb06sBOBCy2y6ViweHndd4GvE1RHXkf4_a_75nd9vKQ5hjXn18v7GNk_lNN8rOr1aq74vWhDXsThQ2pNPUHoexD-DM_szuz5uZGBmt6sNtLmFXr218Vk2Gu_MYpYo/s640/arun+Block-Diagram-768x147.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Block diagram description&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Sensor
 (IR sensor): We have used the IR sensor module as a sensor detection 
line for the project. It consists of an IR LED and a photo diode and 
some other components like comparator, LED etc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IR sensor module&lt;br /&gt;&lt;br /&gt;As
 mentioned earlier, we have used the pre-assembled IR sensor. If you do 
not have one, you can make your own sensor using the following circuit.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN3ht-MKeJNzZHVwKLBlR_ADMojlyVF4DjjwKYhfgsl69nbkiAYRrPpy46bmKiFU3k1iFtGWk_SgiqSGqvf0c-rY1U6pMH5n4qna5ZvbG_fwZVAiridBwiiGjEFHMUYF7pHYdAMV517As/s1600/IR-Sensor-768x544.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;544&quot; data-original-width=&quot;768&quot; height=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN3ht-MKeJNzZHVwKLBlR_ADMojlyVF4DjjwKYhfgsl69nbkiAYRrPpy46bmKiFU3k1iFtGWk_SgiqSGqvf0c-rY1U6pMH5n4qna5ZvbG_fwZVAiridBwiiGjEFHMUYF7pHYdAMV517As/s640/IR-Sensor-768x544.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&amp;nbsp;IR Sencer&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;How to make Arduino Line Follower Robot : IR sensor circuit&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid_vnKrTRZTxL9LcqaDXpTfh2Rz17z2ys6S49hFmv-WNiVJGd-VZkre-TlZnaQLPh8MhnsUQpLOAQqTP6Pm6iDBHfngFYdhctF-VJcwRCVL-OtdK5nR7LCLNuNKhnHpGMHy08x3MvJJGk/s1600/IR-Sensor-Circuit+arun.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;676&quot; data-original-width=&quot;1253&quot; height=&quot;344&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid_vnKrTRZTxL9LcqaDXpTfh2Rz17z2ys6S49hFmv-WNiVJGd-VZkre-TlZnaQLPh8MhnsUQpLOAQqTP6Pm6iDBHfngFYdhctF-VJcwRCVL-OtdK5nR7LCLNuNKhnHpGMHy08x3MvJJGk/s640/IR-Sensor-Circuit+arun.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #444444;&quot;&gt;IR Sencer Circuit&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;In this project the function of IR sensor and its scope will be explained in the actual work of line follower robot.&lt;br /&gt;&lt;br /&gt;Controller
 (Arduino UNO): Arduino UNO is the main controller in the project. The 
data from the sensor (IR sensor) will be passed to the Arduino and it 
gives the corresponding signal to the motor driver IC.&lt;br /&gt;&lt;br /&gt;Motor 
Driver (L293D): L293D Motor Driver IC is used in this project to drive 
robot motors. It receives signals from the Arduino based on the 
information from the IR sensor.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;Note: The power supply to the 
motors must be supplied from the motor driver IC. Therefore, select the 
appropriate power supply that is sufficient for all components, 
including motors.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;Motors (geared motor): We have used two 
geared motors behind the line follower robot. These motors provide more 
torque than normal motors and can also be used to lift some loads.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5qubowrNsrM725TNcaeMy85E6a7qIPEzwVtIlQnc-FrkXcsYOHo3l3ouo-pe1FXTZnRRYQzrM90YI1-t_V1HkUVjadix5cUlUWcYTXThvC3f3-rWotk3pDr4HAanX4AhG_zkSLQLjf14/s1600/Geared-Motorarun.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;478&quot; data-original-width=&quot;768&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5qubowrNsrM725TNcaeMy85E6a7qIPEzwVtIlQnc-FrkXcsYOHo3l3ouo-pe1FXTZnRRYQzrM90YI1-t_V1HkUVjadix5cUlUWcYTXThvC3f3-rWotk3pDr4HAanX4AhG_zkSLQLjf14/s400/Geared-Motorarun.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;How to make Arduino Line Follower Robot: Working of Arduino Line Follower Robot&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;In
 this project, we have designed an Arduino based line follower robot. 
The project work is very simple: find the black line on the surface and 
move along that line. Detailed work is explained here.&lt;br /&gt;&lt;br /&gt;As 
mentioned in the block diagram, we need a sensor to detect the line. For
 line detection logic, we used two IR sensors, which include IR LED and 
Photodiode. They are placed in a reflective manner i.e. side-by-side so 
that whenever they come in proximity to a reflective surface, the light 
emitted by the IR LED can be detected by the photo diode.&lt;br /&gt;&lt;br /&gt;The 
following image shows the work of a specific IR sensor (IR LED - 
photodiode pair) in front of a light colored surface and a black 
surface. Since the reflectance of the light colored surface is high, the
 infrared light emitted by the IR LED will be reflected maximum and 
detected by the photodiode.&lt;br /&gt;&lt;br /&gt;How to make Arduino Line Follower Robot&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU0_LGnevnmUCq3Dyoj4tJKIIqeOvOFFZ8xkSIhxR5vyx-qg_ynOdUVvNVYYZzRFiKwsGH8WsD0TsHZbYLacgFx8RS2gA3xWco8c_goouTkItubL7K4RQcKnwLqQHZLquiz66KtSfYNJs/s1600/IR-Sensor-Working+iet.jpg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;588&quot; data-original-width=&quot;768&quot; height=&quot;490&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU0_LGnevnmUCq3Dyoj4tJKIIqeOvOFFZ8xkSIhxR5vyx-qg_ynOdUVvNVYYZzRFiKwsGH8WsD0TsHZbYLacgFx8RS2gA3xWco8c_goouTkItubL7K4RQcKnwLqQHZLquiz66KtSfYNJs/s640/IR-Sensor-Working+iet.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IR sensor working&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;IR sensor working&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #444444;&quot;&gt;In
 the case of black surface, which has low reflectance, light is 
completely absorbed by the black surface and does not reach the 
photodiode.&lt;br /&gt;&lt;br /&gt;Using the same principle, we will setup the IR sensor
 on a line follower robot, such that two IR sensors are on either side 
of the black line on the floor. The setup is shown below.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwAZ6st8TlmbehrfQcBe-TRuxXYxfdKR6KoAK2GYwYUHObPXMBUmFO8waUlRiMnW3gBB2qNUyfmNI0kgmemOcQabcTNSY22O_WPnLT_mk4m0npkAs6-WsGpGF-A_h6E8PME-QzDP-xuug/s1600/iet+Line-Follower-Left-Right.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; border=&quot;0&quot; data-original-height=&quot;826&quot; data-original-width=&quot;1268&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwAZ6st8TlmbehrfQcBe-TRuxXYxfdKR6KoAK2GYwYUHObPXMBUmFO8waUlRiMnW3gBB2qNUyfmNI0kgmemOcQabcTNSY22O_WPnLT_mk4m0npkAs6-WsGpGF-A_h6E8PME-QzDP-xuug/s640/iet+Line-Follower-Left-Right.jpg&quot; title=&quot;Arduino LFR (Line Follower Robot) कैसे बनाएं?&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;In
 the IR follower line follower when the robot moves forward, both 
sensors wait for the line to be detected. For example, if the IR sensor 
in the above image detects 1 black line, it means that there is a 
forward right curve (or bend).&lt;br /&gt;&lt;br /&gt;The Arduino UNO detects this 
change and sends the signal to the motorist accordingly. To turn right, 
the motor on the right of the robot is slowed down using PWM, while the 
motor on the left is driven at normal speed.&lt;br /&gt;&lt;br /&gt;IR follower line follower in left right&lt;br /&gt;Similarly,
 when the IR sensor 2 first detects the black line, it means that there 
is a forward left curve and the robot has to turn left. To turn the 
robot left, the motor on the left side of the robot is slowed down (or 
can be stopped completely or rotated in the opposite direction) and the 
motor on the right is driven at normal speed.&lt;br /&gt;&lt;br /&gt;The Arduino UNO continuously monitors data from both sensors and turns on the robot according to the line they searched.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;more&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;How to make Arduino Line Follower Robot:&amp;nbsp; CODE&lt;/span&gt;&lt;/h3&gt;
&lt;pre&gt;int mot1=9;
int mot2=6;
int mot3=5;
int mot4=3;

int left=13;
int right=12;

int Left=0;
int Right=0;

void LEFT (void);
void RIGHT (void);
void STOP (void);

void setup()
{
  pinMode(mot1,OUTPUT);
  pinMode(mot2,OUTPUT);
  pinMode(mot3,OUTPUT);
  pinMode(mot4,OUTPUT);

  pinMode(left,INPUT);
  pinMode(right,INPUT);

  digitalWrite(left,HIGH);
  digitalWrite(right,HIGH);
  
  
}

void loop() 
{
 
analogWrite(mot1,255);
analogWrite(mot2,0);
analogWrite(mot3,255);
analogWrite(mot4,0);

while(1)
{
  Left=digitalRead(left);
  Right=digitalRead(right);
  
  if((Left==0 &amp;amp;&amp;amp; Right==1)==1)
  LEFT();
  else if((Right==0 &amp;amp;&amp;amp; Left==1)==1)
  RIGHT();
}
}

void LEFT (void)
{
   analogWrite(mot3,0);
   analogWrite(mot4,30);
   
   
   while(Left==0)
   {
    Left=digitalRead(left);
    Right=digitalRead(right);
    if(Right==0)
    {
      int lprev=Left;
      int rprev=Right;
      STOP();
      while(((lprev==Left)&amp;amp;&amp;amp;(rprev==Right))==1)
      {
         Left=digitalRead(left);
         Right=digitalRead(right);
      }
    }
    analogWrite(mot1,255);
    analogWrite(mot2,0); 
   }
   analogWrite(mot3,255);
   analogWrite(mot4,0);
}

void RIGHT (void)
{
   analogWrite(mot1,0);
   analogWrite(mot2,30);

   while(Right==0)
   {
    Left=digitalRead(left);
    Right=digitalRead(right);
    if(Left==0)
    {
      int lprev=Left;
      int rprev=Right;
     STOP();
      while(((lprev==Left)&amp;amp;&amp;amp;(rprev==Right))==1)
      {
         Left=digitalRead(left);
         Right=digitalRead(right);
      }
    }
    analogWrite(mot3,255);
    analogWrite(mot4,0);
    }
   analogWrite(mot1,255);
   analogWrite(mot2,0);
}
void STOP (void)
{
analogWrite(mot1,0);
analogWrite(mot2,0);
analogWrite(mot3,0);
analogWrite(mot4,0);
  
}&lt;/pre&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;
&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Note:&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;To 
increase the efficiency of black line detection, the number of sensors 
can be increased. An array of sensors would be more accurate than just 
two sensors.&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;In 
this project (where two sensors are used), the position of the sensor is
 very important. The width of the black line plays a major role in the 
placement of the sensor. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Sensors can also be constructed for line detection using an LED and LDR pair.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Line follower robot applications&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
Line follower robots are commonly used for automation processes in 
industries, military applications, and consumer applications.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; They are very useful as they can operate without any supervision i.e. they operate as automatic guided vehicles.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
Line follower robots can be used in driverless cars, with additional 
features such as obstacle avoidance and other safety measures.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/3792297125467830119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/how-to-make-line-follower-robot-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3792297125467830119'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3792297125467830119'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/how-to-make-line-follower-robot-using.html' title='How to make  Line Follower Robot using Arduino'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB5AyiDwP8s9jZso2JA2GPPnrnSm8PK9pyNcEUWYon_mPFP6EtvLuKQkB-Bc8TQDOvMsFz4-qTzzyDz3ynC9KDBGa2e77H0Dv8ZAurCfxaTyPDu-691dFD9-wSfvuYz2DS89glQGycfxU/s72-c/Arduino-Line-Follower-Robot-Image-6-760x440.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-6172052899059461964</id><published>2020-04-26T12:09:00.000+05:30</published><updated>2020-04-26T12:15:08.342+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Bare Minimum</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This example contains the bare minimum of code you need for a sketch to compile properly on Arduino Software (IDE): the&amp;nbsp;&lt;code&gt;setup()&lt;/code&gt;&amp;nbsp;method and the&amp;nbsp;&lt;code&gt;loop()&lt;/code&gt;&amp;nbsp;method.&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
Only your Arduino or Genuino Board is needed for this example.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/bare-minimum.html&quot;&gt;
    &lt;img alt=&quot;Bare Minimum&quot; border=&quot;0&quot; height=&quot;507&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8FJ42VS3b_XeESup6uAeFDI8MfbIWaAMPppei3hs4BGDdbzIPRptxTdZmgdR7pxWSLRIqJANxGWF8jFkf8-c8LhhnEDeol7WTF44lZntqn9SnrgXsqNmAxdmvRZmPYVV-r0VGJavu1Xo/s640/1587217667066503-0.png&quot; title=&quot;Bare Minimum&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
The&amp;nbsp;&lt;code&gt;setup()&lt;/code&gt;&amp;nbsp;function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the board.&lt;br /&gt;&lt;br /&gt;After creating a&amp;nbsp;&lt;code&gt;setup()&lt;/code&gt;&amp;nbsp;function, the&amp;nbsp;&lt;code&gt;loop()&lt;/code&gt;&amp;nbsp;function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond as it runs. Code in the&amp;nbsp;&lt;code&gt;loop()&lt;/code&gt;&amp;nbsp;section of your sketch is used to actively control the board.&lt;br /&gt;&lt;br /&gt;The code below won&#39;t actually do anything, but it&#39;s structure is useful for copying and pasting to get you started on any sketch of your own. It also shows you how to make comments in your code.&lt;br /&gt;&lt;br /&gt;Any line that starts with two slashes (//) will not be read by the compiler, so you can write anything you want after it. The two slashes may be put after functional code to keep comments on the same line. Commenting your code like this can be particularly helpful in explaining, both to yourself and others, how your program functions step by step.&lt;br /&gt;
&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{&amp;nbsp;&amp;nbsp;&lt;span class=&quot;hljs-comment&quot;&gt;// put your setup code here, to run once:&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;}&amp;nbsp; &amp;nbsp;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{&amp;nbsp;&amp;nbsp;&lt;span class=&quot;hljs-comment&quot;&gt;// put your main code here, to run repeatedly:&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/6172052899059461964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/bare-minimum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/6172052899059461964'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/6172052899059461964'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/bare-minimum.html' title='Bare Minimum'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8FJ42VS3b_XeESup6uAeFDI8MfbIWaAMPppei3hs4BGDdbzIPRptxTdZmgdR7pxWSLRIqJANxGWF8jFkf8-c8LhhnEDeol7WTF44lZntqn9SnrgXsqNmAxdmvRZmPYVV-r0VGJavu1Xo/s72-c/1587217667066503-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-3207772711490605362</id><published>2020-04-26T12:08:00.000+05:30</published><updated>2020-04-26T12:15:37.329+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Fade Arduino</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This example demonstrates the use of the&amp;nbsp;&lt;code&gt;analogWrite()&lt;/code&gt;&amp;nbsp;function in fading an LED off and on.&amp;nbsp;&lt;span class=&quot;wikiword&quot;&gt;AnalogWrite&lt;/span&gt;&amp;nbsp;uses pulse width modulation (PWM), turning a digital pin on and off very quickly with different ratio between on and off, to create a fading effect.&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino board&lt;/li&gt;
&lt;li&gt;LED&lt;/li&gt;
&lt;li&gt;220 ohm resistor&lt;/li&gt;
&lt;li&gt;hook-up wires&lt;/li&gt;
&lt;li&gt;breadboard&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
Connect the&amp;nbsp;&lt;b&gt;anode&lt;/b&gt;&amp;nbsp;(the longer, positive leg) of your LED to digital output pin 9 on your board through a 220 ohm resistor. Connect the&amp;nbsp;&lt;b&gt;cathode&lt;/b&gt;&amp;nbsp;(the shorter, negative leg) directly to ground.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/fade-arduino.html&quot;&gt;
    &lt;img alt=&quot;Fade Arduino&quot; border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxxR-b-Dj1ay5u_2sPp85TA8GpuSnJd1kPSK-S76zm4XD_eInw0jLveU8T9tLfjyXta41Ouhy_4KTDGIqROeoY1CCQTYVN2cZtfkHktc9EiVwr2dmcHSfzKq6uaKNjtbHLoybsiwlLWec/s640/1587484579811377-0.png&quot; title=&quot;Fade Arduino&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/fade-arduino.html&quot;&gt;
    &lt;img alt=&quot;Fade Arduino&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUh24j45UkOO8tJzDuFxHb3ezjyOpoE2F-1Us3LVC_kIzT5zrLeGX19uieCdHEHNEKE5BXPB9E8UW3MbscnqiXmxk_myTkWK8AufXzw-hGexvqTi1-iMingWHjNnEr3jU4-pObEpMZqDc/s1600/1587484560231077-1.png&quot; title=&quot;Fade Arduino&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After declaring pin 9 to be your&amp;nbsp;&lt;code&gt;ledPin&lt;/code&gt;, there is nothing to do in the&amp;nbsp;&lt;code&gt;setup()&lt;/code&gt;&amp;nbsp;function of your code.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The&amp;nbsp;&lt;code&gt;analogWrite()&lt;/code&gt;&amp;nbsp;function that you will be using in the main loop of your code requires two arguments: One telling the function which pin to write to, and one indicating what PWM value to write.&lt;br /&gt;
&lt;br /&gt;
In order to fade your LED off and on, gradually increase your PWM value from 0 (all the way off) to 255 (all the way on), and then back to 0 once again to complete the cycle. In the sketch below, the PWM value is set using a variable called&amp;nbsp;&lt;code&gt;brightness&lt;/code&gt;. Each time through the loop, it increases by the value of the variable&amp;nbsp;&lt;code&gt;fadeAmount&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
If&amp;nbsp;&lt;code&gt;brightness&lt;/code&gt;&amp;nbsp;is at either extreme of its value (either 0 or 255), then&amp;nbsp;&lt;code&gt;fadeAmount&lt;/code&gt;&amp;nbsp;is changed to its negative. In other words, if&amp;nbsp;&lt;code&gt;fadeAmount&lt;/code&gt;&amp;nbsp;is 5, then it is set to -5. If it&#39;s -5, then it&#39;s set to 5. The next time through the loop, this change causes&amp;nbsp;&lt;code&gt;brightness&lt;/code&gt;&amp;nbsp;to change direction as well.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;analogWrite()&lt;/code&gt;&amp;nbsp;can change the PWM value very fast, so the delay at the end of the sketch controls the speed of the fade. Try changing the value of the delay and see how it changes the fading effect.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br&gt;&lt;pre&gt;
&lt;span class=&quot;hljs-comment&quot;&gt;/*
 Fade

 This example shows how to fade an LED on pin 9
 using the analogWrite() function.

 The analogWrite() function uses PWM, so if
 you want to change the pin you&#39;re using, be
 sure to use another PWM capable pin. On most
 Arduino, the PWM pins are identified with
 a &quot;~&quot; sign, like ~3, ~5, ~6, ~9, ~10 and ~11.

 This example code is in the public domain.
 */&lt;/span&gt;

&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; led = &lt;span class=&quot;hljs-number&quot;&gt;9&lt;/span&gt;;           &lt;span class=&quot;hljs-comment&quot;&gt;// the PWM pin the LED is attached to&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; brightness = &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;;    &lt;span class=&quot;hljs-comment&quot;&gt;// how bright the LED is&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; fadeAmount = &lt;span class=&quot;hljs-number&quot;&gt;5&lt;/span&gt;;    &lt;span class=&quot;hljs-comment&quot;&gt;// how many points to fade the LED by&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// the setup routine runs once when you press reset:&lt;/span&gt;
&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// declare pin 9 to be an output:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;pinMode&lt;/span&gt;(led, &lt;span class=&quot;hljs-keyword&quot;&gt;OUTPUT&lt;/span&gt;);
}

&lt;span class=&quot;hljs-comment&quot;&gt;// the loop routine runs over and over again forever:&lt;/span&gt;
&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// set the brightness of pin 9:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;analogWrite&lt;/span&gt;(led, brightness);

  &lt;span class=&quot;hljs-comment&quot;&gt;// change the brightness for next time through the loop:&lt;/span&gt;
  brightness = brightness + fadeAmount;

  &lt;span class=&quot;hljs-comment&quot;&gt;// reverse the direction of the fading at the ends of the fade:&lt;/span&gt;
  &lt;span class=&quot;hljs-built_in&quot;&gt;if&lt;/span&gt; (brightness &amp;lt;= &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt; || brightness &amp;gt;= &lt;span class=&quot;hljs-number&quot;&gt;255&lt;/span&gt;) {
    fadeAmount = -fadeAmount;
  }
  &lt;span class=&quot;hljs-comment&quot;&gt;// wait for 30 milliseconds to see the dimming effect&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;30&lt;/span&gt;);&lt;/br&gt;&lt;/pre&gt;
}&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/3207772711490605362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/fade-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3207772711490605362'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3207772711490605362'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/fade-arduino.html' title='Fade Arduino'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxxR-b-Dj1ay5u_2sPp85TA8GpuSnJd1kPSK-S76zm4XD_eInw0jLveU8T9tLfjyXta41Ouhy_4KTDGIqROeoY1CCQTYVN2cZtfkHktc9EiVwr2dmcHSfzKq6uaKNjtbHLoybsiwlLWec/s72-c/1587484579811377-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-1703593358950508890</id><published>2020-04-26T12:01:00.000+05:30</published><updated>2020-04-26T12:22:22.879+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Digital Input Pullup Serial</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Digital Input Pullup Serial&lt;br /&gt;
&lt;br /&gt;
This case demonstrates the use of INPUT_PULLUP with pinMode(). It monitors the nation of a transfer by organising serial communication between your Arduino and your computer over USB.&lt;br /&gt;
&lt;br /&gt;
Additionally, when the input is excessive, the onboard LED attached to pin thirteen will switch on; whilst LOW, the LED will flip off.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/digital-input-pullup-serial.html&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;497&quot; data-original-width=&quot;540&quot; height=&quot;587&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcf1YkMEurm79kFoRQzrN_CxVFycrF6mZCik7F7GywneEzq_VYFPN3rh9sxAhIdT3VMBNJJztxOGZbd0SrZp-YdUqnJCmnw9n0EuT3YVpfIbI393hHS7mh9hUFkZxfRt58Wi-GjG4vhs/s640/Digital+Input+Pullup+Serial.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hardware Required&lt;br /&gt;
Arduino Board&lt;br /&gt;
A temporary transfer, button, or toggle switch&lt;br /&gt;
Breadboard&lt;br /&gt;
Hook-up cord&lt;br /&gt;
Circuit&lt;br /&gt;
&lt;br /&gt;
Connect&amp;nbsp; wires to the Arduino board. The black cord connects floor to 1 leg of the pushbutton. The second one cord is going from virtual pin 2 to the alternative leg of the pushbutton.&lt;br /&gt;
&lt;br /&gt;
Pushbuttons or switches join&amp;nbsp; factors in a circuit while you press them. While the pushbutton is open (unpressed) there&#39;s no connection between the 2 legs of the pushbutton. Because the internal pull-up on pin 2 is energetic and related to 5V, we examine excessive while the button is open. When the button is closed, the Arduino reads LOW due to the fact a connection to ground is finished.&lt;br /&gt;
&lt;br /&gt;
Schematic&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/digital-input-pullup-serial.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBLFQHoOIKi3tGlYvav4eelHm47cX_Cb0ceCeeVisUyMKmVJirygaty4guc7eOFUzX6O_Akwib8-LdP4J2YvYvaYJDZ6oJUpMwyH3Th9SjU8ft03LuiLgesno2fhFq-l67nvey4hCGMJw/s1600/1587880360708437-0.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Code&lt;br /&gt;
In the program under, the very first thing which you do will inside the setup feature is to begin serial communications, at 9600 bits of facts in line with 2nd, among your Arduino and your pc with the road:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br&gt;&lt;pre&gt;

Serial.Begin(9600);

 

Next, initialize digital pin 2 as an enter with the internal pull-up resistor enabled:

PinMode(2,INPUT_PULLUP);

The subsequent line make pin thirteen, with the onboard LED, an output :

PinMode(thirteen, OUTPUT);

Now that your setup has been completed, circulate into the principle loop of your code. 

Whilst your button is not pressed, the inner pull-up resistor connects to 5 volts. 

This reasons the Arduino to record &quot;1&quot; or high. While the button is pressed, 

the Arduino pin is pulled to ground, inflicting the Arduino document a &quot;0&quot;, or LOW.

The primary thing you want to do within the primary loop of your software is to establish 

a variable to keep the facts coming in out of your transfer. 

For the reason that statistics coming in from the transfer could be both a &quot;1&quot; or a &quot;zero&quot;,

you may use an int datatype. Call this variable sensorValue, and set it to identical

anything is being examine on digital pin 2. You could accomplish all this with simply

one line of code:

 

Int sensorValue = digitalRead(2);

Once the Arduino has read the input, make it print this facts back to the computer as 

a decimal (DEC) price. You could do that with the command Serial.Println() in our ultimate

 line of code:

Serial.Println(sensorValue, DEC);

Now, while you open your Serial screen inside the Arduino environment, you may see a 

movement of &quot;zero&quot;s in case your transfer is closed, or &quot;1&quot;s in case your transfer is open.
The LED on pin thirteen will remove darkness from when the transfer is excessive, and

flip off while LOW.

 

 /* input Pullup Serial this situation demonstrates the usage of pinMode(INPUT_PULLUP).

 It reads a

virtual enter on pin 2 and prints the effects to the serial display.

  

The circuit:

 * non permanent switch attached from pin 2 to ground

* built-in LED on pin thirteen
in contrast to pinMode(enter), there may be no pull-down resistor important. An inner

20K-ohm resistor is pulled to 5V. This configuration causes the input to

study excessive when the transfer is open, and coffee when it&#39;s far closed.

Created 14 March 2012

by way of Scott Fitzgerald

 

http://www.Arduino.Cc/en/educational/InputPullupSerial
this situation code is within the public area */

 

Void setup()

  //begin serial connection

  Serial.Begin(9600);

  //configure pin2 as an input and enable the internal pull-up resistor

  pinMode(2, INPUT_PULLUP);

  pinMode(13, OUTPUT);

Void loop()

  //study the pushbutton fee into a variable

  int sensorVal = digitalRead(2);

  //print out the cost of the pushbutton

  Serial.Println(sensorVal);

  // keep in mind the pullup method the pushbutton&#39;s

  // common sense is inverted. It goes high when it&#39;s open,

  // and coffee whilst it&#39;s pressed. Turn on pin 13 while the

  // button&#39;s pressed, and off while it is now not:

  if (sensorVal == high)

    digitalWrite(thirteen, LOW);

   else

    digitalWrite(thirteen, high);

  postpone(30);&lt;/br&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/1703593358950508890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/digital-input-pullup-serial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/1703593358950508890'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/1703593358950508890'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/digital-input-pullup-serial.html' title='Digital Input Pullup Serial'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVcf1YkMEurm79kFoRQzrN_CxVFycrF6mZCik7F7GywneEzq_VYFPN3rh9sxAhIdT3VMBNJJztxOGZbd0SrZp-YdUqnJCmnw9n0EuT3YVpfIbI393hHS7mh9hUFkZxfRt58Wi-GjG4vhs/s72-c/Digital+Input+Pullup+Serial.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-8202078495391585737</id><published>2020-04-26T11:35:00.000+05:30</published><updated>2020-04-26T12:23:13.204+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Denounce Arduino</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
Pushbuttons frequently generate spurious open/near transitions while pressed, due to mechanical and physical issues: these transitions may be study as more than one presses in a very quick time fooling the program. This case demonstrates the way to debounce an enter, because of this checking twice in a quick time period to make certain the pushbutton is actually pressed. Without debouncing, pressing the button once may additionally purpose unpredictable consequences. This caricature uses the millis() feature to maintain track of the time surpassed because the button was pressed.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/denounce-arduino.html&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;351&quot; data-original-width=&quot;540&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiyfR3NB24byndLPLRIJukGe2SyZjljt-AYSrTR4yhC3p8tVrZpDJ121-IUF5odqDHPN7TB-KE1UIdVART8-FzOUnyJ06m3xONKX62xsZIq8YTJCfvq4S1BSkIL_4tiBVAnAwI_8CGPvQ/s1600/denounse.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Hardware Required&lt;/div&gt;
&lt;div&gt;
Arduino or Genuino Board&lt;/div&gt;
&lt;div&gt;
Short-term button or switch&lt;/div&gt;
&lt;div&gt;
10k ohm resistor&lt;/div&gt;
&lt;div&gt;
Hook-up wires&lt;/div&gt;
&lt;div&gt;
Breadboard&lt;/div&gt;
&lt;div&gt;
Circuit&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Schematic&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/denounce-arduino.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMt5I6R__i7uUCkolrZqie3fmXKLkqcFWlYsKsh2chAXis_RYFgSzSxtDMEbWmVNoZ7Pe-_Eg_4HMtaGRGf9LdOYg34aUHs41ZjXnrGxc03MOTk-8OroaU99h4CLdCmjnwxTo-DXsFnko/s1600/1587699657406281-1.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Code&lt;/div&gt;
&lt;div&gt;
The cartoon beneath is based on Limor Fried&#39;s version of debounce, but the common sense is inverted from her example. In her example, the switch returns LOW while closed, and high while open. Right here, the switch returns high while pressed and coffee whilst no longer pressed.&lt;/div&gt;
&lt;br&gt;&lt;pre&gt;
Debounce

 each time the enter pin is going from LOW to high (e.G. Because of a push-button  press), the output pin is toggled from LOW to excessive or high to LOW.  There may be  a minimum postpone between toggles to debounce the circuit (i.E. To disregard  noise).  The circuit:  * LED attached from pin 13 to floor  * pushbutton connected from pin 2 to +5V  * 10K resistor connected from pin 2 to floor  * observe: On most Arduino forums, there&#39;s already an LED at the board
 related to pin 13, so that you do not want any greater components for this case.
 Created 21 November 2006
 via David A. Mellis  modified 30 Aug 2011
 by using Limor Fried
 changed 28 Dec 2012
 by Mike Walters
 modified 30 Aug 2016
 with the aid of Arturo Guadalupi


 this situation code is within the public domain.

 Http://www.Arduino.Cc/en/academic/Debounce
 */

// constants might not change. They&#39;re used right here to
// set pin numbers:
Const int buttonPin = 2;    // the quantity of the pushbutton pin
Const int ledPin = 13;      // the variety of the LED pin

// Variables will alternate:
Int ledState = high;         // the current nation of the output pin
Int buttonState;             // the present day analyzing from the enter pin
Int lastButtonState = LOW;   // the preceding studying from the enter pin

// the following variables are unsigned lengthy&#39;s due to the fact the time, measured in miliseconds,
// will speedy come to be a bigger variety than can be stored in an int.
Unsigned lengthy lastDebounceTime = zero;  // the ultimate time the output pin became toggled
Unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers

Void setup() 
  pinMode(buttonPin, input);
  pinMode(ledPin, OUTPUT);

  // set initial LED state
  digitalWrite(ledPin, ledState);


Void loop() 
  // study the country of the switch into a local variable:
  int studying = digitalRead(buttonPin);

  // take a look at to see in case you just pressed the button
  // (i.E. The input went from LOW to excessive),  and you&#39;ve waited
  // long enough since the ultimate press to ignore any noise:

  // If the transfer modified, because of noise or pressing:
  if (studying != lastButtonState) 
    // reset the debouncing timer
    lastDebounceTime = millis();
  

  if ((millis() - lastDebounceTime) &gt; debounceDelay) 
    // whatever the analyzing is at, it&#39;s been there for longer
    // than the debounce postpone, so take it as the real modern state:

    // if the button kingdom has modified:
    if (reading != buttonState) 
      buttonState = reading;

      // only toggle the LED if the brand new button country is excessive
      if (buttonState == excessive) 
        ledState = !LedState;
      
    
  

  // set the LED:
  digitalWrite(ledPin, ledState);

  // save the studying.  Next time thru the loop,
  // it will likely be the lastButtonState:
  lastButtonState = analyzing;&lt;/br&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/8202078495391585737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/denounce-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/8202078495391585737'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/8202078495391585737'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/denounce-arduino.html' title='Denounce Arduino'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiyfR3NB24byndLPLRIJukGe2SyZjljt-AYSrTR4yhC3p8tVrZpDJ121-IUF5odqDHPN7TB-KE1UIdVART8-FzOUnyJ06m3xONKX62xsZIq8YTJCfvq4S1BSkIL_4tiBVAnAwI_8CGPvQ/s72-c/denounse.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-4280697814607067881</id><published>2020-04-24T08:55:00.001+05:30</published><updated>2020-04-26T12:17:17.393+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Blink LED Without Using Delay</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sometimes you need to do two things at once. For example you might want to blink an LED while reading a button press. In this case, you can&#39;t use&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;, because Arduino pauses your program during the&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;. If the button is pressed while Arduino is paused waiting for the&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;&amp;nbsp;to pass, your program will miss the button press.&lt;br /&gt;
&lt;br /&gt;
This sketch demonstrates how to blink an LED without using&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;. It turns on the LED on and then makes note of the time. Then, each time through&amp;nbsp;&lt;code&gt;loop()&lt;/code&gt;, it checks to see if the desired blink time has passed. If it has, it toggles the LED on or off and makes note of the new time. In this way the LED blinks continuously while the sketch execution never lags on a single instruction.&lt;br /&gt;
&lt;br /&gt;
An analogy would be warming up a pizza in your microwave, and also waiting some important email. You put the pizza in the microwave and set it for 10 minutes. The analogy to using&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;&amp;nbsp;would be to sit in front of the microwave watching the timer count down from 10 minutes until the timer reaches zero. If the important email arrives during this time you will miss it.&lt;br /&gt;
&lt;br /&gt;
What you would do in real life would be to turn on the pizza, and then check your email, and then maybe do something else (that doesn&#39;t take too long!) and every so often you will come back to the microwave to see if the timer has reached zero, indicating that your pizza is done.&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a similar timer.&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;li&gt;LED&lt;/li&gt;
&lt;li&gt;220 ohm resistor&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&amp;nbsp;&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/blink-led-without-using-delay.html&quot;&gt;
    &lt;img alt=&quot;Blink LED Without Using Delay&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjySGQuKmohVi9_Lv_NeniySw_6Sm43Hj4cRtFxzthab201bqzdpiYyxq_4HybLlFEy8iRKBUMXYayj3LU7itnhcU993t_YoJstQPZhwNnqFMIOiOC0YfG8VO9NCBtec5krozfSxo5I0Z0/s1600/1587502661213978-0.png&quot; title=&quot;Blink LED Without Using Delay&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To build the circuit, connect one end of the resistor to pin 13 of the board. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the board GND, as shown in the diagram above and the schematic below.&lt;/div&gt;
&lt;br /&gt;
Most Arduino and Genuino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink.&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/blink-led-without-using-delay.html&quot;&gt;
    &lt;img alt=&quot;Blink LED Without Using Delay&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu6drdUUXY-x2hiMPcwUOS1TfGlLui7U7R1CsS8cGz8bP5Ozvw0iM0r7XAnLuTGHN10mISso2fdtRSH2_YBQaolpq1GJi5ZOOwM-bc-5b1rTUr8Lf2JCPseMt8cHtOHvUYiiEJT9TBWI0/s1600/1587502655130085-1.png&quot; title=&quot;Blink LED Without Using Delay&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
After you build the circuit plug your board into your computer, start the Arduino Software (IDE), and enter the code &lt;span style=&quot;font-weight: normal;&quot;&gt;below&lt;/span&gt;.&lt;/div&gt;
&lt;h2&gt;
Code&lt;/h2&gt;
The code below uses the&amp;nbsp;&lt;code&gt;millis()&lt;/code&gt;&amp;nbsp;function, a command that returns the number of milliseconds since the board started running its current sketch, to blink an LED.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;pre&gt;/* Blink without Delay

 Turns on and off a light emitting diode (LED) connected to a digital
 pin, without using the delay() function.  This means that other code
 can run at the same time without being interrupted by the LED code.

 The circuit:
 * Use the onboard LED.
 * Note: Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino model, check
  the Technical Specs of your board  at https://www.arduino.cc/en/Main/Products

 created 2005
 by David A. Mellis
 modified 8 Feb 2010
 by Paul Stoffregen
 modified 11 Nov 2013
 by Scott Fitzgerald
 modified 9 Jan 2017
 by Arturo Guadalupi


 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
 */
&lt;span class=&quot;hljs-comment&quot;&gt;// constants won&#39;t change. Used here to set a pin number :&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; ledPin =  &lt;span class=&quot;hljs-keyword&quot;&gt;LED_BUILTIN&lt;/span&gt;;&lt;span class=&quot;hljs-comment&quot;&gt;// the number of the LED pin&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// Variables will change :&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; ledState = &lt;span class=&quot;hljs-keyword&quot;&gt;LOW&lt;/span&gt;;             &lt;span class=&quot;hljs-comment&quot;&gt;// ledState used to set the LED&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// Generally, you should use &quot;unsigned long&quot; for variables that hold time&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot;&gt;// The value will quickly become too large for an int to store&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;long&lt;/span&gt; previousMillis = &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;;        &lt;span class=&quot;hljs-comment&quot;&gt;// will store last time LED was updated&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// constants won&#39;t change :&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;long&lt;/span&gt; interval = &lt;span class=&quot;hljs-number&quot;&gt;1000&lt;/span&gt;;           &lt;span class=&quot;hljs-comment&quot;&gt;// interval at which to blink (milliseconds)&lt;/span&gt;

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// set the digital pin as output:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;pinMode&lt;/span&gt;(ledPin, &lt;span class=&quot;hljs-keyword&quot;&gt;OUTPUT&lt;/span&gt;);
}

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// here is where you&#39;d put code that needs to be running all the time.&lt;/span&gt;

  &lt;span class=&quot;hljs-comment&quot;&gt;// check to see if it&#39;s time to blink the LED; that is, if the&lt;/span&gt;
  &lt;span class=&quot;hljs-comment&quot;&gt;// difference between the current time and last time you blinked&lt;/span&gt;
  &lt;span class=&quot;hljs-comment&quot;&gt;// the LED is bigger than the interval at which you want to&lt;/span&gt;
  &lt;span class=&quot;hljs-comment&quot;&gt;// blink the LED.&lt;/span&gt;
  &lt;span class=&quot;hljs-keyword&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;long&lt;/span&gt; currentMillis = &lt;span class=&quot;hljs-literal&quot;&gt;millis&lt;/span&gt;();

  &lt;span class=&quot;hljs-built_in&quot;&gt;if&lt;/span&gt; (currentMillis - previousMillis &amp;gt;= interval) {
    &lt;span class=&quot;hljs-comment&quot;&gt;// save the last time you blinked the LED&lt;/span&gt;
    previousMillis = currentMillis;

    &lt;span class=&quot;hljs-comment&quot;&gt;// if the LED is off turn it on and vice-versa:&lt;/span&gt;
    &lt;span class=&quot;hljs-built_in&quot;&gt;if&lt;/span&gt; (ledState == &lt;span class=&quot;hljs-keyword&quot;&gt;LOW&lt;/span&gt;) {
      ledState = &lt;span class=&quot;hljs-keyword&quot;&gt;HIGH&lt;/span&gt;;
    } &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt; {
      ledState = &lt;span class=&quot;hljs-keyword&quot;&gt;LOW&lt;/span&gt;;
    }

    &lt;span class=&quot;hljs-comment&quot;&gt;// set the LED with the ledState of the variable:&lt;/span&gt;
    &lt;span class=&quot;hljs-literal&quot;&gt;digitalWrite&lt;/span&gt;(ledPin, ledState);  }&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/4280697814607067881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/blink-led-without-using-delay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/4280697814607067881'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/4280697814607067881'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/blink-led-without-using-delay.html' title='Blink LED Without Using Delay'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjySGQuKmohVi9_Lv_NeniySw_6Sm43Hj4cRtFxzthab201bqzdpiYyxq_4HybLlFEy8iRKBUMXYayj3LU7itnhcU993t_YoJstQPZhwNnqFMIOiOC0YfG8VO9NCBtec5krozfSxo5I0Z0/s72-c/1587502661213978-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-4879991784355561158</id><published>2020-04-24T08:55:00.000+05:30</published><updated>2020-04-26T12:17:47.010+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Use a push B button to Controlan LED</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Pushbuttons or switches connect two points in a circuit when you press them. This example turns on the built-in LED on pin 13 when you press the button.&lt;/h4&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;li&gt;A momentary switch, button, or toggle switch&lt;/li&gt;
&lt;li&gt;10k ohm resistor&lt;/li&gt;
&lt;li&gt;hook-up wires&lt;/li&gt;
&lt;li&gt;breadboard&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&amp;nbsp;&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/use-push-b-button-to-controlan-led.html&quot;&gt;
    &lt;img alt=&quot;Use a push B button to Controlan LED&quot; border=&quot;0&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-KAxI41kiANqISuTGsuwXa1w2Jew_tK4JyFQJcMlhEgZT49h6Jsz_kXbZzJu5alm1gwamaLF4-Chgs5tqUaDz01nM1ngdTvUNECF7Wsf2v5an01ADSny6YNL3N4TH9VGfyH72Gs7ILu0/s640/1587503233494807-0.png&quot; title=&quot;Use a push B button to Controlan LED&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Connect three wires to the board. The first two, red and black, connect to the two long vertical rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire goes from digital pin 2 to one leg of the pushbutton . That same leg of the button connects through a pull-down resistor (here 10k ohm) to ground. The other leg of the button connects to the 5 volt supply.&lt;/div&gt;
&lt;br /&gt;
When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH.&lt;br /&gt;
&lt;br /&gt;
You can also wire this circuit the opposite way, with a pullup resistor keeping the input HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be reversed, with the LED normally on and turning off when you press the button.&lt;br /&gt;
&lt;br /&gt;
If you disconnect the digital I/O pin from everything, the LED may blink erratically. This is because the input is &quot;floating&quot; - that is, it will randomly return either HIGH or LOW. That&#39;s why you need a pull-up or pull-down resistor in the circuit.&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/use-push-b-button-to-controlan-led.html&quot;&gt;
    &lt;img alt=&quot;Use a push B button to Controlan LED&quot; border=&quot;0&quot; height=&quot;561&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsiingKDiWVzXCfqIpOQIlXaHYxBuvinl-t5vHIOS3HFyXkdIxsY4lFuYJKuG_IxMCDmdIYCZcvdjSLr2DajnYzjxXud3u5R_owSTBDmP8gsecIE7O8PBdAADAKUpXgaooqwsslKZgaS0/s640/1587503227767207-1.png&quot; title=&quot;Use a push B button to Controlan LED&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre&gt;/* Use a push B button to Controlan LED

 Turns on and off a light emitting diode(LED) connected to digital
 pin 13, when pressing a pushbutton attached to pin 2.

 The circuit:
 * LED attached from pin 13 to ground
 * pushbutton attached to pin 2 from +5V
 * 10K resistor attached to pin 2 from ground

 * Note: on most Arduinos there is already an LED on the board
 attached to pin 13.


 created 2005
 by DojoDave 

&lt;span class=&quot;hljs-comment&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot;&gt;http://www.0j0.org&amp;gt;
 modified 30 Aug 2011
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/Button
 */&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// constants won&#39;t change. They&#39;re used here to&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot;&gt;// set pin numbers:&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; buttonPin = &lt;span class=&quot;hljs-number&quot;&gt;2&lt;/span&gt;;     &lt;span class=&quot;hljs-comment&quot;&gt;// the number of the pushbutton pin&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; ledPin =  &lt;span class=&quot;hljs-number&quot;&gt;13&lt;/span&gt;;      &lt;span class=&quot;hljs-comment&quot;&gt;// the number of the LED pin&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot;&gt;// variables will change:&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; buttonState = &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;;         &lt;span class=&quot;hljs-comment&quot;&gt;// variable for reading the pushbutton status&lt;/span&gt;

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// initialize the LED pin as an output:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;pinMode&lt;/span&gt;(ledPin, &lt;span class=&quot;hljs-keyword&quot;&gt;OUTPUT&lt;/span&gt;);
  &lt;span class=&quot;hljs-comment&quot;&gt;// initialize the pushbutton pin as an input:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;pinMode&lt;/span&gt;(buttonPin, &lt;span class=&quot;hljs-keyword&quot;&gt;INPUT&lt;/span&gt;);
}

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// read the state of the pushbutton value:&lt;/span&gt;
  buttonState = &lt;span class=&quot;hljs-literal&quot;&gt;digitalRead&lt;/span&gt;(buttonPin);

  &lt;span class=&quot;hljs-comment&quot;&gt;// check if the pushbutton is pressed.&lt;/span&gt;
  &lt;span class=&quot;hljs-comment&quot;&gt;// if it is, the buttonState is HIGH:&lt;/span&gt;
  &lt;span class=&quot;hljs-built_in&quot;&gt;if&lt;/span&gt; (buttonState == &lt;span class=&quot;hljs-keyword&quot;&gt;HIGH&lt;/span&gt;) {
    &lt;span class=&quot;hljs-comment&quot;&gt;// turn LED on:&lt;/span&gt;
    &lt;span class=&quot;hljs-literal&quot;&gt;digitalWrite&lt;/span&gt;(ledPin, &lt;span class=&quot;hljs-keyword&quot;&gt;HIGH&lt;/span&gt;);
  } &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt; {
    &lt;span class=&quot;hljs-comment&quot;&gt;// turn LED off:&lt;/span&gt;
    &lt;span class=&quot;hljs-literal&quot;&gt;digitalWrite&lt;/span&gt;(ledPin, &lt;span class=&quot;hljs-keyword&quot;&gt;LOW&lt;/span&gt;);
  }
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/4879991784355561158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/use-push-b-button-to-controlan-led.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/4879991784355561158'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/4879991784355561158'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/use-push-b-button-to-controlan-led.html' title='Use a push B button to Controlan LED'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-KAxI41kiANqISuTGsuwXa1w2Jew_tK4JyFQJcMlhEgZT49h6Jsz_kXbZzJu5alm1gwamaLF4-Chgs5tqUaDz01nM1ngdTvUNECF7Wsf2v5an01ADSny6YNL3N4TH9VGfyH72Gs7ILu0/s72-c/1587503233494807-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-8936210985186553135</id><published>2020-04-24T05:00:00.000+05:30</published><updated>2020-04-26T12:18:14.926+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Read Analog Voltage</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;
&lt;span style=&quot;font-family: &amp;quot;f4&amp;quot;;&quot;&gt;Read Analog Voltage&lt;/span&gt;&lt;/h1&gt;
This example shows you how to read an analog input on analog pin 0, convert the values from analogRead() into voltage, and print it out to the serial monitor of the Arduino Software (IDE).&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;li&gt;10k ohm Potentiometer&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/read-analog-voltage.html&quot;&gt;
    &lt;img alt=&quot;Read Analog Voltage&quot; border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzTDAb_flofyLtqKiYx1PXRaP4K1tiq7J3B15CGe6pFYmqvnef6FyifWWG0mCgQSHogmGx40vG0xUKVhgUyXuVXD2_1FWRo_CSOflIIuj95xir-depB7wnJdAW_lxseemO9TrQ0fLZryM/s640/1587501869837325-0.png&quot; title=&quot;Read Analog Voltage&quot; width=&quot;500&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
Connect the three wires from the potentiometer to your board. The first goes to ground from one of the outer pins of the potentiometer. The second goes to 5 volts from the other outer pin of the potentiometer. The third goes from the middle pin of the potentiometer to analog input 2.&lt;br /&gt;
&lt;br /&gt;
By turning the shaft of the potentiometer, you change the amount of resistance on either side of the wiper which is connected to the center pin of the potentiometer. This changes the voltage at the center pin. When the resistance between the center and the side connected to 5 volts is close to zero (and the resistance on the other side is close to 10 kilohms), the voltage at the center pin nears 5 volts. When the resistances are reversed, the voltage at the center pin nears 0 volts, or ground. This voltage is the&amp;nbsp;&lt;b&gt;analog voltage&lt;/b&gt;&amp;nbsp;that you&#39;re reading as an input.&lt;br /&gt;
&lt;br /&gt;
The microcontroller of the board has a circuit inside called an&amp;nbsp;&lt;i&gt;analog-to-digital converter&lt;/i&gt;&amp;nbsp;or&amp;nbsp;&lt;i&gt;ADC&lt;/i&gt;&amp;nbsp;that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between,&amp;nbsp;&lt;code&gt;analogRead&lt;/code&gt;() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/read-analog-voltage.html&quot;&gt;
    &lt;img alt=&quot;Read Analog Voltage&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvbxYtps_wmiTlNtcIPdxFFC-m-MkNiY7B8_kj_t8qY7WLDuk-m80QPWfsjoLGtYtOiX0sSBdFLpFNcfb-bq4KMoyH6bq-KETrcPk7zXHDRua_iXsbRud4nBtEOmJSSIHAtuEZWpUwlq0/s1600/1587501864271968-1.png&quot; title=&quot;Read Analog Voltage&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
Code&lt;br /&gt;
In the program below, the very first thing that you do will in the setup function is to begin serial communications, at 9600 bits of data per second, between your board and your computer with the line:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt; Serial.begin9600;&lt;/pre&gt;
Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an&amp;nbsp;&lt;code&gt;int&lt;/code&gt;&amp;nbsp;datatype) coming in from your potentiometer:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;sensorValue = &lt;span class=&quot;hljs-literal&quot;&gt;analogRead&lt;/span&gt;(A0);&lt;/pre&gt;
To change the values from 0-1023 to a range that corresponds to the voltage the pin is reading, you&#39;ll need to create another variable, a&amp;nbsp;&lt;code&gt;float&lt;/code&gt;, and do a little math. To scale the numbers between 0.0 and 5.0, divide 5.0 by 1023.0 and multiply that by&amp;nbsp;&lt;b&gt;sensorValue&lt;/b&gt;&amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;voltage= sensorValue * (&lt;span class=&quot;hljs-number&quot;&gt;5.0&lt;/span&gt; / &lt;span class=&quot;hljs-number&quot;&gt;1023.0&lt;/span&gt;);&lt;/pre&gt;
&amp;gt;
Finally, you need to print this information to your serial window as. You can do this with the command&amp;nbsp;&lt;code&gt;Serial .println()&lt;/code&gt;&amp;nbsp;in your last line of code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;Serial&lt;/pre&gt;
&lt;/div&gt;
.&lt;span class=&quot;hljs-literal&quot;&gt;println&lt;/span&gt;(voltage)
Now, when you open your Serial Monitor in the Arduino IDE (by clicking on the icon on the right side of the top green bar or pressing Ctrl+Shift+M), you should see a steady stream of numbers ranging from 0.0 - 5.0. As you turn the pot, the values will change, corresponding to the voltage coming into pin A0.&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt; ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools &amp;gt; Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/
&lt;span class=&quot;hljs-comment&quot;&gt;// the setup routine runs once when you press reset:&lt;/span&gt;
&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// initialize serial communication at 9600 bits per second:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;Serial&lt;/span&gt;.&lt;span class=&quot;hljs-literal&quot;&gt;begin&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;9600&lt;/span&gt;);
}

&lt;span class=&quot;hljs-comment&quot;&gt;// the loop routine runs over and over again forever:&lt;/span&gt;
&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-comment&quot;&gt;// read the input on analog pin 0:&lt;/span&gt;
  &lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; sensorValue = &lt;span class=&quot;hljs-literal&quot;&gt;analogRead&lt;/span&gt;(A0);
  &lt;span class=&quot;hljs-comment&quot;&gt;// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):&lt;/span&gt;
  &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; voltage = sensorValue * (&lt;span class=&quot;hljs-number&quot;&gt;5.0&lt;/span&gt; / &lt;span class=&quot;hljs-number&quot;&gt;1023.0&lt;/span&gt;);
  &lt;span class=&quot;hljs-comment&quot;&gt;// print out the value you read:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;Serial&lt;/span&gt;.&lt;span class=&quot;hljs-literal&quot;&gt;println&lt;/span&gt;(voltage);
  &lt;span class=&quot;hljs-literal&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;100&lt;/span&gt;);&lt;/pre&gt;
}

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/8936210985186553135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/read-analog-voltage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/8936210985186553135'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/8936210985186553135'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/read-analog-voltage.html' title='Read Analog Voltage'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzTDAb_flofyLtqKiYx1PXRaP4K1tiq7J3B15CGe6pFYmqvnef6FyifWWG0mCgQSHogmGx40vG0xUKVhgUyXuVXD2_1FWRo_CSOflIIuj95xir-depB7wnJdAW_lxseemO9TrQ0fLZryM/s72-c/1587501869837325-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-5527446474045752587</id><published>2020-04-20T17:41:00.000+05:30</published><updated>2020-04-26T12:19:01.384+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Digital Read Serial</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This example shows you how to monitor the state of a switch by establishing serial communication between your Arduino or Genuino and your computer over USB.&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;li&gt;A momentary switch, button, or toggle switch&lt;/li&gt;
&lt;li&gt;10k ohm resistor&lt;/li&gt;
&lt;li&gt;hook-up wires&lt;/li&gt;
&lt;li&gt;breadboard&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/digital-read-serial.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjezmckOVLOoL-CUTBo-n58VeMmF7-oNi1yhzquQClkIlTwCfAhjyXSl0ryMf6zQFSRNhvPOnozQ0uU9hV4CQgQbD-Hh8IWWCpyYPWVw0kK-7KtWh4UsBBeVJsq0AUK-qCEge0sVQQhVgQ/s1600/1587299007047500-0.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
Connect three wires to the board. The first two, red and black, connect to the two long vertical rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire goes from digital pin 2 to one leg of the pushbutton . That same leg of the button connects through a pull-down resistor (here 10k ohm) to ground. The other leg of the button connects to the 5 volt supply.&lt;br /&gt;
&lt;br /&gt;
Pushbuttons or switches connect two points in a circuit when you press them. When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and reads as LOW, or 0. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that the pin reads as HIGH, or 1.&lt;br /&gt;
&lt;br /&gt;
If you disconnect the digital i/o pin from everything, the LED may blink erratically. This is because the input is &quot;floating&quot; - that is, it doesn&#39;t have a solid connection to voltage or ground, and it will randomly return either HIGH or LOW. That&#39;s why you need a pull-down resistor in the circuit.&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/digital-read-serial.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJQUmuYYtRoeWi8POBHBy69WFlOhR9JLNahONzK9Iq-UKVX8sagpEOX3q8FlntMXRPwJfop1R3hRZmSw_iMGxhX59Q-A1c10UZFPO5bYMT-LaMdwECc8aeaRLo23FhOfqeXTlZGqNmw_0/s1600/1587224481973227-1.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In the program below, the very first thing that you do will in the setup function is to begin serial communications, at 9600 bits of data per second, between your board and your computer with the line:&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;Serial.begin(9600)&lt;/b&gt;&lt;/pre&gt;
;
&lt;code class=&quot;arduino hljs&quot;&gt;&lt;/code&gt;&lt;/div&gt;
Next, initialize digital pin 2, the pin that will read the output from your button, as an input:&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;pinMode(2,INPUT)&lt;/b&gt;&lt;/pre&gt;
;&amp;gt;
&lt;code class=&quot;arduino hljs&quot;&gt;&lt;/code&gt;
Now that your setup has been completed, move into the main loop of your code. When your button is pressed, 5 volts will freely flow through your circuit, and when it is not pressed, the input pin will be connected to ground through the 10k ohm resistor. This is a digital input, meaning that the switch can only be in either an on state (seen by your Arduino as a &quot;1&quot;, or HIGH) or an off state (seen by your Arduino as a &quot;0&quot;, or LOW), with nothing in between.&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do in the main loop of your program is to establish a variable to hold the information coming in from your switch. Since the information coming in from the switch will be either a &quot;1&quot; or a &quot;0&quot;, you can use an&amp;nbsp;&lt;code&gt;int&lt;/code&gt;&amp;nbsp;datatype. Call this variable&amp;nbsp;&lt;code&gt;sensorValue&lt;/code&gt;, and set it to equal whatever is being read on digital pin 2. You can accomplish all this with just one line of code:&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;int sensorValue = digitalRead(2); &lt;/b&gt;&lt;/pre&gt;
Once the bord has read the input, make it print this information back to the computer as a decimal value. You can do this with the command &lt;code&gt;Serial.println()&lt;/code&gt; in our last line of code:&lt;br /&gt;
&lt;div dir=&quot;ltr&quot;&gt;
&lt;pre&gt;&lt;b&gt;int pushButton = 2;

void setup()

 {

 Serial.begin(9600);

&amp;nbsp; pinMode(pushButton, INPUT);

 }

 void loop()

 {

&amp;nbsp; int buttonState = digitalRead(pushButton);

&amp;nbsp; Serial.println(buttonState);

&amp;nbsp; delay(100);&lt;/b&gt;&lt;/pre&gt;
}&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/5527446474045752587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/digital-read-serial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/5527446474045752587'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/5527446474045752587'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/digital-read-serial.html' title='Digital Read Serial'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjezmckOVLOoL-CUTBo-n58VeMmF7-oNi1yhzquQClkIlTwCfAhjyXSl0ryMf6zQFSRNhvPOnozQ0uU9hV4CQgQbD-Hh8IWWCpyYPWVw0kK-7KtWh4UsBBeVJsq0AUK-qCEge0sVQQhVgQ/s72-c/1587299007047500-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-2042863821291385919</id><published>2020-04-19T17:11:00.000+05:30</published><updated>2020-04-26T12:19:43.186+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Blink</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This example shows the simplest thing you can do with an Arduino or Genuino to see physical output: it blinks the on-board LED.&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board [optional]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;LED&lt;/li&gt;
&lt;li&gt;220 ohm resistor &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
This example uses the built-in LED that most Arduino and Genuino boards have. This LED is connected to a digital pin and its number may vary from board type to board type. To make your life easier, we have a constant that is specified in every board descriptor file. This constant is&amp;nbsp;&lt;i&gt;LED_BUILTIN&lt;/i&gt;&amp;nbsp;and allows you to control the built-in LED easily. Here is the correspondence between the constant and the digital pin.&lt;br /&gt;
&lt;br /&gt;
If you want to lit an external LED with this sketch, you need to build this circuit, where you connect one end of the resistor to the digital pin correspondent to the LED_BUILTIN constant. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. In the diagram below we show an UNO board that has D13 as the LED_BUILTIN value.&lt;br /&gt;
&lt;br /&gt;
The value of the resistor in series with the LED may be of a different value than 220 ohm; the LED will lit up also with values up to 1K ohm.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/blink.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU5Q4eaMGAzbFxLGHUrirILGS-q5XKo2n11hfRn0Mo3qRP7cukUJLRoJBvA3qySPxQ6LLkUw4bP5-kXPg8tzCMHXuHIcgwKIdn4k-1PM9A6qcJDPW2JuActLj04LCMRlhjBcib3zUG2qA/s1600/1587221538575971-0.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/blink.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgicMavC_pHALVeNkhMfN8bLj3URYuPn-QKAAv2N8bW_UMvOiI_4he8yqrTHpllTPJeyOWbXSux0VI-l4N6wI7BDtk_Rwjf_zAjWUaE_4iAJNPfq7u0B2Z6ikvhQIbxX1jbkwH0ZMuxhiE/s1600/1587221529292219-1.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
&lt;/h2&gt;
After you build the circuit plug your Arduino or Genuino board into your computer, start the Arduino Software (IDE) and enter the code below. You may also load it from the menu File/Examples/01.Basics/Blink . The first thing you do is to initialize LED_BUILTIN pin as an output pin with the line&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;pinMode(LED_BUILTIN, OUTPUT);&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In the main loop, you turn the LED on with the line:&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;digitalWrite(LED_BUILTIN, HIGH);&lt;/b&gt;&lt;/pre&gt;
This supplies 5 volts to the LED anode. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line:&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;digitalWrite(LED_BUILTIN, LOW);&lt;/b&gt;&lt;/pre&gt;
That takes the LED_BUILTIN pin back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;&amp;nbsp;commands tell the board to do nothing for 1000 milliseconds, or one second. When you use the&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt;&amp;nbsp;command, nothing else happens for that amount of time. Once you&#39;ve understood the basic examples, check out the BlinkWithoutDelay example to learn how to create a delay while doing other things.&lt;br /&gt;
&lt;br /&gt;
Once you&#39;ve understood this example, check out the DigitalReadSerial example to learn how read a switch connected to the board&lt;br /&gt;
initialize digital pin LED_BUILTIN as an output.

&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;void setup(){

pinMode(LED_BUILTIN, OUTPUT);

 }

//the loop function runs over and over again forever turn the LED on (HIGH is the voltage level)

void loop() { 

  digitalWrite(LED_BUILTIN, HIGH);

//wait for a second 

delay(1000);

//turn the LED off by making the voltage LOW

digitalWrite(LED_BUILTIN, LOW);

delay(1000);  } &lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/2042863821291385919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/blink.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/2042863821291385919'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/2042863821291385919'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/blink.html' title='Blink'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU5Q4eaMGAzbFxLGHUrirILGS-q5XKo2n11hfRn0Mo3qRP7cukUJLRoJBvA3qySPxQ6LLkUw4bP5-kXPg8tzCMHXuHIcgwKIdn4k-1PM9A6qcJDPW2JuActLj04LCMRlhjBcib3zUG2qA/s72-c/1587221538575971-0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-6453067740423840135</id><published>2020-04-18T19:12:00.001+05:30</published><updated>2020-04-26T12:20:07.498+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basic"/><title type='text'>Analog Read Serial</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This example shows you how to read analog input from the physical world using a potentiometer. A&amp;nbsp;&lt;b&gt;potentiometer&lt;/b&gt;&amp;nbsp;is a simple mechanical device that provides a varying amount of resistance when its shaft is turned. By passing voltage through a potentiometer and into an analog input on your board, it is possible to measure the amount of resistance produced by a potentiometer (or&amp;nbsp;&lt;i&gt;pot&lt;/i&gt;&amp;nbsp;for short) as an analog value. In this example you will monitor the state of your potentiometer after establishing serial communication between your Arduino or Genuino and your computer running the Arduino Software (IDE).&lt;br /&gt;
&lt;h2&gt;
Hardware Required&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Arduino or Genuino Board&lt;/li&gt;
&lt;li&gt;10k ohm Potentiometer&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Circuit&lt;/h2&gt;
Connect the three wires from the potentiometer to your board. The first goes from one of the outer pins of the potentiometerto ground . The second goes from the other outer pin of the potentiometer to 5 volts. The third goes from the middle pin of the potentiometer to the analog pin A0.&lt;br /&gt;
&lt;br /&gt;
By turning the shaft of the potentiometer, you change the amount of resistance on either side of the wiper, which is connected to the center pin of the potentiometer. This changes the voltage at the center pin. When the resistance between the center and the side connected to 5 volts is close to zero (and the resistance on the other side is close to 10k ohm), the voltage at the center pin nears 5 volts. When the resistances are reversed, the voltage at the center pin nears 0 volts, or ground. This voltage is the&amp;nbsp;&lt;i&gt;analog voltage&lt;/i&gt;&amp;nbsp;that you&#39;re reading as an input.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/analog-read-serial.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkIVbO9SfYrXCsq0FNmK36QNq3UlKrO1tHMi2MSbiMRcA2arRP_ns3DKDFqyvtBOlEfXd7n3y7t9_ix22yOlTBhnSoFpguLSNSGlgfvkzB7twl0z5VCrh7UALxm1kPCdcDHyT-rXI-cOI/s1600/1587217332670874-0.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;
The Arduino and Genuino boards have a circuit inside called an&amp;nbsp;&lt;i&gt;analog-to-digital converter or ADC&lt;/i&gt;&amp;nbsp;that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between,&amp;nbsp;&lt;code&gt;analogRead()&lt;/code&gt;&amp;nbsp;returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Schematic&lt;/h2&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.ietianarun.tech/2020/04/analog-read-serial.html&quot;&gt;
    &lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3fmgZfFKmJ-SdeqfKm_oCSmKLSJOmOB7WVPzjr0lT3cXCY8yO2S6TM5fqEBOlgjf5SKLmEeQgCoPKUcY_H_WHWo7jbrRh0l-_qnif_mIkWkHqCQSmKecIK_0LqFzGFczD5s8LZrfpk5A/s1600/1587217321999116-1.png&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Code&lt;/b&gt;&lt;br /&gt;
In the sketch below, the only thing that you do in the setup function is to begin serial communications, at 9600 bits of data per second, between your board and your computer with the command:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;Serial.begin(9600);&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an&amp;nbsp;&lt;code&gt;int&lt;/code&gt;&amp;nbsp;datatype) coming in from your potentiometer:&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;int sensorValue = analogRead(A0);&lt;/b&gt;&lt;/pre&gt;
Finally, you need to print this information to your serial monitor window. You can do this with the command&amp;nbsp;&lt;code&gt;Serial .println()&lt;/code&gt;&amp;nbsp;in your last line of code:&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;Serial.println(sensorValue)&lt;/b&gt;&lt;/pre&gt;
Now, when you open your Serial Monitor in the Arduino Software (IDE) (by clicking the icon that looks like a lens, on the right, in the green top bar or using the keyboard shortcut Ctrl+Shift+M), you should see a steady stream of numbers ranging from 0-1023, correlating to the position of the pot. As you turn your potentiometer, these numbers will respond almost instantly.&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools &amp;gt; Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{

&amp;nbsp;  &lt;span class=&quot;hljs-comment&quot;&gt;// initialize serial communication at 9600 bits per second:&lt;/span&gt;

&lt;span class=&quot;hljs-literal&quot;&gt;Serial&lt;/span&gt;.&lt;span class=&quot;hljs-literal&quot;&gt;begin&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;9600&lt;/span&gt;);
}

&amp;nbsp;
&lt;span class=&quot;hljs-comment&quot;&gt;// the loop routine runs over and over again forever:&lt;/span&gt;

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{

&amp;nbsp;&lt;span class=&quot;hljs-comment&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot;&gt;/ read the input on analog pin 0:&lt;/span&gt;

&amp;nbsp;  &lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; sensorValue = &lt;span class=&quot;hljs-literal&quot;&gt;analogRead&lt;/span&gt;(A0);

&amp;nbsp;
  &lt;span class=&quot;hljs-comment&quot;&gt;// print out the value you read:&lt;/span&gt;
  &lt;span class=&quot;hljs-literal&quot;&gt;Serial&lt;/span&gt;.&lt;span class=&quot;hljs-literal&quot;&gt;println&lt;/span&gt;(sensorValue);
  &lt;span class=&quot;hljs-literal&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;100&lt;/span&gt;);

&amp;nbsp;        &lt;span class=&quot;hljs-comment&quot;&gt;// delay in between reads for stability&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;
}
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/6453067740423840135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/04/analog-read-serial.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/6453067740423840135'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/6453067740423840135'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/04/analog-read-serial.html' title='Analog Read Serial'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkIVbO9SfYrXCsq0FNmK36QNq3UlKrO1tHMi2MSbiMRcA2arRP_ns3DKDFqyvtBOlEfXd7n3y7t9_ix22yOlTBhnSoFpguLSNSGlgfvkzB7twl0z5VCrh7UALxm1kPCdcDHyT-rXI-cOI/s72-c/1587217332670874-0.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-758053256516536559.post-3450586403628324872</id><published>2020-03-26T16:17:00.002+05:30</published><updated>2020-04-26T14:51:41.414+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino Projects"/><title type='text'>PIR Motion Sensor with Arduino</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;In this project, we will learn about PIR Sensor and how can it be used as a Motion Sensor through the Arduino PIR Sensor Tutorial. By going through this project, you can understand how PIR Sensor works and how to hook up a PIR Sensor to Arduino.We have made a project using Arduino, PIR Sensor and GSM Module called GSM based Home Security System using Arduino. If you understand how a PIR Sensor works, then you can many such interesting projects and even more complex ones.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Overview&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;A PIR Sensor or a Passive Infrared Sensor is an electronic device that measures the infrared (IR) light emitted by the objects in its observable area. The term ‘Passive’ in the PIR Sensor indicates that the sensor actually doesn’t emit any infrared light but rather passively detects it that is emitted by its surrounding objects.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Everyobject, with its surface temperature greater than absolute zero i.e. -273&lt;sup&gt;0&amp;nbsp;&lt;/sup&gt;C emits heat in the form of infrared radiation. Humans cannot see this radiation as the radiations are in infrared wavelength.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;PIR Sensor&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;A typical PIR Sensor looks like the one shown in the image below. To connect with external devices, it has only three pins namely VCC, Digital OUT (Data) and GND.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;img alt=&quot;PIR Motion Sensor with Arduino&quot; border=&quot;0&quot; height=&quot;427&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNiQ-JbeeoEBY0R1xBT0QbGIzkBL9vUkEx1G6OvBYFuSIJ_MerM6_ca1gk8a7fVi38JSk80lwDG_-UAC-ON8ZrJOJow6wlXUgHL-7OgYv3_Ag8TXbZTS_Gk2AOk4ERGJVnOvT4Hlthfb4/s640/1585217703178867-0.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot; title=&quot;PIR Motion Sensor with Arduino&quot; width=&quot;640&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #073763;&quot;&gt;PIR Motion Sensor with Arduino&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNiQ-JbeeoEBY0R1xBT0QbGIzkBL9vUkEx1G6OvBYFuSIJ_MerM6_ca1gk8a7fVi38JSk80lwDG_-UAC-ON8ZrJOJow6wlXUgHL-7OgYv3_Ag8TXbZTS_Gk2AOk4ERGJVnOvT4Hlthfb4/s1600/1585217703178867-0.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    
  &lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;On the top of sensor board, there is a special type of lens called Fresnal Lens that is covering up the actual Pyroelectric Sensor. The job of the Fresnal Lens is to focus all the infrared radiation onto the pyroelectric sensor.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEVjpph0J-eXtGdwmhtu9qXE8xgOPbbpOse43sahRm32RT9gxoKUCrJC7-aF85Zc3HPsDy6s7PBuAYvqCITlB8YSoSfSx-zWWF5YR2ikOM6OMsm-Xs_qO115Jm4yq9LqCUpO09Bqg0NzU/s1600/1585217698817147-1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;PIR Motion Sensor with Arduino&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEVjpph0J-eXtGdwmhtu9qXE8xgOPbbpOse43sahRm32RT9gxoKUCrJC7-aF85Zc3HPsDy6s7PBuAYvqCITlB8YSoSfSx-zWWF5YR2ikOM6OMsm-Xs_qO115Jm4yq9LqCUpO09Bqg0NzU/s400/1585217698817147-1.png&quot; title=&quot;PIR Motion Sensor with Arduino&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;If you look at the back of the PIR Sensor board, the whole circuitry is housed there. The brain of the PIR Sensor Module is the BISS0001 PIR Motion Detector IC. Near this IC, we have two potentiometers, one for adjusting the Sensitivity and the other is for adjusting the delay time.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Using Sensitivity Adjust, you can control the range of field of view and in our sensor, it is up to 7 meters. Using the Delay Time Adjust, you can control the duration for which the Digital Out will stay HIGH when a moving object is detected.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: red;&quot;&gt;
How PIR Sensor works?&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;PIR Sensors are complicated than most other sensors. PIR Motion Sensor may seem simple when implemented as all you need to do is check for a HIGH signal on the Digital Out Pin of the Sensor whenever motion is detected.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;But, internally, there is a lot going on and the input and output of the sensor are dependent on several variables.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;The actual PIR Sensor i.e. the one which is covered with a lens, consists of two slots and both these slots are made up of IR Sensitive materials. Under normal condition where there is no movement in front of the sensor, both the slots in the Sensor detect same amount of infrared radiation.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;When there is movement in front of the sensor, like a human or a cat, their radiation is interpreted by one of the slots first and the differential output between the two slots becomes positive.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;As the person moves away, the second slot detects the radiation and the differential output will become negative. Based these output pulses, a motion is detected.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: red;&quot;&gt;
Testing the PIR Sensor&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Since the Digital Out Pin of the PIR Sensor is either HIGH or LOW based on the movement detected, you can build a simple circuit to test the PIR Sensor.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;The first circuit consists of a PIR Sensor and an LED. When the PIR Sensor detects motions, the LED turns ON. The duration for which the LED is ON can be adjusted with the help of Delay Adjust POT.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_5BOOmMrzBoxClZAKcN4ZdmUp2xgsk9gIvWDugTJjLCjpeCPX3P5ugEiuMpnfvd6i4JOPCqMHsdtWAGmvxL5Em8qicn-ZwYhIauEY_Un7wdj2lUtUj4ZMdZCJ-zzUOPRepDIejAkaEGY/s1600/1585217694457592-2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;PIR Motion Sensor with Arduino&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_5BOOmMrzBoxClZAKcN4ZdmUp2xgsk9gIvWDugTJjLCjpeCPX3P5ugEiuMpnfvd6i4JOPCqMHsdtWAGmvxL5Em8qicn-ZwYhIauEY_Un7wdj2lUtUj4ZMdZCJ-zzUOPRepDIejAkaEGY/s1600/1585217694457592-2.png&quot; title=&quot;PIR Motion Sensor with Arduino&quot; width=&quot;400&quot; /&gt;
  &lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;A similar PIR Sensor testing circuit is shown below but it consists of a buzzer. In order to drive the buzzer, an NPN Transistor like BC547 or 2N2222 can be used. The buzzer will be activated when the sensor detects any movement.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
PIR Motion Sensor using Arduino&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Let us make a small Motion Sensor or Motion Detector project using Arduino and PIR Sensor. In this project, the PIR Sensor detects any movement in front of it and signals Arduino. Whenever any movement is detected, Arduino will activate an alarm in the form of a Buzzer.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;This circuit doesn’t implement a major design but gives an idea about how to interface a PIR Sensor to Arduino and how to can we Arduino to use the data from the PIR Sensor and drive other output devices or loads like relay, GSM Module, buzzer etc.&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha38SzYjVfudCsOJ9KiMiENxIYYusjta3hFUALow_L7-keQtIB0C95VzVcT8Q8GJPsl3hMMdDDplQPIo7aLuk4x4a-TxQ5GcxEKPc7wRNoqGXEzyyeQhVlnK-YNlN6di5kBJm4Q9QOWwk/s1600/1585217681931610-3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;PIR Motion Sensor with Arduino&quot; border=&quot;0&quot; height=&quot;432&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha38SzYjVfudCsOJ9KiMiENxIYYusjta3hFUALow_L7-keQtIB0C95VzVcT8Q8GJPsl3hMMdDDplQPIo7aLuk4x4a-TxQ5GcxEKPc7wRNoqGXEzyyeQhVlnK-YNlN6di5kBJm4Q9QOWwk/s640/1585217681931610-3.png&quot; title=&quot;PIR Motion Sensor with Arduino&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h4&gt;
&lt;span style=&quot;color: red;&quot;&gt;
Components Required&lt;/span&gt;&lt;/h4&gt;
&lt;ul&gt;&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Arduino UNO&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;PIR Sensor&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;5V Buzzer&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Breadboard&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Connecting Wires&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Power Supply&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h4&gt;
&lt;span style=&quot;color: red;&quot;&gt;
Circuit Design&lt;/span&gt;&lt;/h4&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;The design of the PIR Motion Sensor using Arduino is very simple. The PIR Sensor Module has three pins: VCC, Digital Out and GND. Connect VCC and GND to +5V and GND respectively. Then connect the Digital Out Pin of the PIR sensor to the digital I/O pin 2 of Arduino.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;As we need to indicate the detection of motion by the sensor, connect a buzzer to Pin 3 of the Arduino.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;NOTE&lt;/b&gt;:&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt; Buzzer is connected directly to Arduino. I suggest you to connect it through a transistor as shown in the test circuit.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;CODE&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table class=&quot;highlight tab-size js-file-line-container&quot; data-paste-markdown-skip=&quot;&quot; data-tab-size=&quot;8&quot; style=&quot;background: rgb(255, 255, 255); border-collapse: collapse; border-spacing: 0px; border: 0px; box-sizing: border-box; color: #333333; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 12px; line-height: 1.4; margin: 0px; padding: 0px; width: 314px;&quot;&gt;&lt;tbody style=&quot;border-bottom: 1px solid rgb(221, 221, 221); box-sizing: border-box;&quot;&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;2&quot; id=&quot;file-arduino_pir_sensor-ino-L2&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC2&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;int&lt;/span&gt; sensor = &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;8&lt;/span&gt;;
&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;int&lt;/span&gt; buzzer = &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;11&lt;/span&gt;;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;3&quot; id=&quot;file-arduino_pir_sensor-ino-L3&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC3&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;int&lt;/span&gt; led = &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;13&lt;/span&gt;;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;4&quot; id=&quot;file-arduino_pir_sensor-ino-L4&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC4&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #6f42c1;&quot;&gt;setup&lt;/span&gt;() &lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;5&quot; id=&quot;file-arduino_pir_sensor-ino-L5&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC5&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;{&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;6&quot; id=&quot;file-arduino_pir_sensor-ino-L6&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC6&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;pinMode&lt;/span&gt;(buzzer, OUTPUT);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;7&quot; id=&quot;file-arduino_pir_sensor-ino-L7&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC7&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;pinMode&lt;/span&gt;(sensor, INPUT);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;8&quot; id=&quot;file-arduino_pir_sensor-ino-L8&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC8&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;pinMode&lt;/span&gt;(led, OUTPUT);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;9&quot; id=&quot;file-arduino_pir_sensor-ino-L9&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC9&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;10&quot; id=&quot;file-arduino_pir_sensor-ino-L10&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC10&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(buzzer,LOW);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;11&quot; id=&quot;file-arduino_pir_sensor-ino-L11&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC11&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(sensor,LOW);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;12&quot; id=&quot;file-arduino_pir_sensor-ino-L12&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC12&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;13&quot; id=&quot;file-arduino_pir_sensor-ino-L13&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC13&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(led,LOW);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;14&quot; id=&quot;file-arduino_pir_sensor-ino-L14&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC14&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;15&quot; id=&quot;file-arduino_pir_sensor-ino-L15&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC15&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;while&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;millis&lt;/span&gt;()&amp;lt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;13000&lt;/span&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;16&quot; id=&quot;file-arduino_pir_sensor-ino-L16&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC16&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;{&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;17&quot; id=&quot;file-arduino_pir_sensor-ino-L17&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC17&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(led,HIGH);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;18&quot; id=&quot;file-arduino_pir_sensor-ino-L18&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC18&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;50&lt;/span&gt;);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;19&quot; id=&quot;file-arduino_pir_sensor-ino-L19&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC19&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(led,LOW);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;20&quot; id=&quot;file-arduino_pir_sensor-ino-L20&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC20&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;50&lt;/span&gt;);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;21&quot; id=&quot;file-arduino_pir_sensor-ino-L21&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC21&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;}&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;22&quot; id=&quot;file-arduino_pir_sensor-ino-L22&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC22&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(led,HIGH);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;23&quot; id=&quot;file-arduino_pir_sensor-ino-L23&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC23&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;24&quot; id=&quot;file-arduino_pir_sensor-ino-L24&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC24&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;}&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;25&quot; id=&quot;file-arduino_pir_sensor-ino-L25&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC25&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;26&quot; id=&quot;file-arduino_pir_sensor-ino-L26&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC26&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #6f42c1;&quot;&gt;loop&lt;/span&gt;() &lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;27&quot; id=&quot;file-arduino_pir_sensor-ino-L27&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC27&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;{&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;28&quot; id=&quot;file-arduino_pir_sensor-ino-L28&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC28&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalRead&lt;/span&gt;(sensor)==HIGH)&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;29&quot; id=&quot;file-arduino_pir_sensor-ino-L29&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC29&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;{&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;30&quot; id=&quot;file-arduino_pir_sensor-ino-L30&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC30&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(buzzer,HIGH);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;31&quot; id=&quot;file-arduino_pir_sensor-ino-L31&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC31&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;delay&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;3000&lt;/span&gt;);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;32&quot; id=&quot;file-arduino_pir_sensor-ino-L32&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC32&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalWrite&lt;/span&gt;(buzzer,LOW); &lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;33&quot; id=&quot;file-arduino_pir_sensor-ino-L33&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC33&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #d73a49;&quot;&gt;while&lt;/span&gt;(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #005cc5;&quot;&gt;digitalRead&lt;/span&gt;(sensor)==HIGH);&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;34&quot; id=&quot;file-arduino_pir_sensor-ino-L34&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC34&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;}&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;35&quot; id=&quot;file-arduino_pir_sensor-ino-L35&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC35&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td class=&quot;blob-num js-line-number&quot; data-line-number=&quot;36&quot; id=&quot;file-arduino_pir_sensor-ino-L36&quot; style=&quot;background: transparent; border-top: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: rgba(27, 31, 35, 0.3); cursor: pointer; line-height: 20px; min-width: inherit; padding: 1px 10px !important; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 34.6667px;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;blob-code blob-code-inner js-file-line&quot; id=&quot;file-arduino_pir_sensor-ino-LC36&quot; style=&quot;background: transparent; border: 0px; box-sizing: border-box; color: #24292e; line-height: 20px; overflow-wrap: normal; overflow: visible; padding: 1px 10px !important; position: relative; vertical-align: top; white-space: pre;&quot;&gt;}&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3&gt;
&lt;span style=&quot;color: red;&quot;&gt;Working of Arduino PIR Sensor Motion Detector&lt;/span&gt;&lt;/h3&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;The working of this project is very simple. When the system is powered on, the Arduino waits for the PIR Sensor to be calibrated. The calibration period is set to 10 seconds and during this time, there should be no movements in front of the PIR Sensor.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;After the calibration, the PIR Sensor will be ready to detect any movement in front of it. If the PIR Sensor detects any movements, its Digital Out pin, which is connected to Pin 2 of Arduino will become HIGH.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Arduino will detect this HIGH Signal and activates the buzzer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: red;&quot;&gt;
Applications&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;Arduino PIR Sensor Interface can be implemented in a wide range of project but the important one is the Motion Detection System.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;A variety of Home Security Systems can be implemented using Arduino and PIR Sensor.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://ietianarun.blogspot.com/feeds/3450586403628324872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://ietianarun.blogspot.com/2020/03/pir-motion-sensor-with-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3450586403628324872'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/758053256516536559/posts/default/3450586403628324872'/><link rel='alternate' type='text/html' href='https://ietianarun.blogspot.com/2020/03/pir-motion-sensor-with-arduino.html' title='PIR Motion Sensor with Arduino'/><author><name>Arun kr.g</name><uri>http://www.blogger.com/profile/18210834731077035513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-uK6KPgAJTOFybnYQ2XquVKucV48MhTRg0tYzh7dAmps7GdSHHsiBhCiZCRnUB3ZMCqNE_jaZ0qwcNs5Xl017YKET4w9r4l2PbkZ7jptvSSLjNu5WcDbMUpX2NHA6AaU/s113/dc4c8fba-ec30-47e4-aae0-aa7f48b42f94.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNiQ-JbeeoEBY0R1xBT0QbGIzkBL9vUkEx1G6OvBYFuSIJ_MerM6_ca1gk8a7fVi38JSk80lwDG_-UAC-ON8ZrJOJow6wlXUgHL-7OgYv3_Ag8TXbZTS_Gk2AOk4ERGJVnOvT4Hlthfb4/s72-c/1585217703178867-0.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>