﻿{"id":498,"date":"2018-11-19T21:49:38","date_gmt":"2018-11-19T18:49:38","guid":{"rendered":"http:\/\/allchina.a-lisa.org\/?p=498"},"modified":"2019-04-06T11:21:08","modified_gmt":"2019-04-06T08:21:08","slug":"%d0%b1%d0%b8%d0%b1%d0%bb%d0%b8%d0%be%d1%82%d0%b5%d0%ba%d0%b0-%d1%83%d1%81%d0%ba%d0%be%d1%80%d1%8f%d1%8e%d1%89%d0%b0%d1%8f-arduino","status":"publish","type":"post","link":"https:\/\/allchina.a-lisa.org\/?p=498","title":{"rendered":"\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino"},"content":{"rendered":"<h1>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino<\/h1>\n<p><a title=\"\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino\" href=\"http:\/\/www.pvsm.ru\/diy-ili-sdelaj-sam\/73593\"><img decoding=\"async\" title=\"\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino\" src=\"http:\/\/www.pvsm.ru\/img\/postlink.png\" alt=\"\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino\" \/><\/a> <small><strong><a title=\"\u0417\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 2014-11-05\" href=\"http:\/\/www.pvsm.ru\/date\/2014\/11\/05\">2014-11-05<\/a> \u0432 7:31<\/strong>, \u0440\u0443\u0431\u0440\u0438\u043a\u0438: <a href=\"http:\/\/www.pvsm.ru\/cat\/diy-ili-sdelaj-sam\">diy \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0439 \u0441\u0430\u043c<\/a>, <a href=\"http:\/\/www.pvsm.ru\/cat\/sdelaj-sam\">\u0441\u0434\u0435\u043b\u0430\u0439 \u0441\u0430\u043c<\/a>, <a href=\"http:\/\/www.pvsm.ru\/cat\/soft\">\u0421\u043e\u0444\u0442<\/a><\/small><\/p>\n<p>\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0441 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u00abCyberLib\u00bb, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u0440\u0434\u0443\u0438\u043d\u043e.<br \/>\n\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Arduino Nano, Arduino Mega \u0438 Arduino Leonardo.<\/p>\n<p><!--more--><\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0443 \u0441\u0440\u0430\u0437\u0443 \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e.<\/p>\n<h4><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447 Blink \u0431\u0435\u0437 delay():<\/p>\n<pre><code>void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); digitalWrite(13, LOW); } <\/code><\/pre>\n<p>\u0417\u0430\u043d\u0438\u043c\u0430\u0435\u0442 874 \u0431\u0430\u0439\u0442\u0430 \u0438 \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0430 \u043f\u0438\u043d 13 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 120 \u043a\u0413\u0446.<\/p>\n<p>\u0421 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u00abCyberLib\u00bb<\/p>\n<pre><code>#include \"CyberLib.h\" void setup() { D13_Out; } void loop() { D13_High; D13_Low; } <\/code><\/pre>\n<p>\u0417\u0430\u043d\u0438\u043c\u0430\u0435\u0442 566 \u0431\u0430\u0439\u0442 \u0438 \u0432\u044b\u0434\u0430\u0451\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 2650 \u043a\u0413\u0446.<br \/>\n\u0420\u0430\u0437\u043e\u0433\u043d\u0430\u043b\u0430\u0441\u044c \u0432 22 \u0440\u0430\u0437\u0430.<\/p>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430\u043c\u0438:<br \/>\n<strong>Dx_Out;<\/strong> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430 \u0425 \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434<br \/>\n<strong>Dx_In;<\/strong> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430 \u0425 \u043a\u0430\u043a \u0432\u0445\u043e\u0434<br \/>\n<strong>Dx_Hihg;<\/strong> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u0430 \u043d\u0430 \u043f\u0438\u043d\u0435 \u0425<br \/>\n<strong>Dx_Low;<\/strong> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043f\u0438\u043d\u0435 \u0425<br \/>\n<strong>Dx_Read;<\/strong> \u2014 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 \u0425<br \/>\n<strong>Dx_Inv;<\/strong> \u2014 \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0438\u043d\u0435 \u0425<\/p>\n<h4><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447:<\/p>\n<pre><code>unsigned long timme; void setup() { Serial.begin(57600); } void loop() { timme = micros(); float i = analogRead(0); timme = micros()-timme; Serial.println(timme); delay(1000); } <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u044f 112 \u043c\u043a\u0441.<\/p>\n<p>\u0421 \u00abCyberLib\u00bb<\/p>\n<pre><code>#include &lt;CyberLib.h&gt; unsigned long timme; void setup() { Serial.begin(57600); } void loop() { timme = micros(); float i = A0_Read; timme = micros()-timme; Serial.println(timme); delay(1000); } <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u044f 68 \u043c\u043a\u0441. \u0412 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0438\u043d\u0430\u043c\u0438:<br \/>\n<strong>Ax_Read;<\/strong> \u2014 \u0447\u0442\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043f\u0438\u043d\u0430 \u0425<\/p>\n<h4><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c Serial<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447:<\/p>\n<pre><code>byte b=255; void setup() { Serial.begin(57600); } void loop() { Serial.write(b); } <\/code><\/pre>\n<p>\u0421\u043a\u0435\u0442\u0447 \u0437\u0430\u043d\u044f\u043b 1650 \u0431\u0430\u0439\u0442.<\/p>\n<p>\u0421 \u00abCyberLib\u00bb<\/p>\n<pre><code>#include &lt;CyberLib.h&gt; byte b=255; void setup() { UART_Init(57600); } void loop() { if(UART_ReadByte(b)) { UART_SendByte(b); } } <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 800 \u0431\u0430\u0439\u0442. \u0412 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p><strong>UART_Init(57600);<\/strong> \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<br \/>\n<strong>UART_ReadByte(b);<\/strong> \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<br \/>\n<strong>UART_SendByte(b);<\/strong> \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442.<br \/>\n<em>\u0411\u0443\u0444\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0439 \u0441 Serial \u043f\u043e\u0440\u0442\u0430.<\/em><\/p>\n<h4><strong>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 Serial<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code>#include &lt;CyberLib.h&gt; uint8_t message[] = \"geek\"; void setup() { UART_Init(115200); } void loop() { UART_SendArray( message, 4); } <\/code><\/pre>\n<p><strong>UART_SendArray(array, size array);<\/strong> \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u043e\u0440\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0438\u043f\u0430 \u0431\u0430\u0439\u0442. \u0413\u0434\u0435 <strong>array<\/strong>-\u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 <strong>size array<\/strong>-\u0447\u0438\u0441\u043b\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0431\u0430\u0439\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<br \/>\n\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 65535 \u0431\u0430\u0439\u0442.<\/p>\n<h4><strong>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c delayMicroseconds() \u0438 delay()<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <strong>delay_us();<\/strong> \u0438 <strong>delay_ms();<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u0445 \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u0430\u0439\u043c\u0435\u0440. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0430\u044f.<br \/>\n<strong>delay_us(n);<\/strong> n \u2014 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u043c\u043a\u0441, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 16000 \u043c\u043a\u0441.<br \/>\n<strong>delay_ms(n);<\/strong> n \u2014 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u043c\u0441, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 65000 \u043c\u0441.<\/p>\n<h4><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Timer1<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code>#include &lt;CyberLib.h&gt; void setup() { D13_Out; StartTimer1(obrobotchik, 1000000); } void obrobotchik() { D13_High; delay_ms(100); } void loop() { D13_Low; } <\/code><\/pre>\n<p><strong>StartTimer1(obrobotchik, 1000);<\/strong> \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 6 \u0434\u043e 4000000 \u043c\u043a\u0441., \u0448\u0430\u0433 1 \u043c\u043a\u0441.<br \/>\n<strong>StopTimer1();<\/strong> \u2014 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440.<br \/>\n<strong>ResumeTimer1();<\/strong> \u2014 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u0441\u0447\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438.<br \/>\n<strong>RestartTimer1();<\/strong> \u2014 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u0441\u0447\u0435\u0442 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<h4><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SPI<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code>#include &lt;CyberLib.h&gt; void setup() { StartSPI(0, 8, 1); \/\/ MODE0, DIV8, MSBFIRST \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f SPI } void loop() { SendSPI(170); \/\/\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0432 \u0448\u0438\u043d\u0443 SPI } <\/code><\/pre>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0430\u044f \u0441\u043f\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c 1.85 \u0440\u0430\u0437\u0430.<br \/>\n<strong>StartSPI(0, 2, 1);<\/strong> \u2014 \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e \u0440\u0435\u0436\u0438\u043c mode \u043e\u0442 0 \u0434\u043e 3.<br \/>\n\u0412\u0442\u043e\u0440\u043e\u0439 \u2014 \u044d\u0442\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 2, 4, 8, 16, 32, 64, 128. \u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b SPI \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0442\u043e\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 16000000 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430.<br \/>\n\u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439 \u0431\u0438\u0442 \u043f\u043e\u0439\u0434\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u0415\u0441\u043b\u0438 1 \u0442\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u043e\u0439\u0434\u0435\u0442 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0435\u0441\u043b\u0438 0 \u0442\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u043e\u0439\u0434\u0435\u0442 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442.<br \/>\n\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u0439\u0442: <strong>SendSPI(b);<\/strong><br \/>\n\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u0439\u0442: <strong>MyData=ReadSPI();<\/strong><br \/>\n\u0412\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c SPI: <strong>StopSPI();<\/strong><\/p>\n<h4><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 EEPROM<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p><strong>WriteEEPROM_Long(0, 4000000);<\/strong> \u2014 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c 4000000 \u0432 EEPROM \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0 \u0442\u0438\u043f Long.<br \/>\nuint32_t tmp=<strong>ReadEEPROM_Long(0);<\/strong> \u2014 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 EEPROM \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 Long.<\/p>\n<p><strong>WriteEEPROM_Word(0, 4000);<\/strong> \u2014 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c 4000 \u0432 EEPROM \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0 \u0442\u0438\u043f Word.<br \/>\nuint16_t tmp=<strong>ReadEEPROM_Word(0);<\/strong> \u2014 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 EEPROM \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 Word.<br \/>\n<strong>WriteEEPROM_Byte(0, 40);<\/strong> \u2014 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c 40 \u0432 EEPROM \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 0 \u0442\u0438\u043f Byte.<br \/>\nuint8_t tmp=<strong>ReadEEPROM_Byte(0);<\/strong> \u2014 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 EEPROM \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 Byte.<\/p>\n<p>\u0410\u0434\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 256 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0434\u043b\u044f \u0442\u0438\u043f\u0430 Byte<br \/>\n\u0414\u043b\u044f Word \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 128<br \/>\n\u0414\u043b\u044f Long \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 64<\/p>\n<h4><strong>\u0421\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p><strong>reset();<\/strong> \u2014 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0441\u0431\u0440\u043e\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<br \/>\n\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u0440\u0435\u0431\u0443\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p><strong>wdt_reset();<\/strong> \u2014 \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440.<br \/>\n<strong>wdt_disable();<\/strong> \u2014 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440.<br \/>\n<strong>wdt_enable(timeout);<\/strong> \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430.<br \/>\n\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f timeout<br \/>\nWDTO_15MS<br \/>\nWDTO_30MS<br \/>\nWDTO_60MS<br \/>\nWDTO_120MS<br \/>\nWDTO_250MS<br \/>\nWDTO_500MS<br \/>\nWDTO_1S<br \/>\nWDTO_2S<br \/>\nWDTO_4S<br \/>\nWDTO_8S<\/p>\n<p><em>\u0411\u0443\u0434\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b, \u043d\u0435 \u0432\u0441\u0435 \u0430\u0440\u0434\u0443\u0438\u043d\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u043c \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u043c (\u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a), \u043c\u043e\u0436\u043d\u043e \u043e\u043a\u0438\u0440\u043f\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/em><\/p>\n<h4><strong>\u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code>#include &lt;CyberLib.h&gt; void setup() { \/\/ \u0447\u0442\u043e-\u0442\u043e } void loop() { Start \/\/ \u0447\u0442\u043e-\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f End } <\/code><\/pre>\n<p><strong>Start<\/strong> \u2014 \u041d\u0430\u0447\u0430\u043b\u043e \u0446\u0438\u043a\u043b\u0430<br \/>\n<strong>End<\/strong> \u2014 \u041a\u043e\u043d\u0435\u0446 \u0446\u0438\u043a\u043b\u0430<br \/>\n\u0426\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 Start-End.<\/p>\n<h4><strong>\u0424\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0448\u0443\u043c\u0430 \u0438\u043b\u0438 \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439<\/strong><\/h4>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code>#include &lt;CyberLib.h&gt; uint16_t sensor[]={10, 15, 55, 999, 10, 8, 9, 11, 700, 455, 123, 999, 543, 567, 65535, 43555, 999, 10, 43, 99, 66, 987, 999, 100}; void setup() { Serial.begin(115200); uint16_t cm = find_similar(sensor, sizeof(sensor)\/2, 0); Serial.println(cm, DEC); } void loop() {} <\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 999, \u043d\u043e \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 0 \u043d\u0430 1, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 10, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 9 \u0438 11 \u043a\u0430\u043a 10<\/p>\n<p><strong>find_similar(Array, sizeArray, range);<\/strong><br \/>\n<strong>Array<\/strong> \u2014 \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043c\u0430\u0441\u0441\u0438\u0432 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0438\u043f uint16_t \u0438\u043b\u0438 uint8_t.<br \/>\n<strong>sizeArray<\/strong> \u2014 \u0434\u043b\u0438\u043d\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 256 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>\n<strong>range<\/strong> \u2014 \u043f\u0440\u0435\u0434\u0435\u043b \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438(\u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435) \u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043b\u0435\u0431\u0430\u0442\u044c\u0441\u044f \u043e\u0442 0 \u0434\u043e 127, \u043f\u0440\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 0 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043f\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<br \/>\n\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0423\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0434\u0430\u043b\u044c\u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 5 \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0435 \u043c\u043d\u043e\u0439, \u044f \u043b\u0438\u0448\u044c \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u0435\u0451 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0430.<br \/>\n<a href=\"http:\/\/cyber-place.ru\/showthread.php?t=550\">\u0417\u0434\u0435\u0441\u044c<\/a> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u0430\u0432\u0442\u043e\u0440 \u043b\u0438\u0431\u044b Admin.<br \/>\n\u0410 <a href=\"http:\/\/cyber-place.ru\/attachment.php?attachmentid=1769&amp;d=1402999525\">\u0442\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0430\u0431\u0436.<br \/>\n<a href=\"http:\/\/www.pvsm.ru\/diy-ili-sdelaj-sam\/73593\">http:\/\/www.pvsm.ru\/diy-ili-sdelaj-sam\/73593<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0430\u044f Arduino 2014-11-05 \u0432 7:31, \u0440\u0443\u0431\u0440\u0438\u043a\u0438: diy \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0439 \u0441\u0430\u043c, \u0441\u0434\u0435\u043b\u0430\u0439 \u0441\u0430\u043c, \u0421\u043e\u0444\u0442 \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0441 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u00abCyberLib\u00bb,<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[98],"tags":[],"class_list":["post-498","post","type-post","status-publish","format-standard","hentry","category-arduino"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7OYvE-82","_links":{"self":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=498"}],"version-history":[{"count":1,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/498\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/498\/revisions\/524"}],"wp:attachment":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}