{"id":211999,"date":"2014-02-10T08:16:03","date_gmt":"2014-02-10T04:16:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=211999"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=211999","title":{"rendered":"<span class=\"post_title\">\u0420\u041e\u0411\u041e\u0422 \u043d\u0430 \u0431\u0430\u0437\u0435: android, arduino, bluetooth. \u0420\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u044b\u0439. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/208466\/\">\u0420\u041e\u0411\u041e\u0422 \u043d\u0430 \u0431\u0430\u0437\u0435: android, arduino, bluetooth. \u041d\u0430\u0447\u0430\u043b\u043e<\/a> \u0431\u044b\u043b\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0430 \u043e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u043e\u0431\u043e\u0442\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u043e\u043c \u0438 \u0430\u0440\u0434\u0443\u0438\u043d\u043e. \u0410 \u0432 \u0435\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0414\u0435\u0442\u0430\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b (\u0440\u0438\u0441.1), \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0443\u0447\u0442\u0435\u043d\u044b, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u2013 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430. <br \/>   <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/059\/5d7\/963\/0595d79634372c16a0589abe8e9fefba.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 1<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <a href=\"http:\/\/habrahabr.ru\/post\/208466\/\">\u0421\u0442\u0430\u0442\u044c\u044f 1. \u0420\u041e\u0411\u041e\u0422 \u043d\u0430 \u0431\u0430\u0437\u0435: android, arduino, bluetooth. \u041d\u0430\u0447\u0430\u043b\u043e<\/a><br \/>  \u0421\u0442\u0430\u0442\u044c\u044f 2. \u0420\u041e\u0411\u041e\u0422 \u043d\u0430 \u0431\u0430\u0437\u0435: android, arduino, bluetooth. \u0420\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u044b\u0439. \u0427\u0430\u0441\u0442\u044c 2.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u044c\u044e \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e:<br \/>  -\u0411\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u0445 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u0438<br \/>  -\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/p>\n<h4>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b:<br \/>  -\u0418\u043c\u0435\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430 (\u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u043f\u0435\u0440\u0435\u0434, \u043d\u0430\u0437\u0430\u0434, \u043d\u0430\u043b\u0435\u0432\u043e, \u043d\u0430\u043f\u0440\u0430\u0432\u043e)<br \/>  -\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c(\u043d\u0430 \u0431\u0430\u0437\u0435 \u0443\u043b\u044c\u0442\u0440\u0430 \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0434\u0430\u0442\u0447\u0438\u043a\u0430) <br \/>  -\u0418\u043c\u0435\u0435\u0442 \u0440\u0435\u0436\u0438\u043c \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u044e, \u043f\u0440\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0435 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439 \u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u0431\u044a\u0435\u0437\u0436\u0430\u044f \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438<\/h4>\n<p>  \u041d\u0430\u0448 \u043c\u0438\u0440 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0439\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u0434\u0447\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043a\u043e\u043d\u0430\u043c \u0444\u0438\u0437\u0438\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043e\u0435\u043c\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b(\u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u043c\u0435\u0449\u0435\u043d \u0440\u043e\u0431\u043e\u0442) \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0440\u043e\u0431\u043e\u0442\u0430. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u0441\u0440\u0435\u0434\u0443 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u0430.<\/p>\n<h6>\u0410\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u044b<\/h6>\n<p>  \u0421\u0440\u0435\u0434\u0430 \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u043e\u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u043e\u0439 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0438\u0440 \u0438 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438: <br \/>  1) \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u0430\u044f, \u0442.\u0435. \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0440\u043e\u0431\u043e\u0442\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u043b\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0441\u0440\u0435\u0434\u044b \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441\u0440\u0435\u0434\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u043e\u0431\u043e\u0442\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043c\u0438\u0440\u0435. <br \/>  2) \u0414\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f. \u0415\u0441\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c \u0440\u043e\u0431\u043e\u0442\u043e\u043c, \u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439; \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439. <br \/>  3) \u042d\u043f\u0438\u0437\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0430\u044f. \u0412 \u044d\u043f\u0438\u0437\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u043e\u043f\u044b\u0442 \u0440\u043e\u0431\u043e\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u044b\u0445 \u044d\u043f\u0438\u0437\u043e\u0434\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043f\u0438\u0437\u043e\u0434 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u0441\u0440\u0435\u0434\u044b \u0440\u043e\u0431\u043e\u0442\u043e\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043f\u0438\u0437\u043e\u0434 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u044d\u043f\u0438\u0437\u043e\u0434\u0430\u0445. \u0412 \u044d\u043f\u0438\u0437\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445 \u0441\u0440\u0435\u0434\u044b \u0432\u044b\u0431\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u044d\u043f\u0438\u0437\u043e\u0434\u0430.<br \/>  4) \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f. \u0415\u0441\u043b\u0438 \u0441\u0440\u0435\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0445\u043e\u0434\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0440\u043e\u0431\u043e\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0440\u0435\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430; \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439. <br \/>  5) \u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0430\u044f \u2014 \u0420\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0441\u0440\u0435\u0434\u044b \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0441\u0440\u0435\u0434\u044b, \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0443\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435\u043c \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0430\u0433\u0435\u043d\u0442\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0433\u0440\u0430 \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<br \/>  6) \u041e\u0434\u043d\u043e\u0430\u0433\u0435\u043d\u0442\u043d\u0430\u044f \u044d\u0442\u043e \u0441\u0440\u0435\u0434\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442(\u0440\u043e\u0431\u043e\u0442), \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u043d\u0435\u0433\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u0438 \u043d\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0442 \u0441 \u043d\u0438\u043c.<\/p>\n<h6>\u0410\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0440\u043e\u0431\u043e\u0442\u0430<\/h6>\n<p>  1) \u0414\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u2013 \u0440\u043e\u0431\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445(\u0432\u0437\u0430\u0434, \u0432\u043f\u0435\u0440\u0435\u0434) \u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435(\u043d\u0430\u043b\u0435\u0432\u043e, \u043d\u0430\u043f\u0440\u0430\u0432\u043e) <br \/>  2) \u0414\u0430\u0442\u0447\u0438\u043a\u0438 \u0440\u043e\u0431\u043e\u0442\u0430 (\u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0435\u043d\u0441\u043e\u0440), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u043e\u0442 0,02 \u043c\u0435\u0442\u0440\u0430 \u0434\u043e 4 \u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u043e\u0431\u043e\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u044b\u043c \u0440\u043e\u0431\u043e\u0442\u043e\u043c. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0440\u043e\u0431\u043e\u0442\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0430\u043a\u0442\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u0432\u0441\u044e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0430\u043a\u0442\u043e\u0432 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f. <\/p>\n<h4>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0434\u0435\u0442\u0430\u043b\u044f\u043c \u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c<\/h4>\n<p>  \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439 HG7881. \u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0440\u043e\u0431\u043e\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u043b\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043c\u0430\u043b\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u0442\u043e\u043a\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0442\u043e\u0440\u0430\u043c\u0438. \u0422\u0430\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439.<br \/>   <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/063\/725\/edf\/063725edffe8b198ed3dd386c11fb728.jpg\"\/><br \/>  HG7881 \u2013 \u044d\u0442\u043e \u0434\u0432\u0443\u0445\u043a\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 2,5 \u2013 12 \u0412. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u043e\u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430:<br \/>  \u0422\u0430\u0431\u043b\u0438\u0446\u0430 1  <\/p>\n<table>\n<tr>\n<td>\u0412\u044b\u0432\u043e\u0434<\/td>\n<td> \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/td>\n<\/tr>\n<tr>\n<td>B-IA <\/td>\n<td>\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c B \u0412\u0445\u043e\u0434 A (IA)<\/td>\n<\/tr>\n<tr>\n<td>B-IB <\/td>\n<td>\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c B \u0412\u0445\u043e\u0434 B (IB)<\/td>\n<\/tr>\n<tr>\n<td>GND <\/td>\n<td>\u0417\u0435\u043c\u043b\u044f (\u041c\u0438\u043d\u0443\u0441)<\/td>\n<\/tr>\n<tr>\n<td>VCC <\/td>\n<td>\u0420\u0430\u0431\u043e\u0447\u0435\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 2.5-12V (\u041f\u043b\u044e\u0441)<\/td>\n<\/tr>\n<tr>\n<td>A-IA <\/td>\n<td>\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c A \u0412\u0445\u043e\u0434 A (IA)<\/td>\n<\/tr>\n<tr>\n<td>A-IB<\/td>\n<td> \u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c A \u0412\u0445\u043e\u0434 B (IB)<\/td>\n<\/tr>\n<\/table>\n<p>   \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u044b (B-IA, B-IB, A-IA, A-IB) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b (HIGH,LOW). \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439:<br \/>  \u0422\u0430\u0431\u043b\u0438\u0446\u0430 2  <\/p>\n<table>\n<tr>\n<td>IA<\/td>\n<td> IB <\/td>\n<td>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f<\/td>\n<\/tr>\n<tr>\n<td>L<\/td>\n<td> L<\/td>\n<td> Off<\/td>\n<\/tr>\n<tr>\n<td>H<\/td>\n<td> L<\/td>\n<td> Forward<\/td>\n<\/tr>\n<tr>\n<td>L<\/td>\n<td> H<\/td>\n<td> Reverse<\/td>\n<\/tr>\n<tr>\n<td>H <\/td>\n<td>H<\/td>\n<td> Off<\/td>\n<\/tr>\n<\/table>\n<p>  \u0423\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0435\u043d\u0441\u043e\u0440 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f HC-SR04. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438\u0437\u043c\u0435\u0440\u044f\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0432\u043e\u043b\u043d\u044b \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. <br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/7a3\/abd\/36c\/7a3abd36c7df0b6108359dff0004b3b2.jpg\"\/><br \/>  \u0421\u0435\u043d\u0441\u043e\u0440 \u0438\u0437\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0438\u043c\u043f\u0443\u043b\u044c\u0441 (\u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 0), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u043c. \u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u0445\u0430 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0432\u0443\u043a\u0430 \u0432 \u0432\u043e\u0437\u0434\u0443\u0445\u0435.<br \/>  \u041d\u0430 \u0432\u044b\u0432\u043e\u0434 (Trig) \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u043c\u043f\u0443\u043b\u044c\u0441 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e 10 \u043c\u043a\u0441, \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0437\u043b\u0443\u0447\u0430\u0435\u0442 8 \u043f\u0430\u0447\u0435\u043a \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 40\u043a\u0413\u0446 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u044d\u0445\u043e. \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u0438\u043d\u0435 \u044d\u0445\u0430 (Echo) \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<br \/>  \u0428\u0438\u0440\u0438\u043d\u0430 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430\/58 = \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0441\u043c. <\/p>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 \u0440\u043e\u0431\u043e\u0442\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/h4>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 (\u0440\u0438\u0441.2).<br \/>   <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/dbe\/6e4\/0cd\/dbe6e40cda62bf66bfa02d43c6b3b87d.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 2<br \/>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043a \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0443 (\u0440\u0438\u0441. 3). \u041f\u043e \u0434\u0432\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u044a\u0435\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u0442.\u0435. \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043a \u0440\u0430\u0437\u044a\u0435\u043c\u0443 \u201cMotor B\u201d, \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u2014 \u201cMotor A\u201d. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0433\u0443\u0441\u0435\u043d\u0438\u0447\u043d\u043e\u0439. \u041f\u0440\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u0438 \u043d\u0430\u0437\u0430\u0434 \u0432\u0441\u0435 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u0430 \u043b\u0435\u0432\u043e\u0439 \u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u043d\u0430\u043b\u0435\u0432\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/b41\/f6c\/7e0\/b41f6c7e094a818522535f7942980d8e.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 3<br \/>  \u041f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439, \u0430\u0440\u0434\u0443\u0438\u043d\u043e, \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b, \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0435\u043d\u0441\u043e\u0440 \u043a \u043c\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0435 (\u0440\u0438\u0441.4) <br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/408\/6ab\/a50\/4086aba50b1271f390a0feb4d324cd6c.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 4<br \/>  \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430 (\u0440\u0438\u0441.5). \u041f\u0438\u0442\u0430\u043d\u0438\u0435 \u0430\u0440\u0434\u0443\u0438\u043d\u043e, \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u0430 \u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439 (\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0441\u0430\u043c\u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439) \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 4 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 (1,2 \u0412., 2700 \u043c\u0410\/\u0447), \u043d\u0430 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u044b\u0445\u043e\u0434\u0430 \u0430\u0440\u0434\u0443\u0438\u043d\u043e 3,3 \u0412.<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/5f7\/8a3\/e59\/5f78a3e59612c21850a0dbebd00dada2.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 5<br \/>  \u0420\u043e\u0431\u043e\u0442 \u0441\u043e\u0431\u0440\u0430\u043d, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0433\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430.<\/p>\n<h4>\u0421\u043a\u0435\u0442\u0447 \u0434\u043b\u044f Arduino \u0428\u0410\u0413 1 \u2013 \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u043e\u043c<\/h4>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u043a\u0435\u0442\u0447 \u0432 \u0430\u0440\u0434\u0443\u0438\u043d\u043e, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432 \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u043e\u0442 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044f (\u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f):  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447 \u0434\u043b\u044f Arduino \u0428\u0410\u0413 1<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 char incomingbyte; \/\/ \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \/\/motors A (RIGHT) int R_A_IA = 9; \/\/ A-IA int R_A_IB = 10; \/\/ A-IB \/\/motors B (LEFT) int L_B_IA = 11; \/\/ B-IA int L_B_IB = 12; \/\/ B-IB \/\/\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 void setup() {   Serial.begin(38400);   \/\/motors RIGHT   pinMode(R_A_IA,OUTPUT);   digitalWrite(R_A_IA, HIGH);   pinMode(R_A_IB,OUTPUT);   digitalWrite(R_A_IB, HIGH);   \/\/motors LEFT   pinMode(L_B_IA,OUTPUT);   digitalWrite(L_B_IA, HIGH);     pinMode(L_B_IB,OUTPUT);   digitalWrite(L_B_IB, HIGH);  }  void go_forward(){   \/\/motors LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, HIGH);    \/\/motors RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, HIGH); }  void go_back(){   \/\/motors LEFT   digitalWrite(L_B_IA, HIGH);     digitalWrite(L_B_IB, LOW);    \/\/motors RIGHT   digitalWrite(R_A_IA, HIGH);   digitalWrite(R_A_IB, LOW); }  void go_right(){   \/\/motors LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, HIGH);    \/\/motors RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, LOW); }  void go_left(){   \/\/motors LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, LOW);    \/\/motors RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, HIGH); }  void stop_robot(){   \/\/motors LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, LOW);    \/\/motors RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, LOW); }  \/\/\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b void loop() {   if (Serial.available() &gt; 0){     incomingbyte = Serial.read();       if (incomingbyte == '1'){         go_forward();         Serial.println(&quot;FORWARD&quot;);       }       if (incomingbyte == '2'){         go_back();         Serial.println(&quot;BACK&quot;);       }          if (incomingbyte == '3'){         go_right();          Serial.println(&quot;RIGHT&quot;);       }       if (incomingbyte == '4'){         go_left();         Serial.println(&quot;LEFT&quot;);       }                if (incomingbyte=='0'){         stop_robot();         Serial.println(&quot;STOP&quot;);       }   }  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435: R_A_IA, R_A_IB \u2013 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u043c \u0410 (\u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b), L_B_IA, L_B_IB \u2014 \u0432\u044b\u0432\u043e\u0434\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u043c B(\u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0438\u0442\/c (\u0431\u043e\u0434) \u2013 38400. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u2013 OUTPUT (\u0432\u044b\u0445\u043e\u0434\u044b). \u041f\u043e\u0434\u0430\u0435\u043c \u043d\u0430 \u0432\u0441\u0435 \u0432\u044b\u0445\u043e\u0434\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 HIGH, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u2014 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b(\u0442\u0430\u0431\u043b\u0438\u0446\u0430 2).<br \/>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438: go_forward(), go_back(), go_right(), go_left(), stop_robot(), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438 \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u044f \u0440\u043e\u0431\u043e\u0442\u0430 \u0432 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u2013 \u0432\u043f\u0435\u0440\u0435\u0434, \u043d\u0430\u0437\u0430\u0434, \u043d\u0430\u043f\u0440\u0430\u0432\u043e, \u043d\u0430\u043b\u0435\u0432\u043e, \u0441\u0442\u043e\u043f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. <br \/>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\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 \u043e\u0442 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0430 \u0438\u043b\u0438 \u0438\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u043f\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043e\u0440\u0442\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442 \u043e\u0431 \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438.<\/p>\n<h4>Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0428\u0410\u0413 1 \u2013 \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u043e\u043c<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u00abAndroid application project\u00bb. \u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0422 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0435\u0433\u043e \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0443 Permissions, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c add, \u0434\u0430\u043b\u0435\u0435 Uses permission, \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0430: android.permission.BLUETOOTH, android.permission.BLUETOOTH_ADMIN<br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 activity, \u0432 res\/layout\/activity_main.xml \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u043a\u043e\u0434:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 activity \u0428\u0410\u0413 1<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     android:layout_width=&quot;fill_parent&quot;     android:layout_height=&quot;fill_parent&quot;     android:orientation=&quot;vertical&quot; &gt;      &lt;TextView         android:id=&quot;@+id\/txtrobot&quot;         android:layout_width=&quot;wrap_content&quot;         android:layout_height=&quot;wrap_content&quot;         android:text=&quot;\u041f\u043e\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439&quot; \/&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;Button             android:id=&quot;@+id\/b1&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_weight=&quot;100&quot;             android:text=&quot;\u0412\u043f\u0435\u0440\u0435\u0434&quot; \/&gt;      &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;LinearLayout             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;match_parent&quot;             android:layout_weight=&quot;100&quot; &gt;              &lt;Button                 android:id=&quot;@+id\/b4&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u041d\u0430\u043b\u0435\u0432\u043e&quot; \/&gt;              &lt;Button                 android:id=&quot;@+id\/b0&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u0421\u0442\u043e\u043f&quot; \/&gt;              &lt;Button                 android:id=&quot;@+id\/b3&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u041d\u0430\u043f\u0440\u0430\u0432\u043e&quot; \/&gt;          &lt;\/LinearLayout&gt;      &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;Button             android:id=&quot;@+id\/b2&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center&quot;             android:layout_weight=&quot;100&quot;             android:text=&quot;\u041d\u0430\u0437\u0430\u0434&quot; \/&gt;      &lt;\/LinearLayout&gt;  &lt;\/LinearLayout&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 activity:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/1dc\/7d4\/1b4\/1dc7d41b443b46bf3c94ce98f208d523.jpg\"\/><br \/>   \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u00abtxtrobot\u00bb, \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043d\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041a\u043d\u043e\u043f\u043a\u0438 b0, b1, b2, b3, b4 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 arduino (0, 1, 2, 3, 4)<br \/>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 src\/..\/MainActivity.java \u0437\u0434\u0435\u0441\u044c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u0434. <br \/>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430 \u0448\u0430\u0433\u0435 4, \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0411\u0422. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434. <br \/>  \u0412 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 onPause() \u0438 onResume() \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0411\u0422 \u0443 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 \u043e\u043d. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u0432 \u0441\u0432\u044f\u0437\u0438, \u0441 \u0447\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0431\u044b\u043b \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d \u0411\u0422, \u043e\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u043b\u043e\u0441\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0411\u0422.  <\/p>\n<pre><code class=\"java\">        if (btAdapter != null){         \tif (btAdapter.isEnabled()){       \/\/\u041a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f } }\t <\/code><\/pre>\n<p>  \u041e\u0431\u044a\u044f\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043d\u043e\u043f\u043e\u043a:  <\/p>\n<pre><code class=\"java\">Button b0, b1, b2, b3, b4; <\/code><\/pre>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u0445 \u043f\u043e ID:   <\/p>\n<pre><code class=\"java\">     b0 = (Button) findViewById(R.id.b0);\/\/\u0421\u0442\u043e\u043f         b1 = (Button) findViewById(R.id.b1);\/\/\u0412\u043f\u0435\u0440\u0435\u0434         b2 = (Button) findViewById(R.id.b2);\/\/\u041d\u0430\u0437\u0430\u0434         b3 = (Button) findViewById(R.id.b3);\/\/\u041d\u0430\u043f\u0440\u0430\u0432\u043e         b4 = (Button) findViewById(R.id.b4);\/\/\u041d\u0430\u043b\u0435\u0432\u043e <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u044d\u0442\u0438\u0445 \u043a\u043d\u043e\u043f\u043e\u043a, \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434:   <\/p>\n<pre><code class=\"java\">    b0.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;0&quot;);             }           });                  b1.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;1&quot;);           }         });                b2.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;2&quot;);           }         });           b3.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;3&quot;);             }           });                  b4.setOnClickListener(new OnClickListener() {         \tpublic void onClick(View v) {         \t\tMyThred.sendData(&quot;4&quot;);         \t}         }); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0428\u0430\u0433 1<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.example.rob_2_3_0;  import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.UUID;  import com.example.rob_2_3_0.R;  import android.os.Bundle; import android.os.Handler; import android.app.Activity; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import android.bluetooth.*; import android.content.Intent;  public class MainActivity extends Activity { \tprivate static final int REQUEST_ENABLE_BT = 1; \tfinal int ArduinoData = 1;         \tfinal String LOG_TAG = &quot;myLogs&quot;; \tprivate BluetoothAdapter btAdapter = null; \tprivate BluetoothSocket btSocket = null; \tprivate static String MacAddress = &quot;20:11:02:47:01:60&quot;; \/\/ MAC-\u0430\u0434\u0440\u0435\u0441 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044f \tprivate static final UUID MY_UUID = UUID.fromString(&quot;00001101-0000-1000-8000-00805F9B34FB&quot;); \tprivate ConnectedThred MyThred = null; \tpublic TextView mytext; \tButton b0, b1, b2, b3, b4; \tboolean fl=false; \tHandler h; \t \t@Override \tprotected void onCreate(Bundle savedInstanceState) { \t\tsuper.onCreate(savedInstanceState); \t\tsetContentView(R.layout.activity_main); \t\t\t\t \t\tbtAdapter = BluetoothAdapter.getDefaultAdapter(); \t\tmytext = (TextView) findViewById(R.id.txtrobot);          \t         if (btAdapter != null){         \tif (btAdapter.isEnabled()){         \t\tmytext.setText(&quot;Bluetooth \u0432\u043a\u043b\u044e\u0447\u0435\u043d. \u0412\u0441\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e.&quot;);\t\t\t         \t}else         \t{         \t\tIntent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);         \t\tstartActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);         \t}         \t         }else         {         \tMyError(&quot;Fatal Error&quot;, &quot;Bluetooth \u041e\u0422\u0421\u0423\u0422\u0421\u0422\u0412\u0423\u0415\u0422&quot;);         }                  b0 = (Button) findViewById(R.id.b0);\/\/\u0421\u0442\u043e\u043f         b1 = (Button) findViewById(R.id.b1);\/\/\u0412\u043f\u0435\u0440\u0435\u0434         b2 = (Button) findViewById(R.id.b2);\/\/\u041d\u0430\u0437\u0430\u0434         b3 = (Button) findViewById(R.id.b3);\/\/\u041d\u0430\u043f\u0440\u0430\u0432\u043e         b4 = (Button) findViewById(R.id.b4);\/\/\u041d\u0430\u043b\u0435\u0432\u043e                  b0.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;0&quot;);             }           });                  b1.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;1&quot;);           }         });                b2.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;2&quot;);           }         });           b3.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;3&quot;);             }           });                  b4.setOnClickListener(new OnClickListener() {         \tpublic void onClick(View v) {         \t\tMyThred.sendData(&quot;4&quot;);         \t}         });                  h = new Handler() {             public void handleMessage(android.os.Message msg) {               switch (msg.what) {               case ArduinoData: \t        \t  byte[] readBuf = (byte[]) msg.obj; \t              String strIncom = new String(readBuf, 0, msg.arg1);                                          \t              mytext.setText(&quot;\u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 Arduino: &quot; + strIncom);            \t              break;               }             };           };    \t} \t \t@Override \tpublic void onResume() { \t    super.onResume();         if (btAdapter != null){         \tif (btAdapter.isEnabled()){      \t   \t\t\t    BluetoothDevice device = btAdapter.getRemoteDevice(MacAddress); \t\t\t    Log.d(LOG_TAG, &quot;***\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 Device***&quot;+device.getName()); \t\t\t       \t\t\t    try { \t\t\t        btSocket = device.createRfcommSocketToServiceRecord(MY_UUID); \t\t\t        Log.d(LOG_TAG, &quot;...\u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043e\u043a\u0435\u0442...&quot;); \t\t\t      } catch (IOException e) { \t\t\t        MyError(&quot;Fatal Error&quot;, &quot;\u0412 onResume() \u041d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u043a\u0435\u0442: &quot; + e.getMessage() + &quot;.&quot;); \t\t\t      }\t  \t\t\t     \t\t\t    btAdapter.cancelDiscovery();\t     \t\t\t    Log.d(LOG_TAG, &quot;***\u041e\u0442\u043c\u0435\u043d\u0438\u043b\u0438 \u043f\u043e\u0438\u0441\u043a \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432***&quot;); \t\t\t     \t\t\t    Log.d(LOG_TAG, &quot;***\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c\u0441\u044f...***&quot;); \t\t\t    try { \t\t\t      btSocket.connect(); \t\t\t      Log.d(LOG_TAG, &quot;***\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e***&quot;); \t\t\t    } catch (IOException e) { \t\t\t      try { \t\t\t        btSocket.close(); \t\t\t      } catch (IOException e2) { \t\t\t        MyError(&quot;Fatal Error&quot;, &quot;\u0412 onResume() \u043d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441\u043e\u043a\u0435\u0442&quot; + e2.getMessage() + &quot;.&quot;); \t\t\t      } \t\t\t    } \t\t\t   \t   \t\t\t    MyThred = new ConnectedThred(btSocket);\t     \t\t\t    MyThred.start();         \t}         } \t  } \t \t  @Override \t  public void onPause() { \t    super.onPause(); \t   \t    Log.d(LOG_TAG, &quot;...In onPause()...&quot;); \t             if (btAdapter != null){         \tif (btAdapter.isEnabled()){       \t \t\t\t    if (MyThred.status_OutStrem() != null) { \t\t\t        MyThred.cancel(); \t\t\t    }\t\t   \t\t\t    try     { \t\t\t      btSocket.close(); \t\t\t    } catch (IOException e2) { \t\t\t    \tMyError(&quot;Fatal Error&quot;, &quot;\u0412 onPause() \u041d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441\u043e\u043a\u0435\u0442&quot; + e2.getMessage() + &quot;.&quot;); \t\t\t    }         \t}     \t} \t  }\/\/OnPause\t \t \tprivate void MyError(String title, String message){ \t\t    Toast.makeText(getBaseContext(), title + &quot; - &quot; + message, Toast.LENGTH_LONG).show(); \t\t    finish(); \t}  \t   \t \/\/\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445   \t private class ConnectedThred extends Thread{ \t\t private final BluetoothSocket copyBtSocket; \t\t private final OutputStream OutStrem; \t\t private final InputStream InStrem; \t\t  \t\t public ConnectedThred(BluetoothSocket socket){ \t\t\t copyBtSocket = socket; \t\t\t OutputStream tmpOut = null; \t\t\t InputStream tmpIn = null; \t\t\t try{ \t\t\t\t tmpOut = socket.getOutputStream(); \t\t\t\t tmpIn = socket.getInputStream(); \t\t\t } catch (IOException e){} \t\t\t  \t\t\t OutStrem = tmpOut; \t\t\t InStrem = tmpIn; \t\t } \t\t  \t\t public void run() \t\t { \t\t\t byte[] buffer = new byte[1024]; \t\t\t int bytes; \t\t\t  \t\t\t while(true){ \t\t\t\t try{ \t\t\t\t\t bytes = InStrem.read(buffer); \t\t\t\t\t h.obtainMessage(ArduinoData, bytes, -1, buffer).sendToTarget(); \t\t\t\t }catch(IOException e){break;}  \t\t\t\t  \t\t\t }  \t\t\t  \t\t } \t\t  \t\t public void sendData(String message) { \t\t\t    byte[] msgBuffer = message.getBytes(); \t\t\t    Log.d(LOG_TAG, &quot;***\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435: &quot; + message + &quot;***&quot;  ); \t\t\t   \t\t\t    try { \t\t\t    \tOutStrem.write(msgBuffer); \t\t\t    } catch (IOException e) {} \t\t} \t\t  \t\t public void cancel(){ \t\t\t try { \t\t\t\t copyBtSocket.close(); \t\t\t }catch(IOException e){}\t\t\t  \t\t } \t\t  \t\t public Object status_OutStrem(){ \t\t\t if (OutStrem == null){return null;\t\t \t\t\t }else{return OutStrem;} \t\t } \t }  }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e \u0411\u0422 \u043d\u0430 \u0430\u0440\u0434\u0443\u0438\u043d\u043e, \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u043e\u0442 \u043d\u0435\u0433\u043e. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430. <\/p>\n<h4>\u0421\u043a\u0435\u0442\u0447 \u0434\u043b\u044f Arduino \u0428\u0410\u0413 2 \u2013 \u0420\u0435\u0436\u0438\u043c \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u043e\u043c<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u044b\u043c \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u043c, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<br \/>  <a href=\"http:\/\/robocraft.ru\/files\/sensors\/Ultrasonic\/HC-SR04\/ultrasonic-HC-SR04.zip\">ultrasonic-HC-SR04.zip<\/a><br \/>  \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0433\u0434\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0441\u043a\u0435\u0442\u0447<br \/>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443  <\/p>\n<pre><code class=\"cpp\">#include &quot;Ultrasonic.h&quot; <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 Ultrasonic \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2014 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b Trig \u0438 Echo, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:  <\/p>\n<pre><code class=\"cpp\">Ultrasonic ultrasonic(5, 6); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0441\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440\u0430\u0445:  <\/p>\n<pre><code class=\"cpp\">float dist_cm = ultrasonic.Ranging(CM); \t\/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442, \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044c.  <\/p>\n<pre><code class=\"cpp\">  Serial.print(&quot;*&quot;);   Serial.print(dist_cm);     Serial.print(&quot;#&quot;); <\/code><\/pre>\n<p>  \u0421\u0438\u043c\u0432\u043e\u043b\u044b \u00ab*\u00bb \u0438 \u00ab#\u00bb \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0442\u043a\u043e \u043e\u0442\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0438\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0447\u0430\u0441\u0442\u044c \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441 \u0437\u0430\u043f\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c. <br \/>  \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 \u0430\u0440\u0434\u0443\u0438\u043d\u043e:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447 \u0434\u043b\u044f Arduino \u0428\u0410\u0413 2<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\"> #include &quot;Ultrasonic.h&quot; \/\/\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 char incomingbyte;  int i=0; \/\/motors A (LEFT) int R_A_IA = 9; \/\/ A-IA int R_A_IB = 10; \/\/ A-IB \/\/motors B (RIGHT) int L_B_IA = 11; \/\/ B-IA int L_B_IB = 12; \/\/ B-IB \/\/\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u044b\u043c \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u043c Ultrasonic ultrasonic(5, 6); \/\/\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 void setup() {   Serial.begin(38400);   \/\/RIGHT   pinMode(R_A_IA,OUTPUT);   digitalWrite(R_A_IA, HIGH);   pinMode(R_A_IB,OUTPUT);   digitalWrite(R_A_IB, HIGH);   \/\/LEFT   pinMode(L_B_IA,OUTPUT);   digitalWrite(L_B_IA, HIGH);     pinMode(L_B_IB,OUTPUT);   digitalWrite(L_B_IB, HIGH);  }  void go_forward(){   \/\/LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, HIGH);    \/\/RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, HIGH); }  void go_back(){   \/\/LEFT   digitalWrite(L_B_IA, HIGH);     digitalWrite(L_B_IB, LOW);    \/\/RIGHT   digitalWrite(R_A_IA, HIGH);   digitalWrite(R_A_IB, LOW); }  void go_right(){   \/\/LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, HIGH);    \/\/RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, LOW); }  void go_left(){   \/\/LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, LOW);    \/\/RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, HIGH); }  void stop_robot(){   \/\/LEFT   digitalWrite(L_B_IA, LOW);     digitalWrite(L_B_IB, LOW);    \/\/RIGHT   digitalWrite(R_A_IA, LOW);   digitalWrite(R_A_IB, LOW); }  \/\/\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b void loop() {   if (Serial.available() &gt; 0){     incomingbyte = Serial.read();       if (incomingbyte == '1'){         go_forward();       }       if (incomingbyte == '2'){         go_back();       }          if (incomingbyte == '3'){         go_right();        }       if (incomingbyte == '4'){         go_left();       }                if (incomingbyte=='0'){         stop_robot();       }   }    float dist_cm = ultrasonic.Ranging(CM); \t\/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430   Serial.print(&quot;*&quot;);   Serial.print(dist_cm);     Serial.print(&quot;#&quot;); }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0428\u0410\u0413 2 \u2013 \u0420\u0435\u0436\u0438\u043c \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u043e\u043c<\/h4>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abb5\u00bb (\u0430\u0432\u0442\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435). \u041a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 activity \u0428\u0410\u0413 2<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\"> &lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     android:layout_width=&quot;fill_parent&quot;     android:layout_height=&quot;fill_parent&quot;     android:orientation=&quot;vertical&quot; &gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;Button             android:id=&quot;@+id\/b5&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_weight=&quot;1&quot;             android:text=&quot;\u0410\u0432\u0442\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435&quot; \/&gt;     &lt;\/LinearLayout&gt;      &lt;TextView         android:id=&quot;@+id\/txtrobot&quot;         android:layout_width=&quot;wrap_content&quot;         android:layout_height=&quot;wrap_content&quot;         android:text=&quot;\u041f\u043e\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439&quot; \/&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;Button             android:id=&quot;@+id\/b1&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_weight=&quot;100&quot;             android:text=&quot;\u0412\u043f\u0435\u0440\u0435\u0434&quot; \/&gt;      &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;LinearLayout             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;match_parent&quot;             android:layout_weight=&quot;100&quot; &gt;              &lt;Button                 android:id=&quot;@+id\/b4&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u041d\u0430\u043b\u0435\u0432\u043e&quot; \/&gt;              &lt;Button                 android:id=&quot;@+id\/b0&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u0421\u0442\u043e\u043f&quot; \/&gt;              &lt;Button                 android:id=&quot;@+id\/b3&quot;                 android:layout_width=&quot;wrap_content&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;100&quot;                 android:text=&quot;\u041d\u0430\u043f\u0440\u0430\u0432\u043e&quot; \/&gt;          &lt;\/LinearLayout&gt;      &lt;\/LinearLayout&gt;      &lt;LinearLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;wrap_content&quot; &gt;          &lt;Button             android:id=&quot;@+id\/b2&quot;             android:layout_width=&quot;wrap_content&quot;             android:layout_height=&quot;wrap_content&quot;             android:layout_gravity=&quot;center&quot;             android:layout_weight=&quot;100&quot;             android:text=&quot;\u041d\u0430\u0437\u0430\u0434&quot; \/&gt;      &lt;\/LinearLayout&gt;  &lt;\/LinearLayout&gt;  <\/code><\/pre>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435<\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 activity \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434:<br \/>   <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/aa4\/92a\/595\/aa492a595b9027e0721264b6463369c9.jpg\"\/><br \/>  \u041e\u0431\u044a\u044f\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e b5:  <\/p>\n<pre><code class=\"java\">Button b0, b1, b2, b3, b4, b5; <\/code><\/pre>\n<p>  \u0418 \u0444\u043b\u0430\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0440\u0435\u0436\u0438\u043c \u0430\u0432\u0442\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442:  <\/p>\n<pre><code class=\"java\">boolean fl=false; <\/code><\/pre>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0435\u0435 \u043f\u043e ID:  <\/p>\n<pre><code class=\"java\">b5 = (Button) findViewById(R.id.b5);\/\/\u0410\u0432\u0442\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0435\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f:   <\/p>\n<pre><code class=\"java\">    b5.setOnClickListener(new OnClickListener() {         \tpublic void onClick(View v) {         \t\tLog.d(LOG_TAG, &quot;\u041d\u0410\u0416\u0410\u041b\u0418 \u0410\u0412\u0422\u041e\u0423\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415&quot;);         \t\tif (!fl){         \t\t\tLog.d(LOG_TAG, &quot;\u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u043e\u043f\u0443\u0449\u0435\u043d&quot;);         \t\t\tfl=true; \t        \t\tb1.setEnabled(false); \t        \t\tb2.setEnabled(false); \t        \t\tb3.setEnabled(false); \t        \t\tb4.setEnabled(false); \t        \t\tMyThred.sendData(&quot;1&quot;); \t        \t\tLog.d(LOG_TAG, &quot;\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 1&quot;);         \t\t}         \t}         }); <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043d\u043e\u043f\u043a\u0438 \u00abb0\u00bb(\u0421\u0442\u043e\u043f)    <\/p>\n<pre><code class=\"java\">   b0.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;0&quot;);              if (fl)               {             \tfl = false;          \t\tb1.setEnabled(true);          \t\tb2.setEnabled(true);          \t\tb3.setEnabled(true);          \t\tb4.setEnabled(true);              }             }           }); <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u043e\u0431\u043e\u0442\u0443 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u0438 \u043e\u0431\u044a\u0435\u0437\u0436\u0430\u0442\u044c \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f. <br \/>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0434\u0443\u0438\u043d\u043e. \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u0435\u043d\u0435\u0435 50 \u0441\u043c. \u0442\u043e \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043e \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0434\u0438\u043c \u043f\u0440\u044f\u043c\u043e:   <\/p>\n<pre><code class=\"java\"> \t  byte[] readBuf = (byte[]) msg.obj;\t        \t   \t              String strIncom = new String(readBuf, 0, msg.arg1);   \t              sb.append(strIncom);\/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \t              int beginOfLineIndex = sb.indexOf(&quot;*&quot;);\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0438   \t              int endOfLineIndex = sb.indexOf(&quot;#&quot;);\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \t              \/\/\u0415\u0441\u043b\u0438 \u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0441\u043a\u0435 *\u0434\u0430\u043d\u043d\u044b\u0435# \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \t              if ((endOfLineIndex &gt; 0) && (beginOfLineIndex == 0)) {                                           \t            \t  String sbprint = sb.substring(beginOfLineIndex+1, endOfLineIndex-3);                \t                  mytext.setText(&quot;\u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 Arduino: &quot; + sbprint);             \t                  if (fl){ \t                \t  int dist = Integer.parseInt(sbprint); \t\t                  if (dist&lt;50) \t\t                  { \t\t                \t  MyThred.sendData(&quot;3&quot;); \t\t                \t   \t\t                  }\t\t         \t\t                \t \t\t                  else \t\t                  { \t\t                \t  MyThred.sendData(&quot;1&quot;); \t\t                  } \t                  } \t              } \t              sb.delete(0, sb.length());    <\/code><\/pre>\n<p>   \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 Activity:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0428\u0430\u0433 2<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.robot.rob_2_3;  import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.util.UUID;  import com.robot.rob_2_3.R;  import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.app.Activity; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import android.bluetooth.*; import android.content.Intent;  public class MainActivity extends Activity { \tprivate static final int REQUEST_ENABLE_BT = 1; \tfinal int ArduinoData = 1;         \tfinal String LOG_TAG = &quot;myLogs&quot;; \tprivate BluetoothAdapter btAdapter = null; \tprivate BluetoothSocket btSocket = null; \tprivate static String MacAddress = &quot;20:11:02:47:01:60&quot;; \/\/ MAC-\u0430\u0434\u0440\u0435\u0441 \u0411\u0422 \u043c\u043e\u0434\u0443\u043b\u044f \tprivate static final UUID MY_UUID = UUID.fromString(&quot;00001101-0000-1000-8000-00805F9B34FB&quot;); \tprivate static final long MILLIS_PER_SECOND = 0; \tprivate ConnectedThred MyThred = null; \tpublic TextView mytext; \tButton b0, b1, b2, b3, b4, b5; \tboolean fl=false; \tHandler h; \tprivate StringBuilder sb = new StringBuilder(); \t \t@Override \tprotected void onCreate(Bundle savedInstanceState) { \t\tsuper.onCreate(savedInstanceState); \t\tsetContentView(R.layout.activity_main); \t\t\t\t \t\tbtAdapter = BluetoothAdapter.getDefaultAdapter(); \t\tmytext = (TextView) findViewById(R.id.txtrobot);          \t         if (btAdapter != null){         \tif (btAdapter.isEnabled()){         \t\tmytext.setText(&quot;Bluetooth \u0432\u043a\u043b\u044e\u0447\u0435\u043d. \u0412\u0441\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e.&quot;);\t\t\t         \t}else         \t{         \t\tIntent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);         \t\tstartActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);         \t}         \t         }else         {         \tMyError(&quot;Fatal Error&quot;, &quot;Bluetooth \u041e\u0422\u0421\u0423\u0422\u0421\u0422\u0412\u0423\u0415\u0422&quot;);         }                  b0 = (Button) findViewById(R.id.b0);\/\/\u0421\u0442\u043e\u043f         b1 = (Button) findViewById(R.id.b1);\/\/\u0412\u043f\u0435\u0440\u0435\u0434         b2 = (Button) findViewById(R.id.b2);\/\/\u041d\u0430\u0437\u0430\u0434         b3 = (Button) findViewById(R.id.b3);\/\/\u041d\u0430\u043f\u0440\u0430\u0432\u043e         b4 = (Button) findViewById(R.id.b4);\/\/\u041d\u0430\u043b\u0435\u0432\u043e         b5 = (Button) findViewById(R.id.b5);\/\/\u0410\u0432\u0442\u043e\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435                  b0.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;0&quot;);              if (fl)               {             \tfl = false;          \t\tb1.setEnabled(true);          \t\tb2.setEnabled(true);          \t\tb3.setEnabled(true);          \t\tb4.setEnabled(true);              }             }           });                  b1.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;1&quot;);           }         });                b2.setOnClickListener(new OnClickListener() {           public void onClick(View v) {            MyThred.sendData(&quot;2&quot;);           }         });           b3.setOnClickListener(new OnClickListener() {             public void onClick(View v) {              MyThred.sendData(&quot;3&quot;);             }           });                  b4.setOnClickListener(new OnClickListener() {         \tpublic void onClick(View v) {         \t\tMyThred.sendData(&quot;4&quot;);         \t}         });                  b5.setOnClickListener(new OnClickListener() {         \tpublic void onClick(View v) {         \t\tLog.d(LOG_TAG, &quot;\u041d\u0410\u0416\u0410\u041b\u0418 \u0410\u0412\u0422\u041e\u0423\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415&quot;);         \t\tif (!fl){         \t\t\tLog.d(LOG_TAG, &quot;\u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u043e\u043f\u0443\u0449\u0435\u043d&quot;);         \t\t\tfl=true; \t        \t\tb1.setEnabled(false); \t        \t\tb2.setEnabled(false); \t        \t\tb3.setEnabled(false); \t        \t\tb4.setEnabled(false); \t        \t\tMyThred.sendData(&quot;1&quot;); \t        \t\tLog.d(LOG_TAG, &quot;\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 1&quot;);         \t\t}         \t}         });                  h = new Handler() {             public void handleMessage(android.os.Message msg) {               switch (msg.what) {               case ArduinoData: \t        \t  byte[] readBuf = (byte[]) msg.obj;\t        \t   \t              String strIncom = new String(readBuf, 0, msg.arg1);   \t              sb.append(strIncom);\/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \t              int beginOfLineIndex = sb.indexOf(&quot;*&quot;);\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0438   \t              int endOfLineIndex = sb.indexOf(&quot;#&quot;);\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \t              \/\/\u0415\u0441\u043b\u0438 \u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0441\u043a\u0435 *\u0434\u0430\u043d\u043d\u044b\u0435# \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \t              if ((endOfLineIndex &gt; 0) && (beginOfLineIndex == 0)) {                                            \/\/ \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u043e\u043a\u0438, \t            \t  String sbprint = sb.substring(beginOfLineIndex+1, endOfLineIndex-3);               \/\/ \u0442\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \t                  mytext.setText(&quot;\u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 Arduino: &quot; + sbprint);             \t                  if (fl){ \t                \t  int dist = Integer.parseInt(sbprint); \t\t                  if (dist&lt;50) \t\t                  { \t\t                \t  MyThred.sendData(&quot;3&quot;); \t\t                \t   \t\t                  }\t\t         \t\t                \t \t\t                  else \t\t                  { \t\t                \t  MyThred.sendData(&quot;1&quot;); \t\t                  } \t                  } \t              } \t              sb.delete(0, sb.length());  \t                                       \t              break;               }             };           };          \t} \t  \t@Override \tpublic void onResume() { \t    super.onResume();         if (btAdapter != null){         \tif (btAdapter.isEnabled()){      \t   \t\t\t    BluetoothDevice device = btAdapter.getRemoteDevice(MacAddress); \t\t\t    Log.d(LOG_TAG, &quot;***\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 Device***&quot;+device.getName()); \t\t\t       \t\t\t    try { \t\t\t        btSocket = device.createRfcommSocketToServiceRecord(MY_UUID); \t\t\t        Log.d(LOG_TAG, &quot;...\u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043e\u043a\u0435\u0442...&quot;); \t\t\t      } catch (IOException e) { \t\t\t        MyError(&quot;Fatal Error&quot;, &quot;\u0412 onResume() \u041d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u043a\u0435\u0442: &quot; + e.getMessage() + &quot;.&quot;); \t\t\t      }\t  \t\t\t     \t\t\t    btAdapter.cancelDiscovery();\t     \t\t\t    Log.d(LOG_TAG, &quot;***\u041e\u0442\u043c\u0435\u043d\u0438\u043b\u0438 \u043f\u043e\u0438\u0441\u043a \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432***&quot;); \t\t\t     \t\t\t    Log.d(LOG_TAG, &quot;***\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c\u0441\u044f...***&quot;); \t\t\t    try { \t\t\t      btSocket.connect(); \t\t\t      Log.d(LOG_TAG, &quot;***\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e***&quot;); \t\t\t    } catch (IOException e) { \t\t\t      try { \t\t\t        btSocket.close(); \t\t\t      } catch (IOException e2) { \t\t\t        MyError(&quot;Fatal Error&quot;, &quot;\u0412 onResume() \u043d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441\u043e\u043a\u0435\u0442&quot; + e2.getMessage() + &quot;.&quot;); \t\t\t      } \t\t\t    } \t\t\t   \t   \t\t\t    MyThred = new ConnectedThred(btSocket);\t     \t\t\t    MyThred.start();         \t}         } \t  } \t \t  @Override \t  public void onPause() { \t    super.onPause(); \t   \t    Log.d(LOG_TAG, &quot;...In onPause()...&quot;); \t             if (btAdapter != null){         \tif (btAdapter.isEnabled()){       \t \t\t\t    if (MyThred.status_OutStrem() != null) { \t\t\t        MyThred.cancel(); \t\t\t    }\t\t   \t\t\t    try     { \t\t\t      btSocket.close(); \t\t\t    } catch (IOException e2) { \t\t\t    \tMyError(&quot;Fatal Error&quot;, &quot;\u0412 onPause() \u041d\u0435 \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441\u043e\u043a\u0435\u0442&quot; + e2.getMessage() + &quot;.&quot;); \t\t\t    }         \t}     \t} \t  }\/\/OnPause\t \t \tprivate void MyError(String title, String message){ \t\t    Toast.makeText(getBaseContext(), title + &quot; - &quot; + message, Toast.LENGTH_LONG).show(); \t\t    finish(); \t}  \t   \t \/\/\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445   \t private class ConnectedThred extends Thread{ \t\t private final BluetoothSocket copyBtSocket; \t\t private final OutputStream OutStrem; \t\t private final InputStream InStrem; \t\t  \t\t public ConnectedThred(BluetoothSocket socket){ \t\t\t copyBtSocket = socket; \t\t\t OutputStream tmpOut = null; \t\t\t InputStream tmpIn = null; \t\t\t try{ \t\t\t\t tmpOut = socket.getOutputStream(); \t\t\t\t tmpIn = socket.getInputStream(); \t\t\t } catch (IOException e){} \t\t\t  \t\t\t OutStrem = tmpOut; \t\t\t InStrem = tmpIn; \t\t } \t\t  \t\t public void run() \t\t { \t\t\t byte[] buffer = new byte[1024]; \t\t\t int bytes; \t\t\t  \t\t\t while(true){ \t\t\t\t try{ \t\t\t\t\t bytes = InStrem.read(buffer); \t\t\t\t\t h.obtainMessage(ArduinoData, bytes, -1, buffer).sendToTarget(); \t\t\t\t }catch(IOException e){break;}  \t\t\t\t  \t\t\t }  \t\t\t  \t\t } \t\t  \t\t public void sendData(String message) { \t\t\t    byte[] msgBuffer = message.getBytes(); \t\t\t    Log.d(LOG_TAG, &quot;***\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435: &quot; + message + &quot;***&quot;  ); \t\t\t   \t\t\t    try { \t\t\t    \tOutStrem.write(msgBuffer); \t\t\t    } catch (IOException e) {} \t\t} \t\t  \t\t public void cancel(){ \t\t\t try { \t\t\t\t copyBtSocket.close(); \t\t\t }catch(IOException e){}\t\t\t  \t\t } \t\t  \t\t public Object status_OutStrem(){ \t\t\t if (OutStrem == null){return null;\t\t \t\t\t }else{return OutStrem;} \t\t } \t }  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u043a\u0435\u0442\u0447\u0435\u043c \u0430\u0440\u0434\u0443\u0438\u043d\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442, \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u043e\u043c, \u0442\u0430\u043a \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u043e\u0431\u043e\u0442 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438 \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043e\u0431\u044a\u0435\u0437\u0436\u0430\u0435\u0442 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f. <br \/>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0440\u043e\u0431\u043e\u0442. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u043a\u0435\u0442\u0447\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u0430 \u0446\u0435\u043b\u0438, \u043d\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0440\u043e\u0431\u043e\u0442\u043e\u0432 \u0438 \u0434\u0440.<br \/>  \u041a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0437\u0430\u043a\u0430\u0437 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f:   <\/p>\n<table>\n<tr>\n<td>\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435<\/td>\n<td> \u0421\u0441\u044b\u043b\u043a\u0430<\/td>\n<td> \u0426\u0435\u043d\u0430 y.e<\/td>\n<td> \u0426\u0435\u043d\u0430 \u0440\u0443\u0431<\/td>\n<td> \u041a\u043e\u043b-\u0432\u043e<\/td>\n<td> \u0421\u0443\u043c\u043c\u0430<\/td>\n<\/tr>\n<tr>\n<td>Wifi \u043c\u043e\u0434\u0443\u043b\u044c<\/td>\n<td> <a href=\"http:\/\/dx.com\/p\/hi-link-hlk-rm04-serial-port-ethernet-wi-fi-adapter-module-blue-black-214540#.UutHKD1_sd0\">dx.com\/p\/hi-link-hlk-rm04-serial-port-ethernet-wi-fi-adapter-module-blue-black-214540#.UutHKD1_sd0<\/a> <\/td>\n<td>14,99<\/td>\n<td>524,65<\/td>\n<td>1<\/td>\n<td> 524,65<\/td>\n<\/tr>\n<\/table>\n<p>   \u0418\u0422\u041e\u0413: 524,65<\/p>\n<p>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0445\u0430\u0431\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c commanderxo \u043f\u043e\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c Firmata (\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0430\u0440\u0434\u0443\u0438\u043d\u043e \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c). \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0434\u043b\u044f \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0411\u0422, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0438\u0437 \u0425\u0430\u0431\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0442\u0430\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/211999\/\"> http:\/\/habrahabr.ru\/post\/211999\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/208466\/\">\u0420\u041e\u0411\u041e\u0422 \u043d\u0430 \u0431\u0430\u0437\u0435: android, arduino, bluetooth. \u041d\u0430\u0447\u0430\u043b\u043e<\/a> \u0431\u044b\u043b\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0430 \u043e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u043e\u0431\u043e\u0442\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u043e\u043c \u0438 \u0430\u0440\u0434\u0443\u0438\u043d\u043e. \u0410 \u0432 \u0435\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0414\u0435\u0442\u0430\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b (\u0440\u0438\u0441.1), \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0443\u0447\u0442\u0435\u043d\u044b, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u2013 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430. <br \/>   <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/059\/5d7\/963\/0595d79634372c16a0589abe8e9fefba.jpg\"\/><br \/>  \u0420\u0438\u0441\u0443\u043d\u043e\u043a 1  <\/p>\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-211999","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/211999","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=211999"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/211999\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}