{"id":375633,"date":"2024-05-21T06:29:24","date_gmt":"2024-05-21T06:29:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=375633"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T06:29:24","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=375633","title":{"rendered":"<span>\u0423\u0447\u0435\u0431\u043d\u043e-\u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u00ab\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u00bb. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0436\u0435\u0441\u0442\u0430\u043c\u0438 \u0440\u0443\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u042f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0438 \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0447\u0435\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438, \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e, \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c\u044b\u043c\u0438! \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043c\u043e\u0438\u043c \u0443\u0447\u0435\u043d\u0438\u043a\u0430\u043c, \u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c!<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6639f572315cc3d4a10e6a8e\" data-style=\"\" id=\"6639f572315cc3d4a10e6a8e\" width=\"\"><\/div>\n<h2>\u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/9b3\/984\/e1a\/9b3984e1a5540716ce404220be5dd6d0.jpg\" alt=\"\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f\" title=\"\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f\" width=\"4032\" height=\"2268\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b3\/984\/e1a\/9b3984e1a5540716ce404220be5dd6d0.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f &#8212; 4 \u043a\u043e\u043b\u0435\u0441\u0430, \u0438 \u043f\u0435\u0440\u0444\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u043d\u0442\u0430\u0436\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/52a\/03c\/830\/52a03c830588ad04bea61af71803b6bb.png\" width=\"1280\" height=\"960\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/52a\/03c\/830\/52a03c830588ad04bea61af71803b6bb.png\"\/><\/figure>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f Li-On \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b 18650. \u0410 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0437\u0430\u0440\u044f\u0434\u0430 \u043d\u0435 \u0441\u043d\u0438\u043c\u0430\u044f \u0441 \u0440\u043e\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u0440\u044f\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u044c \u0437\u0430\u0440\u044f\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a  Type-C \u0438 \u0441 5\u0412 \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0434\u043e 8.4\u0412, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u0440\u044f\u0434\u0430 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0410\u041a\u0411 18650. <br \/>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u0432 \u043f\u043e\u0441\u0442\u0435 \u0432 \u043c\u043e\u0435\u043c <a href=\"https:\/\/t.me\/burmistrov_robotics\/278\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442c\u044f Arduino Nano \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u0435\u043c NRF24L01. <br \/>\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">#include &lt;SPI.h> #include &lt;nRF24L01.h> #include &lt;RF24.h> const uint64_t pipe = 0xF0F0F0F0F0LL;  RF24 radio(9, 10); \/\/ CE, CSN byte data[1]; uint32_t radioTimer=0;  int speed = 128; void setup() {    Serial.begin(9600);   Serial.println(!radio.begin());      delay(2);   radio.setChannel(100); \/\/ \u043a\u0430\u043d\u0430\u043b (0-127)   radio.setDataRate(RF24_1MBPS);   radio.setPALevel(RF24_PA_HIGH);   radio.openReadingPipe(1, pipe);   radio.startListening();    pinMode(2,OUTPUT);   pinMode(3,OUTPUT);   pinMode(4,OUTPUT);   pinMode(5,OUTPUT); }  void forward() {   digitalWrite(2,0);   analogWrite(3,speed);   digitalWrite(4,0);   analogWrite(5,speed); }  void backward() {   digitalWrite(2,1);   analogWrite(3,255-speed);   digitalWrite(4,1);   analogWrite(5,255-speed); }  void left() {   digitalWrite(2,0);   analogWrite(3,0);   digitalWrite(4,0);   analogWrite(5,speed); }  void right() {   digitalWrite(2,0);   analogWrite(3,speed);   digitalWrite(4,0);   analogWrite(5,0); }  void STOP(){   digitalWrite(2,0);   analogWrite(3,0);   digitalWrite(4,0);   analogWrite(5,0);  }  void loop() {   if (radio.available()) {      radioTimer = millis();     radio.read(data,1);      byte p1 = (data[0] >> 0) &amp; 1;     byte p2 = (data[0] >> 1) &amp; 1;     byte p3 = (data[0] >> 2) &amp; 1;     byte p4 = (data[0] >> 3) &amp; 1;      if (p1 &amp;&amp; p2 &amp;&amp; p3 &amp;&amp; p4) forward();     else if (p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; p4) backward();     else if (p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; !p4) left();     else if (!p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; p4) right();     else if (!p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; !p4) STOP();    }   if (millis()-radioTimer>500) STOP(); } <\/code><\/pre>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SPI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0438 nRF24L01.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c RF24.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0442\u0440\u0443\u0431\u044b \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438\u043e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong><code>setup()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Serial \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043a\u0430\u043d\u0430\u043b \u0441\u0432\u044f\u0437\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435\u043c<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>forward()<\/code>, <code>backward()<\/code>, <code>left()<\/code>, <code>right()<\/code>, <code>STOP()<\/code>: \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432 <\/strong><code>loop()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0440\u0430\u0434\u0438\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0430\u0439\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430, \u0437\u0430\u043f\u0438\u0441\u044c \u0432 4 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 500 \u043c\u0441 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/790\/b8c\/e50\/790b8ce505a199bdf8d9f464ef63771f.jpg\" alt=\"Arduino UNO + NRF24L01\" title=\"Arduino UNO + NRF24L01\" width=\"4032\" height=\"2268\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/790\/b8c\/e50\/790b8ce505a199bdf8d9f464ef63771f.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>Arduino UNO + NRF24L01<\/figcaption><\/div>\n<\/figure>\n<p>\u041b\u044e\u0431\u0430\u044f Arduino + \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044c NRF24L01. <br \/>\u0417\u0430\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443. <br \/>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">#include &lt;SPI.h> #include &lt;nRF24L01.h> #include &lt;RF24.h> const uint64_t pipe = 0xF0F0F0F0F0LL; long timer; RF24 radio(9, 10); \/\/ CE, CSN byte send[1] = {0};  void setup() {   Serial.begin(9600);   Serial.println(radio.begin());   delay(2);   radio.setChannel(100);   radio.setDataRate(RF24_1MBPS);   radio.setPALevel(RF24_PA_HIGH);   radio.setAutoAck(1);   radio.stopListening();   radio.openWritingPipe(pipe); }  void loop() {   if (Serial.available() > 0) {     send[0] = Serial.read();     radio.write(send, 1);   } }<\/code><\/pre>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SPI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0438 nRF24L01.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c RF24.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0438 \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. (\u0412\u0410\u0416\u041d\u041e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0435 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong><code>setup()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Serial \u043f\u043e\u0440\u0442\u0430 <\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043a\u0430\u043d\u0430\u043b \u0441\u0432\u044f\u0437\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432 <\/strong><code>loop()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 Serial.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0434\u0438\u043e\u043a\u0430\u043d\u0430\u043b \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0436\u0435\u0441\u0442\u043e\u0432 \u0440\u0443\u043a\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 mediapipe (\u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u0435\u043a) \u0438 OpenCV \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u043d\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 pip (\u0438\u043b\u0438 pip3 \u0434\u043b\u044f linux): <\/p>\n<pre><code class=\"bash\">pip install mediapipe pip install opencv-python<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0440\u0443\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np  mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1)  cap = cv2.VideoCapture(0)  while True:     ret, frame = cap.read()     if not ret:         continue      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     results = hands.process(frame)     frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)      if results.multi_hand_landmarks:         for hand_landmarks in results.multi_hand_landmarks:             mp_drawing.draw_landmarks(frame, hand_landmarks, mp_hands.HAND_CONNECTIONS)      cv2.imshow('Fingers', frame)          if cv2.waitKey(10) == 27:         break  cap.release() cv2.destroyAllWindows() <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0438\u0442\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 MediaPipe. \u0412\u0430\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>static_image_mode=False &#8212; \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0440\u0443\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>max_num_hands=1 &#8212; \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u0430\u0434\u0440\u0435 \u0440\u0443\u043a. <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1)<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e7c\/a6f\/f7a\/e7ca6ff7aa4e0099a71d6df7b21d4717.png\" width=\"803\" height=\"521\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7c\/a6f\/f7a\/e7ca6ff7aa4e0099a71d6df7b21d4717.png\"\/><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043d\u0430 \u0440\u0443\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a85\/dfb\/f4a\/a85dfbf4ab27b2f8c05bbe496a08b665.png\" width=\"752\" height=\"516\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a85\/dfb\/f4a\/a85dfbf4ab27b2f8c05bbe496a08b665.png\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430, \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0442\u043e \u043f\u0430\u043b\u0435\u0446 \u0437\u0430\u0433\u043d\u0443\u0442.<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np  mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False,                        max_num_hands=1)  cap = cv2.VideoCapture(0)  tip_ids = [4, 8, 12, 16, 20] base_ids = [0, 5, 9, 13, 17] extension_threshold = 0.17  def get_vector(p1, p2):     return np.array([p2.x - p1.x, p2.y - p1.y, p2.z - p1.z])  def is_finger_extended(base, tip, is_thumb=False):     base_to_tip = get_vector(base, tip)     base_to_tip_norm = np.linalg.norm(base_to_tip)     return base_to_tip_norm > extension_threshold      while True:     ret, frame = cap.read()     if not ret:         continue      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     results = hands.process(frame)     frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)     if results.multi_hand_landmarks:         for hand_landmarks in results.multi_hand_landmarks:             mp_drawing.draw_landmarks(frame,                                       hand_landmarks,                                       mp_hands.HAND_CONNECTIONS)         if hand_landmarks:             landmarks = hand_landmarks.landmark             for id, landmark in enumerate(hand_landmarks.landmark):                 h, w, c = frame.shape                 cx, cy = int(landmark.x * w), int(landmark.y * h)                 cv2.putText(frame,                             str(id),                             (cx, cy),                             cv2.FONT_HERSHEY_SIMPLEX,                             0.5,                             (0, 255, 255),                             1)                              for finger_index, tip_id in enumerate(tip_ids):                 base_id = base_ids[finger_index]                   if is_finger_extended(landmarks[base_id], landmarks[tip_id]):                     cx, cy = int(landmarks[tip_id].x * frame.shape[1]), int(landmarks[tip_id].y * frame.shape[0])                     cv2.circle(frame, (cx, cy), 10, (0, 255, 0), cv2.FILLED)       cv2.imshow('Fingers', frame)      if cv2.waitKey(10) == 27:         break  cap.release() cv2.destroyAllWindows()      <\/code><\/pre>\n<p>\u0418\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c) \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u0443 \u043c\u044b\u0441\u043b\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4f5\/c3d\/ef1\/4f5c3def199bbbcf7eff63f11640df65.png\" width=\"696\" height=\"449\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f5\/c3d\/ef1\/4f5c3def199bbbcf7eff63f11640df65.png\"\/><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 4 \u043f\u0430\u043b\u044c\u0446\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u0436\u0430\u0442\u0430\u044f \u0440\u0443\u043a\u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0440\u043e\u0431\u043e\u0442\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b70\/2a1\/e07\/b702a1e07291980694cebb75b0cdff1d.png\" alt=\"\u0412\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434-\u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e-\u0441\u0442\u043e\u043f\" title=\"\u0412\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434-\u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e-\u0441\u0442\u043e\u043f\" width=\"4070\" height=\"854\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b70\/2a1\/e07\/b702a1e07291980694cebb75b0cdff1d.png\"\/><\/p>\n<div><figcaption>\u0412\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434-\u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e-\u0441\u0442\u043e\u043f<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u0432 \u0431\u0438\u0442\u044b, \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 Arduino.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Python<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np import serial import serial.tools.list_ports import time   ser = serial.Serial(\"COM11\", 9600, timeout=1) if ser is None:     exit()  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c time.sleep(2) #\u0416\u0434\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u043e\u0440\u0442\u0430  # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432 handStates = 0   mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1, min_detection_confidence=0.7) tip_ids = [4, 8, 12, 16, 20]  # \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043a\u043e\u043d\u0447\u0438\u043a\u043e\u0432 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 base_ids = [0, 5, 9, 13, 17]  # \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0431\u0430\u0437 \u043f\u0430\u043b\u044c\u0446\u0435\u0432  cap = cv2.VideoCapture(0)  extension_threshold = 0.17  # \u041e\u0431\u0449\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 thumb_extension_threshold = 0.1  # \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u043e\u0433 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430  def get_vector(p1, p2):     \"\"\" \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 p1 \u043a \u0442\u043e\u0447\u043a\u0435 p2 \"\"\"     return np.array([p2.x - p1.x, p2.y - p1.y, p2.z - p1.z])  def is_finger_extended(base, tip, is_thumb=False):     \"\"\" \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0440\u0430\u0437\u043e\u0433\u043d\u0443\u0442 \u043b\u0438 \u043f\u0430\u043b\u0435\u0446, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0435\u0433\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \"\"\"     base_to_tip = get_vector(base, tip)     # \u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430     base_to_tip_norm = np.linalg.norm(base_to_tip)     # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0440\u0430\u0437\u0433\u0438\u0431\u0430\u043d\u0438\u0435, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0430\u043b\u044c\u0446\u0435\u043c     if is_thumb:         return base_to_tip_norm > thumb_extension_threshold     else:         return base_to_tip_norm > extension_threshold  def count_fingers(hand_landmarks):     finger_count = 0     extended_fingers = []     finger_states = [0, 0, 0, 0, 0]  # \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0435\u0432: 0 - \u0441\u0436\u0430\u0442, 1 - \u0440\u0430\u0437\u043e\u0433\u043d\u0443\u0442          if hand_landmarks:         landmarks = hand_landmarks.landmark         # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0435\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0438 ##        if is_finger_extended(landmarks[base_ids[0]], landmarks[tip_ids[0]], is_thumb=True): ##            finger_count += 1 ##            extended_fingers.append(tip_ids[0]) ##            finger_states[0] = 1                  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432         for i in range(1, 5):             if is_finger_extended(landmarks[base_ids[i]], landmarks[tip_ids[i]]):                 finger_count += 1                 extended_fingers.append(tip_ids[i])                 finger_states[i] = 1          return finger_count, extended_fingers, finger_states  while True:     ret, frame = cap.read()     if not ret:         continue      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     results = hands.process(frame)     frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)      if results.multi_hand_landmarks:         for hand_landmarks in results.multi_hand_landmarks:             mp_drawing.draw_landmarks(frame, hand_landmarks, mp_hands.HAND_CONNECTIONS)             fingers_counted, extended_fingers, finger_states = count_fingers(hand_landmarks)                          # \u041f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430 \u043a\u043e\u043d\u0447\u0438\u043a\u043e\u0432 \u0440\u0430\u0437\u043e\u0433\u043d\u0443\u0442\u044b\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432             for tip_index in extended_fingers:                 tip_landmark = hand_landmarks.landmark[tip_index]                 x, y = int(tip_landmark.x * frame.shape[1]), int(tip_landmark.y * frame.shape[0])                 cv2.circle(frame, (x, y), 10, (0, 255, 0), cv2.FILLED)                          # \u0412\u044b\u0432\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430             finger_state_text = ' '.join(['1' if state else '0' for state in finger_states])             cv2.putText(frame, f'Fingers: {finger_state_text}', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2, cv2.LINE_AA)              # \u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u0432 Arduino             handStates = 0             for i in range(len(finger_states[1:])):                 handStates ^= (finger_states[i+1] &lt;&lt; i)             ser.write(bytearray([handStates]))      cv2.imshow('Fingers Count', frame)          if cv2.waitKey(10) &amp; 0xFF == 27:         break  cap.release() cv2.destroyAllWindows() <\/code><\/pre>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441! \u0423\u0434\u0430\u0447\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/812863\/\"> https:\/\/habr.com\/ru\/articles\/812863\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u042f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0438 \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0447\u0435\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438, \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e, \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c\u044b\u043c\u0438! \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043c\u043e\u0438\u043c \u0443\u0447\u0435\u043d\u0438\u043a\u0430\u043c, \u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c!<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6639f572315cc3d4a10e6a8e\" data-style=\"\" id=\"6639f572315cc3d4a10e6a8e\" width=\"\"><\/div>\n<h2>\u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/h2>\n<figure class=\"full-width\">\n<div><figcaption>\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f &#8212; 4 \u043a\u043e\u043b\u0435\u0441\u0430, \u0438 \u043f\u0435\u0440\u0444\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u043d\u0442\u0430\u0436\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f Li-On \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b 18650. \u0410 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0437\u0430\u0440\u044f\u0434\u0430 \u043d\u0435 \u0441\u043d\u0438\u043c\u0430\u044f \u0441 \u0440\u043e\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u0440\u044f\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u044c \u0437\u0430\u0440\u044f\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a  Type-C \u0438 \u0441 5\u0412 \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0434\u043e 8.4\u0412, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u0440\u044f\u0434\u0430 \u0434\u0432\u0443\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0410\u041a\u0411 18650. <br \/>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u0432 \u043f\u043e\u0441\u0442\u0435 \u0432 \u043c\u043e\u0435\u043c <a href=\"https:\/\/t.me\/burmistrov_robotics\/278\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442c\u044f Arduino Nano \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u0435\u043c NRF24L01. <br \/>\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">#include &lt;SPI.h> #include &lt;nRF24L01.h> #include &lt;RF24.h> const uint64_t pipe = 0xF0F0F0F0F0LL;  RF24 radio(9, 10); \/\/ CE, CSN byte data[1]; uint32_t radioTimer=0;  int speed = 128; void setup() {    Serial.begin(9600);   Serial.println(!radio.begin());      delay(2);   radio.setChannel(100); \/\/ \u043a\u0430\u043d\u0430\u043b (0-127)   radio.setDataRate(RF24_1MBPS);   radio.setPALevel(RF24_PA_HIGH);   radio.openReadingPipe(1, pipe);   radio.startListening();    pinMode(2,OUTPUT);   pinMode(3,OUTPUT);   pinMode(4,OUTPUT);   pinMode(5,OUTPUT); }  void forward() {   digitalWrite(2,0);   analogWrite(3,speed);   digitalWrite(4,0);   analogWrite(5,speed); }  void backward() {   digitalWrite(2,1);   analogWrite(3,255-speed);   digitalWrite(4,1);   analogWrite(5,255-speed); }  void left() {   digitalWrite(2,0);   analogWrite(3,0);   digitalWrite(4,0);   analogWrite(5,speed); }  void right() {   digitalWrite(2,0);   analogWrite(3,speed);   digitalWrite(4,0);   analogWrite(5,0); }  void STOP(){   digitalWrite(2,0);   analogWrite(3,0);   digitalWrite(4,0);   analogWrite(5,0);  }  void loop() {   if (radio.available()) {      radioTimer = millis();     radio.read(data,1);      byte p1 = (data[0] >> 0) &amp; 1;     byte p2 = (data[0] >> 1) &amp; 1;     byte p3 = (data[0] >> 2) &amp; 1;     byte p4 = (data[0] >> 3) &amp; 1;      if (p1 &amp;&amp; p2 &amp;&amp; p3 &amp;&amp; p4) forward();     else if (p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; p4) backward();     else if (p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; !p4) left();     else if (!p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; p4) right();     else if (!p1 &amp;&amp; !p2 &amp;&amp; !p3 &amp;&amp; !p4) STOP();    }   if (millis()-radioTimer>500) STOP(); } <\/code><\/pre>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SPI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0438 nRF24L01.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c RF24.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0442\u0440\u0443\u0431\u044b \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438\u043e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong><code>setup()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Serial \u043f\u043e\u0440\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043a\u0430\u043d\u0430\u043b \u0441\u0432\u044f\u0437\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435\u043c<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>forward()<\/code>, <code>backward()<\/code>, <code>left()<\/code>, <code>right()<\/code>, <code>STOP()<\/code>: \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432 <\/strong><code>loop()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0440\u0430\u0434\u0438\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0430\u0439\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430, \u0437\u0430\u043f\u0438\u0441\u044c \u0432 4 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 500 \u043c\u0441 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043d\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a<\/h2>\n<figure class=\"full-width\">\n<div><figcaption>Arduino UNO + NRF24L01<\/figcaption><\/div>\n<\/figure>\n<p>\u041b\u044e\u0431\u0430\u044f Arduino + \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044c NRF24L01. <br \/>\u0417\u0430\u0434\u0430\u0447\u0430 \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430: \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443. <br \/>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">#include &lt;SPI.h> #include &lt;nRF24L01.h> #include &lt;RF24.h> const uint64_t pipe = 0xF0F0F0F0F0LL; long timer; RF24 radio(9, 10); \/\/ CE, CSN byte send[1] = {0};  void setup() {   Serial.begin(9600);   Serial.println(radio.begin());   delay(2);   radio.setChannel(100);   radio.setDataRate(RF24_1MBPS);   radio.setPALevel(RF24_PA_HIGH);   radio.setAutoAck(1);   radio.stopListening();   radio.openWritingPipe(pipe); }  void loop() {   if (Serial.available() > 0) {     send[0] = Serial.read();     radio.write(send, 1);   } }<\/code><\/pre>\n<ol>\n<li>\n<p><strong>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SPI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0438 nRF24L01.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c RF24.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u0438 \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. (\u0412\u0410\u0416\u041d\u041e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0435 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0435)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong><code>setup()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Serial \u043f\u043e\u0440\u0442\u0430 <\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0434\u0438\u043e\u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043a\u0430\u043d\u0430\u043b \u0441\u0432\u044f\u0437\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432 <\/strong><code>loop()<\/code>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 Serial.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0434\u0438\u043e\u043a\u0430\u043d\u0430\u043b \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0436\u0435\u0441\u0442\u043e\u0432 \u0440\u0443\u043a\u0438<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 mediapipe (\u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u0435\u043a) \u0438 OpenCV \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u043d\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 pip (\u0438\u043b\u0438 pip3 \u0434\u043b\u044f linux): <\/p>\n<pre><code class=\"bash\">pip install mediapipe pip install opencv-python<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0440\u0443\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np  mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1)  cap = cv2.VideoCapture(0)  while True:     ret, frame = cap.read()     if not ret:         continue      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     results = hands.process(frame)     frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)      if results.multi_hand_landmarks:         for hand_landmarks in results.multi_hand_landmarks:             mp_drawing.draw_landmarks(frame, hand_landmarks, mp_hands.HAND_CONNECTIONS)      cv2.imshow('Fingers', frame)          if cv2.waitKey(10) == 27:         break  cap.release() cv2.destroyAllWindows() <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0438\u0442\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 MediaPipe. \u0412\u0430\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>static_image_mode=False &#8212; \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0440\u0443\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>max_num_hands=1 &#8212; \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u0430\u0434\u0440\u0435 \u0440\u0443\u043a. <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1)<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043d\u0430 \u0440\u0443\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430, \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0442\u043e \u043f\u0430\u043b\u0435\u0446 \u0437\u0430\u0433\u043d\u0443\u0442.<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np  mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False,                        max_num_hands=1)  cap = cv2.VideoCapture(0)  tip_ids = [4, 8, 12, 16, 20] base_ids = [0, 5, 9, 13, 17] extension_threshold = 0.17  def get_vector(p1, p2):     return np.array([p2.x - p1.x, p2.y - p1.y, p2.z - p1.z])  def is_finger_extended(base, tip, is_thumb=False):     base_to_tip = get_vector(base, tip)     base_to_tip_norm = np.linalg.norm(base_to_tip)     return base_to_tip_norm > extension_threshold      while True:     ret, frame = cap.read()     if not ret:         continue      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     results = hands.process(frame)     frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)     if results.multi_hand_landmarks:         for hand_landmarks in results.multi_hand_landmarks:             mp_drawing.draw_landmarks(frame,                                       hand_landmarks,                                       mp_hands.HAND_CONNECTIONS)         if hand_landmarks:             landmarks = hand_landmarks.landmark             for id, landmark in enumerate(hand_landmarks.landmark):                 h, w, c = frame.shape                 cx, cy = int(landmark.x * w), int(landmark.y * h)                 cv2.putText(frame,                             str(id),                             (cx, cy),                             cv2.FONT_HERSHEY_SIMPLEX,                             0.5,                             (0, 255, 255),                             1)                              for finger_index, tip_id in enumerate(tip_ids):                 base_id = base_ids[finger_index]                   if is_finger_extended(landmarks[base_id], landmarks[tip_id]):                     cx, cy = int(landmarks[tip_id].x * frame.shape[1]), int(landmarks[tip_id].y * frame.shape[0])                     cv2.circle(frame, (cx, cy), 10, (0, 255, 0), cv2.FILLED)       cv2.imshow('Fingers', frame)      if cv2.waitKey(10) == 27:         break  cap.release() cv2.destroyAllWindows()      <\/code><\/pre>\n<p>\u0418\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0430\u043b\u044c\u0446\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c) \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u0443 \u043c\u044b\u0441\u043b\u044c.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 4 \u043f\u0430\u043b\u044c\u0446\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u0436\u0430\u0442\u0430\u044f \u0440\u0443\u043a\u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0440\u043e\u0431\u043e\u0442\u0430:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u043f\u0435\u0440\u0435\u0434-\u043d\u0430\u0437\u0430\u0434-\u0432\u043b\u0435\u0432\u043e-\u0432\u043f\u0440\u0430\u0432\u043e-\u0441\u0442\u043e\u043f<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u0432 \u0431\u0438\u0442\u044b, \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 Arduino.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Python<\/p>\n<pre><code class=\"python\">import cv2 import mediapipe as mp import numpy as np import serial import serial.tools.list_ports import time   ser = serial.Serial(\"COM11\", 9600, timeout=1) if ser is None:     exit()  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c time.sleep(2) #\u0416\u0434\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043f\u043e\u0440\u0442\u0430  # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432 handStates = 0   mp_hands = mp.solutions.hands mp_drawing = mp.solutions.drawing_utils hands = mp_hands.Hands(static_image_mode=False, max_num_hands=1, min_detection_confidence=0.7) tip_ids = [4, 8, 12, 16, 20]  # \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043a\u043e\u043d\u0447\u0438\u043a\u043e\u0432 \u043f\u0430\u043b\u044c\u0446\u0435\u0432<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-375633","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=375633"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375633\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=375633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=375633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=375633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}