<?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-4393389959180155903</id><updated>2024-09-05T14:02:11.535+03:00</updated><category term="Arduino"/><category term="Digital"/><category term="Basics"/><title type='text'>Уроки Arduino</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-8304258631710751262</id><published>2012-09-21T10:48:00.002+04:00</published><updated>2012-09-21T10:48:15.765+04:00</updated><title type='text'>AnalogInOutSerial</title><content type='html'>&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Этот пример показывает, как читать аналоговый входной вывод, затем переносить результат в диапазон от 0 до 255, а затем использовать этот результат для установки длительности импульса модуляции (PWM) в выходной контакт, чтобы установить яркость светодиодов.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h3 style=&quot;background-color: white; color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; line-height: 23px; margin-bottom: 5px;&quot;&gt;
Необходимое оборудование&lt;/h3&gt;
&lt;ul style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; list-style-image: url(http://arduino.cc/en/pub/skins/arduinoWide_SSO/img/bullet.gif); list-style-position: inside; margin: 0px; padding-left: 10px;&quot;&gt;
&lt;li&gt;Arduino&lt;/li&gt;
&lt;li&gt;потенциометр&lt;/li&gt;
&lt;li&gt;светодиод&lt;/li&gt;
&lt;li&gt;220 Ом резистор&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;color: #555555; font-family: Georgia, Times New Roman, Times, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 23px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;background-color: white; color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; line-height: 23px; margin-bottom: 5px;&quot;&gt;
Цепь&lt;/h3&gt;
&lt;div class=&quot;circuit&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/analoginoutseria1_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/analoginoutserial1_bb.png&quot; style=&quot;border: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Подключите один вывод из вашего потенциометра на 5V, центральный контакт на аналоговый вывод 0, а последний вывод на землю.&amp;nbsp;Далее подключить&amp;nbsp;светодиод&amp;nbsp;через 220 Ом резистор для ограничения тока в цифровой контакт 9.&amp;nbsp;Длинный пин должен быть подключен к выходу из резистора, короткий на землю.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;
Схематический&lt;/h3&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/analoginoutserial_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/analoginoutserial_sch.png&quot; style=&quot;border: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;
Код&lt;/h3&gt;
В программе ниже, после объявления двух назначение выводов (аналоговый 0 для потенциометров и цифровых 9 для LED) и двух переменных,&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;sensorValue&lt;/code&gt;&amp;nbsp;и&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;outputValue&lt;/code&gt;&amp;nbsp;, единственное, что вы делаете, будет в настройках функцию начать последовательную связь.&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
Далее, в основной цикл код,&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;sensorValue&lt;/code&gt;&amp;nbsp;назначается для хранения &amp;nbsp;аналогового значения, поступающие из потенциометра.&amp;nbsp;Поскольку Arduino имеет&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;analogRead&lt;/code&gt;&amp;nbsp;разрешение 0-1023, а&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;analogWrite&lt;/code&gt;&amp;nbsp;разрешение только 0-255, это необработанные данные от потенциометра должно быть уменьшено до его использования для затемнения LED.&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
В целях расширения этого значения, использовать функцию&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;map()&lt;/code&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot; style=&quot;color: rgb(153, 153, 153) !important; font-family: Monaco, &#39;Courier New&#39;, Courier, mono; height: auto !important; line-height: normal;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock2&quot;&gt;
&lt;div class=&quot;sourceblocktext&quot; style=&quot;color: black; padding: 0.5em;&quot;&gt;
&lt;div class=&quot;arduino&quot; style=&quot;font-family: monospace; font-size: small; height: 12px; line-height: 1;&quot;&gt;
&lt;span style=&quot;line-height: 12px;&quot;&gt;outputValue&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; line-height: 12px;&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;sensorValue&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;line-height: 12px;&quot;&gt;1023&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;line-height: 12px;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;outputValue&lt;/code&gt;&amp;nbsp;назначается равной масштабированное значение с потенциометра.&amp;nbsp;&lt;span style=&quot;font-family: monospace; white-space: nowrap;&quot;&gt;map()&lt;/span&gt;&amp;nbsp;принимает пять аргументов: значение, которое будет отображаться, диапазон низких и высоких частот исходных данных, а также низких и высоких значений, что данные, которые будут масштабироваться тоже.&amp;nbsp;В этом случае, данные датчиков отображается вниз от своего первоначального диапазона от 0 до 1023 от 0 до 255.&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
Данные отображаются с датчика затем выводятся на&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;analogOutPin&lt;/code&gt;&amp;nbsp;для затемнения или осветления LED в зависимости от значения потенциометра.&amp;nbsp;Наконец, как значение и масштабированное значение датчиков направляются в последовательный порт непрерывным потоком данных.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;analogInPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;A0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;analogOutPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;sensorValue&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;outputValue&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;9600&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; sensorValue&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;analogRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;analogInPin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; outputValue&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;sensorValue&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;1023&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;analogWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;analogOutPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;outputValue&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #0066cc; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&quot;sensor = &quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;sensorValue&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;color: #0066cc; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&quot;&lt;span class=&quot;es1&quot; style=&quot;color: #000099; font-weight: bold;&quot;&gt;\t&lt;/span&gt;&amp;nbsp;output = &quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;outputValue&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/8304258631710751262/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2012/09/analoginoutserial.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8304258631710751262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8304258631710751262'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2012/09/analoginoutserial.html' title='AnalogInOutSerial'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-4604898810032452440</id><published>2012-09-21T10:26:00.002+04:00</published><updated>2012-09-21T10:26:46.693+04:00</updated><title type='text'>Tone4</title><content type='html'>&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Этот пример показывает, как использовать&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;tone()&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&amp;nbsp;команду, чтобы играть разные ноты на несколько выходов.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;tone()&amp;nbsp;команда работает, взяв на себя одну из внутренних таймеров Atmega, в установив ее на частоту, которую вы хотите, и с помощью таймера к импульсным выходным контактом.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Так как это только с помощью одного таймера, вы можете играть только одну ноту одновременно.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Вы можете, однако, играют заметки о нескольких контактов последовательно.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Чтобы сделать это, вам нужно выключения таймера на один контакт, прежде чем переходить к следующей.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;background-color: white; color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; line-height: 23px; margin-bottom: 5px;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;3 маленьких динамика 8 Ом&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;3 резистора 100 Ом&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;макетная плата&amp;nbsp;&lt;/li&gt;
&lt;span style=&quot;color: #555555; font-family: Georgia, Times New Roman, Times, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 27px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; line-height: 23px; margin-bottom: 5px;&quot;&gt;
Цепь&lt;/h3&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_3_speakers_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_3_speakers_bb.png&quot; style=&quot;border: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;
Схематический&lt;/h3&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_3_speakers_schem.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_3_speakers_schem.png&quot; style=&quot;border: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;
Код&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;&quot;&gt;В &amp;nbsp;коде ниже играет тона на каждый из динамиков в последовательности, после отключения предыдущего динамика.&amp;nbsp;&lt;/span&gt;Обратите внимание, что продолжительность каждого тона равна задержке, которая следует за ним.&lt;br /&gt;
&lt;div&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;noTone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; tone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;440&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; noTone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; tone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;494&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; noTone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; tone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;523&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;color: black; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/4604898810032452440/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2012/09/tone4.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4604898810032452440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4604898810032452440'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2012/09/tone4.html' title='Tone4'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-8331774823309502467</id><published>2012-09-15T09:21:00.004+04:00</published><updated>2012-09-15T09:21:51.761+04:00</updated><title type='text'>Робот-бармен на базе Arduino Mega</title><content type='html'>&lt;object height=&quot;344&quot; style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px; margin: 0px; padding: 0px;&quot; width=&quot;425&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/371lgYzPtRs&amp;amp;hl=en&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;opaque&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/object&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;Робот-бармен — отличное дополонение для бара или весёлой дружеской вечеринки.&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;Этот робот собран из акрила (при помощи лазерной резки) и представляет собой несколько «этажей».&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;В верхнем «слое» находятся перевернутое бутылки с ингредиентами для коктейлей. Каждая ёмкость емеет свой канал с клапаном, который позволяет налить жидкость в стакан, который двигается внизу, вокруг центра машины. После прохождения «круга» стакан возвращается к открытой части и пользователь может взять свой напиток.&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;В основе электронной начинки робота, лежит Arduino Mega с&amp;nbsp;&lt;/span&gt;&lt;noindex style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://robocraft.ru/blog/news/517.html&quot; rel=&quot;nofollow&quot; style=&quot;color: #70aae0; margin: 0px; padding: 0px;&quot;&gt;Android ADK&lt;/a&gt;&lt;/noindex&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&amp;nbsp;и планшеный компьютер с ОС Андроид.&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;В качестве источника питания используется компьютерный блок питания ATX.&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;В качестве движителя используется обычный мотор-редуктор, управляемый через&amp;nbsp;&lt;/span&gt;&lt;noindex style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://robocraft.ru/tag/H-%D0%BC%D0%BE%D1%81%D1%82&quot; rel=&quot;nofollow&quot; style=&quot;color: #70aae0; margin: 0px; padding: 0px;&quot;&gt;H-мост&lt;/a&gt;&lt;/noindex&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;, а положение вала контролируется&amp;nbsp;&lt;/span&gt;&lt;noindex style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://robocraft.ru/blog/electronics/594.html&quot; rel=&quot;nofollow&quot; style=&quot;color: #70aae0; margin: 0px; padding: 0px;&quot;&gt;датчиками Холла&lt;/a&gt;&lt;/noindex&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&amp;nbsp;(магниты находятся под позицией каждого ингредиента).&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;Клапаны на соплах управляются соленоидами, для контроля которых используется те же H-мосты.&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;Конструкция робота-бармена в Solidworks:&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;object height=&quot;344&quot; style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px; margin: 0px; padding: 0px;&quot; width=&quot;425&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/b6b7NA9KHbg&amp;amp;hl=en&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;opaque&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/object&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;u style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px; margin: 0px; padding: 0px;&quot;&gt;Ссылки:&lt;/u&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot; /&gt;&lt;noindex style=&quot;background-color: white; color: #333333; font-family: Verdana, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://andrewparra.net/bender/&quot; rel=&quot;nofollow&quot; style=&quot;color: #70aae0; margin: 0px; padding: 0px;&quot;&gt;andrewparra.net/bender/&lt;/a&gt;&lt;/noindex&gt;&lt;br /&gt;
&lt;br /&gt;
Взято с&amp;nbsp;&lt;a href=&quot;http://robocraft.ru/&quot;&gt;http://robocraft.ru&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/8331774823309502467/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2012/09/arduino-mega.html#comment-form' title='Комментарии: 1'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8331774823309502467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8331774823309502467'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2012/09/arduino-mega.html' title='Робот-бармен на базе Arduino Mega'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-8570848340231258067</id><published>2012-09-15T09:17:00.001+04:00</published><updated>2012-09-15T09:17:16.749+04:00</updated><title type='text'>Simple Keyboard</title><content type='html'>&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Этот пример показывает, как использовать&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&amp;nbsp;tone()&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&amp;nbsp;команду для реагирования в зависимости от датчика нажатия.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h3 style=&quot;margin-bottom: 5px;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;margin-bottom: 5px;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white; color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0.1em; line-height: 23px; margin-bottom: 5px;&quot;&gt;
Необходимое оборудование&lt;/h3&gt;
&lt;div&gt;

&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;3 сенсорные кнопки&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;маленький динамик 8 Ом&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;3 резистора 10 КОм&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 100 Ом&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal !important; letter-spacing: normal; line-height: 27px;&quot;&gt;макетная плата&amp;nbsp;&lt;/li&gt;
&lt;span style=&quot;color: #555555; font-family: Georgia, Times New Roman, Times, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;span class=&quot;&quot;&gt;Подключите один выход динамика к цифровому выводу 8 через резистор 100 Ом, а его другой выход на землю.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
Подключите ваши датчики параллельно на 5В. Подключите каждый датчик в аналоговые контакты 0-2, используя 10KОм резисторы между выходами датчиков.&lt;/div&gt;
&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_fsrs_speaker_bb.png&quot; style=&quot;background-color: white; border: 0px; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_fsrs_speaker_schem.png&quot; rel=&quot;nofollow&quot; style=&quot;background-color: white; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_fsrs_speaker_schem.png&quot; style=&quot;border: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;threshold&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;notes&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; NOTE_A4&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;NOTE_B4&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;NOTE_C3&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;thisSensor&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;thisSensor&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;thisSensor&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;sensorReading&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;analogRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;thisSensor&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;sensorReading&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;threshold&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; tone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;notes&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;thisSensor&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px;&quot; /&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/8570848340231258067/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2012/09/simple-keyboard.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8570848340231258067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8570848340231258067'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2012/09/simple-keyboard.html' title='Simple Keyboard'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-3433789602669370371</id><published>2012-08-31T15:54:00.001+04:00</published><updated>2012-08-31T15:57:20.516+04:00</updated><title type='text'>Как рождаются 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;br /&gt;
&lt;a href=&quot;http://habrahabr.ru/post/149855/&quot;&gt;http://habrahabr.ru/post/149855/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Не понимаю почему Arduino не у нас появилась, все для этого существует: техническая база, умные люди, которые могли бы это придумать и не менее умные, которые нашли бы применение этой плате... Обидно...&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/3433789602669370371/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2012/08/httphabrahabr.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/3433789602669370371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/3433789602669370371'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2012/08/httphabrahabr.html' title='Как рождаются Arduino'/><author><name>russich</name><uri>http://www.blogger.com/profile/02398384717732660002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-6238976907939160858</id><published>2011-12-11T12:05:00.001+04:00</published><updated>2012-09-15T09:17:18.781+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Pitch follower</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Этот пример показывает, как использовать команду&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;tone()&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;, чтобы создать звук, который использует значения аналоговых входов&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px; text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;маленький динамик 8 Ом&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;1 фотоэлемент&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;резистор 4,7 КОм&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 100 Ом&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;макетная плата&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;
&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_speaker_photocell_bb.png&quot; style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em; text-align: -webkit-auto;&quot; title=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Подключите одну клемму вашего динамика к цифровому контакту 9 через резистор 100 Ом, а&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;другую клемму на землю. Запитайте фоторезистор с помощью 5В и подключите на аналоговый порт 0 с добавлением резистора 4,7 КОм на землю.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/arduino_speaker_photocell_schem.png&quot; style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Код для этого примера очень простой.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Просто возьмите значение с &amp;nbsp;аналогового входа и отобразите его значения для диапазона звуков.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Люди могут слышать с 20 - 20000 Гц, а 100 - 1000 как правило, работает очень хорошо для этого скетча&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;vspace&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-top: 1.33em; text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
Вы должны будете получить фактический диапазон аналогового входа для отображения.&amp;nbsp;В схеме показано, аналоговое значение входного варьировались от примерно 400 до примерно 1000.&amp;nbsp;Изменение значения в команде&amp;nbsp;map()&amp;nbsp;, чтобы соответствовать диапазон для вашего датчика.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-top: 1.33em; text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
Эскиз выглядит следующим образом:&lt;/div&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px; text-align: -webkit-auto;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;9600&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: monospace; font-size: small; line-height: 12px; text-align: -webkit-auto;&quot; /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px; text-align: -webkit-auto;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;sensorReading&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;analogRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;A0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;sensorReading&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;thisPitch&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;sensorReading&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp; tone&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;thisPitch&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/6238976907939160858/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/12/pitch-follower.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/6238976907939160858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/6238976907939160858'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/12/pitch-follower.html' title='Pitch follower'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-1709845598546878293</id><published>2011-12-10T21:47:00.001+04:00</published><updated>2011-12-10T22:25:03.162+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Tone</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Этот пример показывает, как использовать команду&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;tone()&lt;/span&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;для генерирования (проигрывания) музыкальных нот.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Он играет маленькую мелодию, которую вы, возможно, прежде слышали.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;маленький динамик 8 Ом&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 100 Ом&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/speaker_bb.png&quot; style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em; text-align: -webkit-auto;&quot; title=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Подключите одну клемму вашего динамика к цифровому контакту 8 через 100 Ом.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; text-align: -webkit-auto;&quot;&gt;Подключите другую клемму на землю.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/speaker_schem.png&quot; style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #00979c; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em; text-align: -webkit-auto;&quot; title=&quot;&quot; /&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;&quot;&gt;Ниже код использует дополнительный файл, pitches.h.&amp;nbsp;&lt;/span&gt;Этот файл содержит все значения для типичных нот.&amp;nbsp;Например, NOTE_C4 является средним C. NOTE_FS 4, фа-диез, и так далее.&amp;nbsp;Эта таблица нот была первоначально написана Бретт Hagman, на чьей работе команда&amp;nbsp;tone()&amp;nbsp;была основана.&amp;nbsp;&lt;span class=&quot;&quot;&gt;Вам может она быть полезной всякий раз, когда вы хотите сделать музыкальные ноты.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-top: 1.33em; text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Основной эскиз выглядит следующим образом:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;sourceblocktext&quot; style=&quot;background-color: white; padding-bottom: 0.5em; padding-left: 0.5em; padding-right: 0.5em; padding-top: 0.5em;&quot;&gt;
&lt;div class=&quot;arduino&quot; style=&quot;font-family: monospace; font-size: small; height: 598px;&quot;&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e;&quot;&gt;#include &quot;pitches.h&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;melody&lt;span class=&quot;br0&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;NOTE_C4&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;NOTE_G3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;NOTE_G3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;NOTE_A3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;NOTE_G3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;NOTE_B3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;NOTE_C4&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;noteDurations&lt;span class=&quot;br0&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;thisNote&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&amp;nbsp;thisNote&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&amp;nbsp;thisNote&lt;span class=&quot;sy0&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;noteDuration&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;noteDurations&lt;span class=&quot;br0&quot;&gt;[&lt;/span&gt;thisNote&lt;span class=&quot;br0&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp; &amp;nbsp; tone&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&amp;nbsp;melody&lt;span class=&quot;br0&quot;&gt;[&lt;/span&gt;thisNote&lt;span class=&quot;br0&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;noteDuration&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;pauseBetweenNotes&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt;&amp;nbsp;noteDuration&amp;nbsp;&lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu16&quot; style=&quot;color: purple;&quot;&gt;1.30&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;pauseBetweenNotes&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp; &amp;nbsp; noTone&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;br0&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Для того, чтобы pitches.h файл, нажмите на &quot;новую вкладку&quot; кнопку в верхнем правом углу окна.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Выглядит это примерно так:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/newTab.png&quot; style=&quot;background-color: white; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;Вставьте следующий код:&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B0 &amp;nbsp;31&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C1 &amp;nbsp;33&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS1 35&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D1 &amp;nbsp;37&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS1 39&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E1 &amp;nbsp;41&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F1 &amp;nbsp;44&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS1 46&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G1 &amp;nbsp;49&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS1 52&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A1 &amp;nbsp;55&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS1 58&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B1 &amp;nbsp;62&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C2 &amp;nbsp;65&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS2 69&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D2 &amp;nbsp;73&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS2 78&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E2 &amp;nbsp;82&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F2 &amp;nbsp;87&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS2 93&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G2 &amp;nbsp;98&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS2 104&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A2 &amp;nbsp;110&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS2 117&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B2 &amp;nbsp;123&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C3 &amp;nbsp;131&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS3 139&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D3 &amp;nbsp;147&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS3 156&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E3 &amp;nbsp;165&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F3 &amp;nbsp;175&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS3 185&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G3 &amp;nbsp;196&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS3 208&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A3 &amp;nbsp;220&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS3 233&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B3 &amp;nbsp;247&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C4 &amp;nbsp;262&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS4 277&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D4 &amp;nbsp;294&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS4 311&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E4 &amp;nbsp;330&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F4 &amp;nbsp;349&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS4 370&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G4 &amp;nbsp;392&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS4 415&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A4 &amp;nbsp;440&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS4 466&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B4 &amp;nbsp;494&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C5 &amp;nbsp;523&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS5 554&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D5 &amp;nbsp;587&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS5 622&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E5 &amp;nbsp;659&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F5 &amp;nbsp;698&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS5 740&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G5 &amp;nbsp;784&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS5 831&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A5 &amp;nbsp;880&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS5 932&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B5 &amp;nbsp;988&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C6 &amp;nbsp;1047&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS6 1109&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D6 &amp;nbsp;1175&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS6 1245&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E6 &amp;nbsp;1319&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F6 &amp;nbsp;1397&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS6 1480&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G6 &amp;nbsp;1568&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS6 1661&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A6 &amp;nbsp;1760&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS6 1865&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B6 &amp;nbsp;1976&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C7 &amp;nbsp;2093&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS7 2217&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D7 &amp;nbsp;2349&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS7 2489&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_E7 &amp;nbsp;2637&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_F7 &amp;nbsp;2794&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_FS7 2960&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_G7 &amp;nbsp;3136&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_GS7 3322&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_A7 &amp;nbsp;3520&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_AS7 3729&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_B7 &amp;nbsp;3951&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_C8 &amp;nbsp;4186&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_CS8 4435&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_D8 &amp;nbsp;4699&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co2&quot; style=&quot;color: #7e7e7e; line-height: 12px;&quot;&gt;#define NOTE_DS8 4978&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;arduino&quot; style=&quot;height: 598px;&quot;&gt;
&lt;span class=&quot;br0&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: monospace; font-size: small; line-height: 1;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/1709845598546878293/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/12/tone.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/1709845598546878293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/1709845598546878293'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/12/tone.html' title='Tone'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-3132144118331933152</id><published>2011-12-10T20:34:00.001+04:00</published><updated>2011-12-10T21:55:08.570+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Button State Change</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;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Как только у вас&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;&lt;a href=&quot;http://witharduino.blogspot.com/2011/09/button.html&quot;&gt;кнопка&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;заработает, вы захотите сделать какие-либо действия, основанные на том, сколько раз нажата кнопка.&amp;nbsp;&lt;/span&gt;Чтобы сделать это, вы должны знать, когда кнопка меняет состояние с выключенного на включенное, и посчитать, сколько раз это изменение состояния происходит.&amp;nbsp;Это называется&amp;nbsp;&lt;/span&gt;&lt;strong style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;состояние обнаружения изменений&lt;/strong&gt;&lt;strong style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;.&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;тактовая кнопка или переключатель&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 10 кОм&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;макетная плата&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;400px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;span class=&quot;&quot;&gt;Скетч постоянно читает состояние кнопки.&amp;nbsp;&lt;/span&gt;Затем он сравнивает состояние кнопки с предыдущем состоянием через цикл.&amp;nbsp;&lt;span class=&quot;&quot;&gt;Если текущее состояние кнопки, отличается от последнего состояния кнопки и текущее состояние кнопки включено, то кнопка изменилась с выключено на включено.&amp;nbsp;&lt;/span&gt;Скетч затем увеличивает счетчик кнопки.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-top: 1.33em; text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;
&lt;span class=&quot;&quot;&gt;Скетч также проверяет значение счетчика кнопки, и если оно кратно четырем, то включает светодиод на контакте 13.&amp;nbsp;&lt;/span&gt;В противном случае, он выключает его.&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;buttonPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;ledPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;buttonPushCounter&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;buttonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;lastButtonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;ledPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;9600&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; buttonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonPin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;lastButtonState&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; buttonPushCounter&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;++;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;background-color: white; color: #0066cc; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&quot;on&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;background-color: white; color: #0066cc; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&quot;number of button pushes: &amp;nbsp;&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonPushCounter&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot; style=&quot;background-color: white; color: #0066cc; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&quot;off&quot;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; lastButtonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;buttonState&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;buttonPushCounter&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;ledPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;ledPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/3132144118331933152/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/12/button-state-change.html#comment-form' title='Комментарии: 1'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/3132144118331933152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/3132144118331933152'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/12/button-state-change.html' title='Button State Change'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-4827914009758164378</id><published>2011-12-10T19:50:00.001+04:00</published><updated>2011-12-10T21:40:31.675+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Debounce</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;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;&lt;span class=&quot;&quot;&gt;Этот пример демонстрирует использование кнопки как переключателя: каждый раз, когда вы нажимаете кнопку, светодиод (или любая другая нагрузка) включается (если он выключен) или выключается (если включен).&amp;nbsp;&lt;/span&gt;Он также&lt;b&gt;&amp;nbsp;&lt;/b&gt;фильтрует (антидребезг)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;входные данные, что означает проверку дважды в короткий промежуток времени, чтобы убедиться, что кнопка определенно нажата.&amp;nbsp;Без debouncing, нажав кнопку один раз, программа может посчитать, как несколько нажатий.&amp;nbsp;Использует&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;millis()&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto;&quot;&gt;, чтобы отслеживать время, когда кнопка нажата.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;тактовая кнопка или переключатель&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 10 кОм&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;макетная плата&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px;&quot;&gt;Схема&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; text-align: -webkit-auto; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;400px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;buttonPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;const&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;ledPin&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7e7e7e; font-family: monospace; font-size: x-small;&quot;&gt;&lt;i&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br style=&quot;background-color: white; text-align: -webkit-auto;&quot; /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;ledState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;buttonState&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;lastButtonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;lastDebounceTime&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;debounceDelay&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px; text-align: -webkit-auto;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;buttonPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;ledPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw2&quot; style=&quot;background-color: white; color: #006699; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw3&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; font-weight: bold; line-height: 12px; text-align: -webkit-auto;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;reading&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;buttonPin&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;reading&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;lastButtonState&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp; &amp;nbsp; lastDebounceTime&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;millis&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;millis&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;lastDebounceTime&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;debounceDelay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp; &amp;nbsp; buttonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;reading&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;background-color: white; color: #cc6600; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;ledPin&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;buttonState&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp; lastButtonState&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;reading&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 12px; text-align: -webkit-auto;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 14px;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/4827914009758164378/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/12/debounce_10.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4827914009758164378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4827914009758164378'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/12/debounce_10.html' title='Debounce'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-4737252939099386748</id><published>2011-09-29T16:48:00.003+04:00</published><updated>2011-12-10T21:40:41.222+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Digital"/><title type='text'>Button</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Button&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Кнопки и переключатели соединяют две точки цепи при нажатии на них.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;Этот пример включает встроенный светодиод на контакте 13, когда вы нажимаете на кнопку.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;тактовая кнопка или переключатель&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;резистор 10 кОм&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;макетная плата&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;перемычки&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Подключите три провода к плате Arduino.&amp;nbsp;&lt;/span&gt;Первые два, красный и черный, подключение к двух длинных вертикальных рядов на стороне плате для предоставления доступа к 5 вольт питания и землей.&amp;nbsp;Третий провод идет от цифрового контакт 2 одна нога кнопки.&amp;nbsp;В том же нога кнопки подключается с помощью выпадающего резистор (здесь 10&amp;nbsp;&lt;span class=&quot;wikiword&quot;&gt;кОм&lt;/span&gt;&amp;nbsp;) на землю.&amp;nbsp;Другая нога от кнопки подключается к 5 вольт питания.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;
Когда кнопка открыта (unpressed) нет никакой связи между этими двумя ногами кнопки, так что вывод подключен к земле (через выпадающее резистор), и мы читаем LOW.&amp;nbsp;При нажатии на кнопку закрытия (нажата), это делает связь между его двумя ногами, подключением вывода до 5 вольт, так что мы читаем HIGH.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;
Вы также можете проволоки эта схема в обратном направлении, с подтягивающий резистор соответствии вход HIGH, LOW и будет, когда нажата кнопка.&amp;nbsp;Если так, то поведение эскиз будет пересмотрено, с светодиодной нормально и выключение при нажатии кнопки.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-top: 1.33em;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;
Если вы отключите цифровой ввода / вывода по всему, индикатор может мигать беспорядочно.&amp;nbsp;Это потому, что вход «плавающей» - то есть, он будет случайным образом возвращать либо высоким или низким.&amp;nbsp;&lt;span class=&quot;&quot;&gt;Именно поэтому вам нужно подтягивающий или выпадающее резистор в цепь.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/button_schem.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button_schem.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;



&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 14px;&quot;&gt;const&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;buttonPin&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;const&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;ledPin&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;buttonState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;buttonPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; buttonState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalRead&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;buttonPin&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;buttonState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;else&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/4737252939099386748/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/09/button.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4737252939099386748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/4737252939099386748'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/09/button.html' title='Button'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-6596823245580773855</id><published>2011-09-28T18:57:00.000+04:00</published><updated>2011-12-10T20:11:44.236+04:00</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 Without Delay</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Blink Without Delay&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Иногда вам нужно делать две вещи одновременно.&amp;nbsp;&lt;/span&gt;Например, вы можете мигать светодиодом (или некоторые другие требовательные к процессорному времени функции) пока считывается нажатие кнопки или другие данные.&amp;nbsp;В этом случае, вы не можете использовать&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;delay ()&lt;/code&gt;&amp;nbsp;, или вам придется &amp;nbsp;остановить все остальные программы, а индикатор моргнул.&amp;nbsp;Программа может пропустить нажатие кнопки, если она происходит во время delay ().&amp;nbsp;Этот скетч показывает, как мигать индикатором без использования&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;delay ()&lt;/code&gt;&amp;nbsp;.&amp;nbsp;Он следит когда Arduino переключил светодиод последний раз.&amp;nbsp;&lt;span class=&quot;&quot;&gt;Затем каждый раз через&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;&lt;span class=&quot;&quot;&gt;loop ()&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;, он проверяет, достаточно ли прошло времени.&amp;nbsp;&lt;/span&gt;Если достаточно, он переключает индикатор (включен или выключен).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-weight: normal; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;светодиод&lt;/span&gt;&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;Чтобы построить схему, возьмите светодиод и подключите его длинную, положительную ногу (т. н. анод) к контакту 13.&amp;nbsp;Подцепите &amp;nbsp;отрицательную ногу (т. н. анод) на землю.&amp;nbsp;&lt;span class=&quot;&quot;&gt;Затем подключите вашу плату Arduino на ваш компьютер, запустите программу Arduino и введите код.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;

&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Код ниже использует&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;&lt;span class=&quot;&quot;&gt;millis ()&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;, функцию, которая возвращает количество миллисекунд, прошедших со старта текущей программы на плате Arduino для мигания светодиода.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 14px;&quot;&gt;const&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;ledPin&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #7e7e7e;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;ledState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;long&lt;/span&gt;&amp;nbsp;previousMillis&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #7e7e7e;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;long&lt;/span&gt;&amp;nbsp;interval&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;unsigned&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;long&lt;/span&gt;&amp;nbsp;currentMillis&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;millis&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;currentMillis&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;-&lt;/span&gt;&amp;nbsp;previousMillis&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;interval&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; previousMillis&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;currentMillis&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ledState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;HIGH&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ledState&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;LOW&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #7e7e7e;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;ledPin&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;ledState&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/6596823245580773855/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/09/blink-without-delay.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/6596823245580773855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/6596823245580773855'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/09/blink-without-delay.html' title='Blink Without Delay'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-5602988884192494295</id><published>2011-09-27T20:13:00.001+04:00</published><updated>2011-12-10T21:41:10.913+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basics"/><title type='text'>Fade</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: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px;&quot;&gt;Fade&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Демонстрирует использование&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;функции&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;analogWrite ()&lt;/span&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;для включения и выключения светодиода. a&lt;/span&gt;&lt;span class=&quot;wikiword&quot;&gt;&lt;span class=&quot;&quot;&gt;nalogWrite&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;использует&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;широтно-импульсную модуляцию (ШИМ)&lt;/span&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;, включая и выключая цифровой выход очень быстро, чтобы создать эффект затухания.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; letter-spacing: 0.1em; margin-bottom: 5px;&quot;&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Необходимое оборудование&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;макетная плата&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;светодиод&lt;/li&gt;
&lt;li style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;резистор 220 Ом&lt;/li&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;&quot;&gt;Подключите&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;анод&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;(длинная, положительная нога) вашего светодиода на цифровой выход 9 на Arduino через 220 Ом.&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;Подключите&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;span class=&quot;&quot;&gt;катод&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;(короткая, отрицательная нога) непосредственно к земле.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/simplefade_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/simplefade_bb.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/simplefade_pin9_schem.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; color: #00979c; padding-bottom: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/simplefade_pin9_schem.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; width=&quot;300px&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; margin-bottom: 5px;&quot;&gt;




&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&lt;span class=&quot;&quot;&gt;После объявления контакта 9, чтобы был вашим&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;code style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; white-space: nowrap;&quot;&gt;&lt;span class=&quot;&quot;&gt;ledPin&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&amp;nbsp;, нечего делать в функции&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: nowrap;&quot;&gt;&amp;nbsp;setup()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&lt;span class=&quot;&quot;&gt;кода.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;В функции&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;AnalogWrite ()&lt;/code&gt;, которая будет использоваться в основном цикле вашего кода требуется два аргумента: один говорит функции какой выход использовать, и один указывает значение&amp;nbsp;ШИМ&amp;nbsp;для записи.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-size: 14px; line-height: 27px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;Для того, чтобы менять состояние светодиода с выключенного на включенный, постепенно изменяйте &amp;nbsp;значение&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;ШИМ&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&amp;nbsp;от 0 (полностью выключен) до 255 (включен), а затем обратно до 0 для завершения цикла.&amp;nbsp;В скетче ниже, значение ШИМ устанавливается с помощью&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;переменной&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: monospace; font-size: 12px; line-height: 22px; white-space: nowrap;&quot;&gt;brightness&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;.&amp;nbsp;Каждый цикл&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: monospace; font-size: 12px; line-height: 22px; white-space: nowrap;&quot;&gt;brightness&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&amp;nbsp;увеличивается на значение переменной&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;fadeAmount&lt;/code&gt;&amp;nbsp;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;Если&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: monospace; font-size: 12px; line-height: 22px; white-space: nowrap;&quot;&gt;brightness&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&amp;nbsp;достигает среднего значения &amp;nbsp;(0 или 255), то&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;fadeAmount&lt;/code&gt;&amp;nbsp;меняется свое значение на противоположное.&amp;nbsp;Другими словами, если&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;fadeAmount&lt;/code&gt;&amp;nbsp;равно 5, то &amp;nbsp;он устанавливается в -5.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 27px;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;analogWrite ()&lt;/code&gt;&amp;nbsp;может изменить значение ШИМ очень быстро, поэтому задержка в конце скетча позволяет нам заметить это изменение.&amp;nbsp;Попробуйте изменить значение задержки и посмотреть, как он меняет программу.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 14px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;brightness&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;fadeAmount&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: monospace; font-size: x-small; line-height: 14px;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;analogWrite&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;brightness&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&amp;nbsp; brightness&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;brightness&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&amp;nbsp;fadeAmount&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;brightness&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;||&lt;/span&gt;&amp;nbsp;brightness&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; fadeAmount&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;-&lt;/span&gt;fadeAmount&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/5602988884192494295/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/09/examples-basics-analogwrite.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/5602988884192494295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/5602988884192494295'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/09/examples-basics-analogwrite.html' title='Fade'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-2239475161451642063</id><published>2011-01-14T21:39:00.001+03:00</published><updated>2011-12-10T19:46:33.391+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basics"/><title type='text'>AnalogReadSerial</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: &#39;tahoma Trebuchet MS&#39;, lucida, helvetica, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 23px;&quot;&gt;&lt;i&gt;AnalogReadSerial&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Этот пример показывает, как читать аналоговый входные данные от физического мира с помощью потенциометра.&amp;nbsp;Потенциометр&amp;nbsp;простое механическое устройство, которое меняет сопротивление, когда его вал поворачивается.&amp;nbsp;Напряжение проходящее через потенциометр в аналоговый вход на Arduino, можно изменять с помощью сопротивления потенциометра, как аналоговое значение.&amp;nbsp;В этом примере вы будете следить за состоянием вашего потенциометра после установления последовательной связи между Arduino и компьютером.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;BOM&quot; style=&quot;font-size: 14px; font-weight: normal;&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0,1em; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;Требования к аппаратному обеспечению&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-image: url(http://arduino.cc/en/pub/skins/arduinoUno/img/bullet.gif); list-style-position: inside; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 10px;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;10кОм потенциометр&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;Цепь&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Подключите три провода от потенциометра на плату Arduino.&amp;nbsp;Первый идет к земле от одного из внешних контактов потенциометра.&amp;nbsp;Второй идет от 5 вольт к другому внешнему контакту потенциометра.&amp;nbsp;Третий идет с аналогового входа 0 на средний контакт потенциометра.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; font-weight: normal;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/AnalogReadSerial_BB.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/AnalogReadSerial_BB.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;При повороте вала потенциометра, вы измените сопротивление по обе стороны от движка потенциометра, который связан с центральным контактом потенциометра.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Это приводит к изменению напряжения на контактном центре.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Когда сопротивление между центром и стороной соединенной с 5 вольт близка к нулю (а сопротивление на другой стороне близко к 10 кОм), напряжение на центральном контакте приближается к 5 вольт.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Когда сопротивления поменялись местами, напряжение на центральном контакте приближается к 0 вольт или земле.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;Это напряжение есть&amp;nbsp;&lt;/span&gt;аналоговое напряжение&lt;strong style=&quot;font-weight: normal;&quot;&gt;,&lt;/strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;что вы читаете в качестве входных данных.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Arduino имеет интегральную схему внутри, которая называется&amp;nbsp;аналого-цифровым преобразователем&lt;strong style=&quot;font-weight: normal;&quot;&gt;,&lt;/strong&gt;&amp;nbsp;который читает это изменение напряжения и преобразует его в число от 0 до 1023.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Когда вал полностью повернут в одну сторону, 0 вольт идёт на входную ножку, и значение этой входной линии 0&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: normal;&quot;&gt;Когда повернут в обратном направлении, 5 вольт идет на&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; line-height: 18px;&quot;&gt;входной&amp;nbsp;&lt;/span&gt;контакт и входное значение 1023.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;A&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-weight: normal;&quot;&gt;nalogRead&amp;nbsp;() возвращает число от 0 до 1023 пропорциональное количеству напряжения, которое входит на аналоговый вход Arduino.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;Схема&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;circuit&quot; style=&quot;font-weight: normal;&quot;&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/AnalogReadSerial_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;400px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/AnalogReadSerial_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; font-weight: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt;Код&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;font-weight: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; line-height: 23px;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;В программе ниже, единственное, что вы сделаете в функции установки это установка связи, в 9600 бит данных в секунду, между Arduino и компьютером:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;Serial.begin(9600);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;Далее, в основной цикл вашего кода, вы должны установить переменную для хранения значения сопротивления (которая будет от 0 до 1023, идеально подходит для типа данных&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;int)&lt;/code&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: nowrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: x-small;&quot;&gt;&amp;nbsp;от вашего потенциометра:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;; line-height: normal; white-space: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-style: normal; line-height: 23px;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;&lt;i&gt;&lt;/i&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;int sensorValue = analogRead(A0);&lt;/code&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;Наконец, необходимо вывести эту информацию в ваше окно&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;Serial Monitor&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&amp;nbsp;в виде десятичного (&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;DEC&lt;/code&gt;&amp;nbsp;) &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;значения.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&amp;nbsp;Вы можете сделать это с помощью команды&amp;nbsp;Serial.println&amp;nbsp;():&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;Serial.println(sensorValue, DEC)&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;Теперь, когда вы открываете Serial Monitor в среде Arduino развития, вы увидите поток чисел от 0-1023, показывающий положение движка потенциометра.&amp;nbsp;Как только вы измените сопротивление потенциометра, эти цифры будут меняться практически мгновенно.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font-style: normal; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;( ) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;Serial&lt;/span&gt;&amp;nbsp;.&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;9600&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;( ) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;sensorValue&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;analogRead&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;A0&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;Serial&lt;/span&gt;&amp;nbsp;.&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;println&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;sensorValue&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;DEC&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;P.S. &lt;/b&gt;С переводом помогали&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666; font-family: Verdana, Helvetica, Arial, sans-serif; line-height: 12px;&quot;&gt;&lt;a class=&quot;username-coloured&quot; href=&quot;http://roboforum.ru/member5/&quot; style=&quot;color: #dd4400; direction: ltr; display: inline !important; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; text-decoration: none; unicode-bidi: embed;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;=DeaD=&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; line-height: 12px;&quot;&gt;и&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; line-height: 12px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4d4d4d; direction: ltr; font-size: x-small; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; unicode-bidi: embed;&quot;&gt;&lt;a href=&quot;http://roboforum.ru/member12383/&quot; style=&quot;color: #4d4d4d; direction: ltr; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; unicode-bidi: embed;&quot;&gt;dccharacter&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; unicode-bidi: embed;&quot;&gt;с форума&amp;nbsp;&lt;a href=&quot;http://roboforum.ru/&quot;&gt;roboforum.ru&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;em&gt; &lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/2239475161451642063/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/01/analogreadserial.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/2239475161451642063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/2239475161451642063'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/01/analogreadserial.html' title='AnalogReadSerial'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-8915214611982712062</id><published>2011-01-12T18:21:00.001+03:00</published><updated>2011-12-10T19:45:58.667+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basics"/><title type='text'>DigitalReadSerial</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: &#39;tahoma Trebuchet MS&#39;, lucida, helvetica, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif;&quot;&gt;DigitalReadSerial&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Этот пример показывает как вести мониторинг состояния выключателя путем установления&amp;nbsp;последовательной связи&amp;nbsp;между Arduino и компьютером через USB.&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;BOM&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0,1em; margin-bottom: 5px;&quot;&gt;

&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Требования к аппаратному обеспечению&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-image: url(http://arduino.cc/en/pub/skins/arduinoUno/img/bullet.gif); list-style-position: inside; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 10px;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;плата Arduino&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;
&lt;li&gt;тактовая кнопка&lt;/li&gt;
&lt;li&gt;10k резистор&lt;/li&gt;
&lt;li&gt;макетная плата&lt;/li&gt;
&lt;li&gt;соединительные провода&lt;/li&gt;
&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/ul&gt;
&lt;div class=&quot;vspace&quot; style=&quot;margin-bottom: 0px; margin-top: 1,33em;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; line-height: 23px; margin-bottom: 5px;&quot;&gt;

&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Цепь&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;circuit&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px;&quot;&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Подключите три провода к плате Arduino.&amp;nbsp;Первые два, красный и черный, для связи с двумя длинными вертикальными рядами на стороне макета для обеспечения доступа к 5 вольт питания и земле.&amp;nbsp;Третий провод идет от цифрового контакта 2 на одну ногу кнопки.&amp;nbsp;В тот же время нога кнопки подключается через резистор&amp;nbsp;на землю.&amp;nbsp;Другая нога от кнопки подключается к 5 вольт питания.&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Кнопки и переключатели соединяют две точки в цепи при нажатии клавиш.&amp;nbsp;Когда кнопка не нажата нет тока между этими двумя ногами кнопки, так что вывод 2 подключен к земле через резистор и читается, как LOW или 0.&amp;nbsp;При нажатии на кнопку, ток идет между его двумя ногами, &amp;nbsp;так что вывод читается,как HIGH или 1.&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Если вы подключите цифровой вывод по-другому, индикатор начнет беспорядочно мигать.&amp;nbsp;Это потому, что вход неопределенный - то есть не имеет четкого подключение к источнику или на землю и будет случайным образом возвращать либо 1, либо 0.&amp;nbsp;Вот почему необходим резистор в цепи.&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; line-height: 23px; margin-bottom: 5px;&quot;&gt;

&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Схема&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;circuit&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/button_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; line-height: 23px; margin-bottom: 5px;&quot;&gt;

&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Код&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;В программе ниже, самое первое, что вы сделаете в функции установки - это начнете параллельную связь, в 9600 бит данных в секунду, между Arduino и компьютером:&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;Serial.begin(9600);&lt;/code&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Далее, необходимо инициализировать цифровой пин 2, как вход, который будет читать сигнал с вашей кнопки:&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;pinMode(2,INPUT);&lt;/code&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Теперь, когда установка была выполнена, переходим в основной цикл кода.&amp;nbsp;Когда кнопка нажата, 5 вольт будут свободно проходить в цепи, и когда она не нажата, входной контакт будет соединен с землей через 10кОм резистор.&amp;nbsp;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Первое, что нужно сделать в основном цикле программы заключается в создании переменной для хранения информации, поступающей от кнопки.&amp;nbsp;Так как информация, поступающая от переключателя будет либо &quot;1&quot; или &quot;0&quot;, вы можете использовать&amp;nbsp;тип данных&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;int&lt;/code&gt;.&amp;nbsp;Назовем эту переменную&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;sensorValue&amp;nbsp;&lt;/code&gt;начнем туда записывать то, что читается на цифровом пине 2:&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;int sensorValue = digitalRead(2);&lt;/code&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;После того как Arduino прочитал вход, печатаем эту информацию обратно на компьютер в виде десятичного значения (&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;DEC&lt;/code&gt;&amp;nbsp;).&amp;nbsp;Вы можете сделать это с помощью команды&amp;nbsp;Serial.println&amp;nbsp;():&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;Serial.println(sensorValue, DEC);&lt;/code&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;Теперь, когда вы открываете Serial Monitor в среде Arduino, вы увидите поток &quot;0&quot;, если ваша кнопка открыта, или &quot;1&quot;, если ваш переключатель закрыт.&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: 800;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;( ) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;Serial&lt;/span&gt;&amp;nbsp;.&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;9600&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;INPUT&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;( ) {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;int&lt;/span&gt;&amp;nbsp;sensorValue&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalRead&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;Serial&lt;/span&gt;&amp;nbsp;.&amp;nbsp;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;println&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&amp;nbsp;sensorValue&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;DEC&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/b&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/8915214611982712062/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/01/digitalreadserial.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8915214611982712062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/8915214611982712062'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/01/digitalreadserial.html' title='DigitalReadSerial'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-262026341167417463</id><published>2011-01-11T18:14:00.002+03:00</published><updated>2011-09-27T20:03:51.525+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basics"/><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;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: &#39;tahoma Trebuchet MS&#39;, lucida, helvetica, sans-serif; font-size: 13px; font-style: normal; font-weight: normal; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;em&gt;Examples&amp;gt; Basics&lt;/em&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


Blink&lt;/h3&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Этот пример показывает простую вещь, которую вы можете сделать с Arduino, чтобы увидеть физический вывод: он мигает светодиодом.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;BOM&quot; style=&quot;font-size: 14px;&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0,1em; margin-bottom: 5px;&quot;&gt;


Требования к аппаратному обеспечению&lt;/h3&gt;
&lt;ul style=&quot;list-style-image: url(http://arduino.cc/en/pub/skins/arduinoUno/img/bullet.gif); list-style-position: inside; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 10px;&quot;&gt;
&lt;li&gt;плата Arduino&lt;/li&gt;
&lt;li&gt;светодиод&lt;/li&gt;
&lt;li&gt;резистор 220 Ом&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


Цепи&lt;/h3&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Для построения схемы, взять светодиод и подключить его положительную ножку (анод) к контакту 13.&amp;nbsp;Подключить короткую отрицательную ножку (катод) к земле.&amp;nbsp;Затем подключит Arduino к компьютеру, запуститm Arduino IDE и ввести код, который представлен ниже.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
У большинства Arduino уже есть индикатор, который подключен к контакту 13 на саму плату.&amp;nbsp;Если вы запустите этот пример без светодиода, вы увидите, что индикатор мигает.&lt;/div&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


Схема&lt;/h3&gt;
&lt;div class=&quot;circuit&quot;&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Если у вас есть опыт работы с электроникой, вы можете заметить, что индикатор не имеет резистора подключенного с ним.&amp;nbsp;Это потому, что ток выходит из вывода Arduino является достаточно низким, чтоб не повредить светодиод.&amp;nbsp;Это упрощает схемы для начинающих.&amp;nbsp;В общей практике это хорошая идея, чтобы добавить резистор вместе с СИД (светодиод).&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_sch.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;300px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_sch.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; margin-bottom: 5px;&quot;&gt;


Код&lt;/h3&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
В программе ниже, первое, что вы делаете это установка вывода 13, как выходной контакт&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;pinMode(13, OUTPUT);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
В основном цикле вы включаете светодиод:&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;digitalWrite(13, HIGH);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Это подает 5 вольт на контакт 13.&amp;nbsp;Это создает разность потенциалов между контактами светодиода и включает его. Затем&amp;nbsp;вы выключаете его:&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;code style=&quot;white-space: nowrap;&quot;&gt;digitalWrite(13, LOW);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Это подает на вывод 13 0 вольт, и выключает светодиод.&amp;nbsp;В промежутках между включениями и выключениями, нужно достаточно времени для человека, чтобы увидеть изменения, поэтому команда&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;delay()&lt;/code&gt;&amp;nbsp;заставляет Arduino ничего не делать 1000 миллисекунд или одну секунду.&amp;nbsp;При использовании&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;delay()&lt;/code&gt;&amp;nbsp;ничего не происходит за этот промежуток времени.&amp;nbsp;Как только вы поняли основной пример, проверьте пример&amp;nbsp;BlinkWithoutDelay, чтобы узнать, как создавать задержки при выполнении каких-нибудь других вещей параллельно с миганием светодиода.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
Как только вы поняли это попробуйте пример&amp;nbsp;DigitalReadSerial&amp;nbsp;, чтобы научиться читать переключатель подключенный к Arduino.&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;font-size: 14px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot; style=&quot;font-size: 14px; font: normal normal normal 100%/normal Monaco, &#39;Courier New&#39;, Courier, mono; height: auto !important;&quot;&gt;
&lt;div style=&quot;color: rgb(153, 153, 153) !important; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock1&quot;&gt;
&lt;div class=&quot;sourceblocktext&quot; style=&quot;background-color: white;&quot;&gt;
&lt;div class=&quot;arduino&quot; style=&quot;font-family: monospace; font-size: small; height: 241px;&quot;&gt;
&lt;div style=&quot;line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #7e7e7e;&quot;&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;pinMode&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;(13,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;OUTPUT&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalWrite&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;(13,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;HIGH&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc6600; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(1000);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;digitalWrite&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;sy0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;(13,&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw2&quot; style=&quot;color: #006699;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;LOW&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc6600; line-height: 12px;&quot;&gt;delay&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;nu0&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;(1000);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; line-height: 1;&quot;&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/262026341167417463/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/01/blink.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/262026341167417463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/262026341167417463'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/01/blink.html' title='Blink'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4393389959180155903.post-7983082282423722989</id><published>2011-01-10T22:54:00.009+03:00</published><updated>2011-12-10T19:44:13.857+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Basics"/><title type='text'>BareMinimum</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 23px;&quot;&gt;&lt;b&gt;BareMinimum&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Этот пример содержит минимум кода, что нужно для скетча Arduino для компиляции:&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;setup()&lt;/code&gt;&amp;nbsp;метод и&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;loop()&lt;/code&gt;метод.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;BOM&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; letter-spacing: 0,1em; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Требования к аппаратному обеспечению&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-image: url(http://arduino.cc/en/pub/skins/arduinoUno/img/bullet.gif); list-style-position: inside; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 10px;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Плата Arduino&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; line-height: 23px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Цепи&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Для этого примера необходима только ваша плата Arduino.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;a class=&quot;urllink&quot; href=&quot;http://arduino.cc/en/uploads/Tutorial/Arduino_bb.png&quot; rel=&quot;nofollow&quot; style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; color: black; text-decoration: none !important;&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;250px&quot; src=&quot;http://arduino.cc/en/uploads/Tutorial/Arduino_bb.png&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 1em;&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 12px; line-height: 23px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;color: #e34c00; font-family: &#39;Lucida Sans&#39;, Lucida, Verdana, sans-serif; font-size: 14px; font-weight: normal !important; line-height: 23px; margin-bottom: 5px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Код&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;code style=&quot;white-space: nowrap;&quot;&gt;setup()&lt;/code&gt;&amp;nbsp;вызывается в начале скетча.&amp;nbsp;Используйте его для инициализации переменных, библиотек, установки режимов работы цифровых выводов и т.д. Функция настройки будет запускаться один раз, после каждого включения питания или перезагрузки платы Arduino.&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;После создания&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;setup()&lt;/code&gt;&amp;nbsp;функции,&amp;nbsp;&lt;code style=&quot;white-space: nowrap;&quot;&gt;loop()&lt;/code&gt;&amp;nbsp;функция&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;в бесконечном цикле последовательно раз за разом исполняет команды, которые описаны в ее теле.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif;&quot;&gt;Код &lt;code style=&quot;white-space: nowrap;&quot;&gt;loop()&lt;/code&gt;&amp;nbsp;используется для управления платой Arduino.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;Приведенный ниже код не делает ничего, но это структура полезна для копирования и вставки, чтобы вы начали ваш скетч.&amp;nbsp;Он также показывает вам, как сделать комментарии в коде.&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;Любая линия, которая начинается с двух косых черт (/ /) не будет читаться компилятором, так что вы можете написать все, что вы хотите после него.&amp;nbsp;Комментируя код, это может быть особенно полезным для объяснений, как для себя и так и для других, как ваша программа будет работать.&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;vspace&quot; style=&quot;color: #555555; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;code&quot; style=&quot;font: normal normal normal 100%/normal Monaco, &#39;Courier New&#39;, Courier, mono; height: auto !important;&quot;&gt;
&lt;div style=&quot;color: rgb(153, 153, 153) !important; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; line-height: 23px; margin-bottom: 0px; margin-top: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock1&quot;&gt;
&lt;div class=&quot;sourceblocktext&quot; style=&quot;background-color: white;&quot;&gt;
&lt;div class=&quot;arduino&quot; style=&quot;color: black; font-family: monospace; font-size: small; height: 112px; line-height: 1;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: 23px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot; style=&quot;color: rgb(153, 153, 153) !important; display: inline !important; font-family: Georgia, &#39;Times New Roman&#39;, Times, serif; font-size: 14px; font: normal normal normal 100%/normal Monaco, &#39;Courier New&#39;, Courier, mono; height: auto !important;&quot;&gt;
&lt;div class=&quot;sourceblock &quot; id=&quot;sourceblock1&quot; style=&quot;display: inline !important;&quot;&gt;
&lt;div class=&quot;sourceblocktext&quot; style=&quot;background-color: white; color: black; display: inline !important;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: 23px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: x-small; line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;setup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: x-small; font-weight: bold; line-height: 10px;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;span class=&quot;co1&quot; style=&quot;color: #7e7e7e; font-style: italic; font-weight: bold;&quot;&gt;/ / Разместить код установки здесь, чтобы запустить один раз;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;br0&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 12px;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;color: #cc6600;&quot;&gt;void&lt;/span&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;span class=&quot;kw3&quot; style=&quot;color: #cc6600; font-weight: bold;&quot;&gt;loop&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;() {&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;co1&quot; style=&quot;color: #7e7e7e; font-style: italic; font-weight: bold;&quot;&gt;/ / Разместить основной код здесь, чтобы запустить несколько раз; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;color: black; font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://witharduino.blogspot.com/feeds/7983082282423722989/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://witharduino.blogspot.com/2011/01/bareminimum-arduino.html#comment-form' title='Комментарии: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/7983082282423722989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4393389959180155903/posts/default/7983082282423722989'/><link rel='alternate' type='text/html' href='http://witharduino.blogspot.com/2011/01/bareminimum-arduino.html' title='BareMinimum'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>