{"id":192258,"date":"2013-09-02T22:55:03","date_gmt":"2013-09-02T18:55:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=192258"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=192258","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u043a Raspberry Pi \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Pi4J<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u0435\u043d\u044f \u0432\u0437\u044f\u043b\u0438 \u0432 \u043a\u0440\u0443\u0436\u043e\u043a \u043f\u043e \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0435. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u043b\u0441\u044f, \u044d\u0442\u043e \u0436\u0435 \u043d\u043e\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435\u2026 \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0432\u043e\u043a\u0443\u0440\u0441\u043d\u0438\u043a. \u041c\u043e\u0439 \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044c, \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0432 \u043c\u043d\u0435 \u043e\u0431\u0449\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0441 Raspberry Pi. \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e JDK \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0430 \u0431\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441 3-\u0445 \u043e\u0441\u0435\u0432\u043e\u0433\u043e \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430. \u0412\u0437\u044f\u0432 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435, \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0434\u043e\u043c\u043e\u0439 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f. \u041a\u043e\u0433\u0434\u0430 \u044f \u0432\u0441\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b (\u0443\u0448\u043b\u043e \u043d\u0430 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0435\u0434\u0435\u043b\u044f), \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0430\u0439\u0434\u0438\u043a, \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u0438 \u044f, \u0434\u0430\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u044f \u043d\u0430\u0440\u044b\u043b, \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041d\u0443, \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f! <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 SSH. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0435\u0440 SSH \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d, \u0438 \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Raspberry \u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0443 \u0438\u043b\u0438 \u0442\u0435\u043b\u0435\u0432\u0438\u0437\u043e\u0440\u0443, \u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0438 \u043c\u044b\u0448\u043a\u0443. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 IP, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <b>sudo raspi-config<\/b>. \u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0435\u043d\u044e \u0438\u0434\u0435\u043c \u0432 advanced options-&gt;SSH \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Enable. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u043a\u043e\u0448\u043a\u043e: <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/bc4\/0a4\/de2\/bc40a4de2eb5dc79d1ea7c974f171488.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043a\u043e\u043d\u0435\u043a\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u201c\u043c\u0430\u043b\u0438\u043d\u043a\u0435\u201d \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u0438. \u0424\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \/etc\/network\/.\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0442\u0443\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <b>cd \/etc\/network<\/b>. \u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0432\u0432\u0435\u0434\u044f <b>sudo nano interfaces<\/b>. \u0417\u0434\u0435\u0441\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP \u0430\u0434\u0440\u0435\u0441. \u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/1c9\/f0d\/455\/1c9f0d455a5488b7fd654a413125fe7b.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c CTRL+X, Y, Enter. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f. \u0414\u0430\u043b\u0435\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u0442 <a href=\"http:\/\/www.putty.org\/\">SSH \u2014 PuTTY<\/a>. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/453\/e48\/1a9\/453e481a9bc000b77f93d617187c36cf.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432 \u043f\u043e\u043b\u0435 Host Name \u043f\u0438\u0448\u0435\u043c \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 ip, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 interfaces. \u0417\u0434\u0435\u0441\u044c \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0432 \u0432 \u043f\u043e\u043b\u0435 Save Session \u0438\u043c\u044f \u0438 \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 Save. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Open. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e PuTTY \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a SSH \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043e\u043a\u043d\u043e, \u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: pi, \u043f\u0430\u0440\u043e\u043b\u044c: raspberry):<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/75b\/099\/3f2\/75b0993f2d98dbf4576c763fcb533690.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0432\u044b \u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c, \u0432 Linux \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0432\u0438\u0434\u0435\u043d, \u0445\u043e\u0442\u044f \u0432\u0432\u043e\u0434 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Enter. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0434\u0430\u0447\u043d\u043e, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u043a\u043e\u0448\u043a\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/9a6\/5fb\/c8c\/9a65fbc8ce5875d00ab224bfd87673f5.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435. \u041d\u0435\u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438 \u0443\u0434\u043e\u0431\u043d\u043e? <\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 JDK<\/h4>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0432\u0432\u0435\u0434\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 <b>sudo apt-get update<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/613\/f94\/e18\/613f94e1866818251c0a2ba34235180f.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0438 \u0441\u0430\u043c\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 <b>sudo apt-get upgrade<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/238\/1ec\/dbe\/2381ecdbe8f9c3e6ba375a8386113c25.jpg\" alt=\"image\"\/><br \/>   \u041d\u0430 \u0432\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0443 \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 30 \u043c\u0438\u043d\u0443\u0442), \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u043f\u0430\u0441\u0438\u0442\u0435\u0441\u044c \u0447\u0430\u0435\u043c. \u0421\u043b\u0430\u0432\u0430 \u0432\u0435\u043b\u0438\u043a\u043e\u0439 \u0441\u0438\u043b\u0435, \u0447\u0442\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0430\u043a\u0435\u0442 JDK, \u0438 \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0442\u0430\u043d\u0446\u0435\u0432\u0430\u0442\u044c \u0441 \u0431\u0443\u0431\u043d\u043e\u043c. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u043c <b>sudo apt-get install openjdk-7-jdk<\/b>.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0438\u043c java -version. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/901\/264\/850\/9012648503c3f4c01afdaa78563cefa2.jpg\" alt=\"image\"\/><\/p>\n<p>  P.S. \u041d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0430\u043a\u0435\u0442 JDK. \u041e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u044f\u0434\u0440\u0430 Debian \u201cwheezy\u201d \u0441 java. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u041e\u0421 \u043d\u0430 Soft-float Debian \u201cwheezy\u201d, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 java. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u043c\u043e\u0435\u0439 \u201c\u043c\u0430\u043b\u0438\u043d\u043a\u0435\u201d \u0432\u0441\u0435 \u0432\u0441\u0442\u0430\u043b\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430. \u0412\u043e\u0442 \u043c\u043e\u044f \u0432\u0435\u0440\u0441\u0438\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/ba0\/6cb\/4b0\/ba06cb4b05f6e142cef72455a007505f.jpg\" alt=\"image\"\/><\/p>\n<h4>I2c vs Raspberry PI<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435! \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0442\u0430\u043a\u043e\u0435? \u0412\u0435\u043b\u0438\u043a\u0430\u044f \u0438 \u043c\u043e\u0433\u0443\u0447\u0430\u044f \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442:<br \/>  <i>I\u00b2C (\u0440\u0443\u0441. \u0430\u0439-\u0442\u0443-\u0441\u0438\/\u0438-\u0434\u0432\u0430-\u0446\u044d\/\u0438-\u0434\u0432\u0430-\u0441\u0438) \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0448\u0438\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0445\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0430\u044f \u0434\u0432\u0435 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 (SDA \u0438 SCL). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u044b\u0445 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0441 \u043c\u0430\u0442\u0435\u0440\u0438\u043d\u0441\u043a\u043e\u0439 \u043f\u043b\u0430\u0442\u043e\u0439, \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\u043c\u0438. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0441\u043b\u043e\u0432 Inter-Integrated Circuit.<\/i><\/p>\n<p>  \u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432\u043e\u0442 \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <a href=\"http:\/\/www.pololu.com\/catalog\/product\/1265\/pictures\">LSM303DLM<\/a>, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043d\u0435\u043c. \u041d\u0438\u0436\u0435 \u044f \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b \u0441\u0445\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/ca4\/724\/791\/ca4724791f12e8443b2ae0d30401b371.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041e\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0438 \u044f \u0434\u0443\u043c\u0430\u044e, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c. \u0410\u0445 \u0434\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0432 \u0444\u0430\u0439\u043b, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 <b>sudo nano \/etc\/modules<\/b> \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430:<\/p>\n<p>  <i>i2c-bcm2708 <br \/>  i2c-dev<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/663\/891\/1ca\/6638911ca25f3eb3bbac7b1ccce543d2.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442 i2c-tools. \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u043f\u0438\u0448\u0435\u043c: <b>sudo apt-get install python-smbus<\/b> \u0438 <b>sudo apt-get install i2c-tools<\/b>.<br \/>  \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0447\u0435\u0440\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c sudo nano \/etc\/modprobe.d\/raspi-blacklist.conf. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<p>  <i>blacklist spi-bcm2708<br \/>  blacklist i2c-bcm2708<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/5b9\/83b\/c0d\/5b983bc0df57f4d293170ac041bff891.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412\u0441\u0435. \u0412\u0441\u0435 \u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 I2C \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0432\u0438\u0434\u0438\u043c \u043b\u0438 \u043c\u044b \u043d\u0430\u0448\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0412 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 i2c-tools \u0432\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 i2cdetect, \u043e\u043d\u0430 \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u043d\u0430. \u041d\u043e \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b. \u041f\u0438\u0448\u0435\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 <b>i2cdetect \u2013l<\/b>. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/2d1\/7f5\/e00\/2d17f5e003436b40f9810e64c464b29c.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0422\u043e \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c<b> i2cdetect \u2013y 1<\/b> (<b>i2cdetect \u2013y 0<\/b>). \u0412\u0438\u0434\u0438\u043c \u0440\u0435\u0448\u0435\u0442\u043a\u0443 \u0430\u0434\u0440\u0435\u0441\u043e\u0432: <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/750\/989\/75a\/75098975a7e863e5eff743bfba137bff.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0430\u0434\u0440\u0435\u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 0x18(\u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438). \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e PI4J.<\/p>\n<h4>\u0423\u043e\u0443 \u0443\u043e\u0443 \u0443\u043e\u0443 \u043f\u0430\u043b\u0435\u0445\u0447\u0435\u2026<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 I2C \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 JAVA, \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 PI4J. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/pi4j.com\/\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435<b> wget <a href=\"http:\/\/pi4j.googlecode.com\/files\/pi4j-0.0.5.deb\">pi4j.googlecode.com\/files\/pi4j-0.0.5.deb<\/a><\/b>. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0432: <b>sudo dpkg -i pi4j-0.0.5.deb<\/b>. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/151\/b28\/b8a\/151b28b8ac395f0028ae328b6de2a4f2.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0438\u0448\u0435\u043c: <\/p>\n<p>  <b>javac -classpath .:classes:\/opt\/pi4j\/lib\/&#8217;*&#8217; (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435)<\/b><\/p>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<br \/>  <b>sudo java -classpath .:classes:\/opt\/pi4j\/lib\/&#8217;*&#8217; (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435)<\/b><\/p>\n<p>  \u0418\u0437 \u0432\u0441\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f 3: <\/p>\n<pre><code class=\"java\">import com.pi4j.io.i2c.I2CBus; import com.pi4j.io.i2c.I2CDevice; import com.pi4j.io.i2c.I2CFactory; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 I2CDevice \u0438 I2CBus.<\/p>\n<pre><code class=\"java\">import java.io.IOException; import com.pi4j.io.i2c.I2CBus; import com.pi4j.io.i2c.I2CDevice; import com.pi4j.io.i2c.I2CFactory;  public class accelerometrOne { \tstatic I2CDevice device; \tstatic I2CBus bus; \tstatic byte[] accel;     public static void main(String[] args) throws IOException {         System.out.println(&quot;Starting sensors reading:&quot;);         try {            bus = I2CFactory.getInstance(I2CBus.BUS_1);            System.out.println(&quot;Connected to bus OK!&quot;);                         device = bus.getDevice(0x18);            System.out.println(&quot;Connected to device OK!&quot;);                             } catch (IOException e) {            System.out.println(e.getMessage());         }     } } <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u0434. \u0421\u0442\u0440\u043e\u0447\u043a\u043e\u0439<b> bus = I2CFactory.getInstance(I2CBus.BUS_1);<\/b> \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0448\u0438\u043d\u0435, \u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>device = bus.getDevice(0x18);<\/b> \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430. \u041b\u0435\u0437\u0435\u043c \u0432 <a href=\"http:\/\/www.pololu.com\/file\/download\/LSM303DLH-compass-app-note.pdf?file_id=0J434\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/f47\/de9\/c16\/f47de9c168ee553f4fb5759dfdd1576f.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0423 \u043a\u043e\u0433\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0441\u0435 \u043f\u043b\u043e\u0445\u043e \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u043c. \u0412 \u043c\u043e\u0435\u043c \u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435: \u201c\u041f\u043e\u0441\u043b\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f LSM303DLH \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e 2 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c CTRL_REG1_A(20h) \u0438 CTRL_REG2_A (23h). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043f\u0438\u0448\u0435\u043c 0x27 \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ODR 50\u0433\u0446. <\/p>\n<p>  \u041f\u0438\u0448\u0435\u043c 0*40 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 +- 2 \u0433\u0430\u0443\u0441\u0441 \u0432 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442\u043e\u0432 \u043e\u0442 \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u043a \u0441\u0442\u0430\u0440\u0448\u0435\u043c\u0443 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a, \u043e\u0442 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u043a \u043c\u043b\u0430\u0434\u0448\u0435\u043c\u0443.\u201d <\/p>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c <b>write<\/b> \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430<b> I2CDevice<\/b>. \u0414\u043e\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443:<\/p>\n<pre><code class=\"java\">import java.io.IOException; import com.pi4j.io.i2c.I2CBus; import com.pi4j.io.i2c.I2CDevice; import com.pi4j.io.i2c.I2CFactory;  public class accelerometrOne { \tstatic I2CDevice device; \tstatic I2CBus bus; \tstatic byte[] accel;     public static void main(String[] args) throws IOException {         System.out.println(&quot;Starting sensors reading:&quot;);         try {            bus = I2CFactory.getInstance(I2CBus.BUS_1);            System.out.println(&quot;Connected to bus OK!&quot;);                         device = bus.getDevice(0x18);            System.out.println(&quot;Connected to device OK!&quot;);                        device.write(0x20, (byte) 0x27);            device.write(0x23, (byte) 0x40);            System.out.println(&quot;Configuring sensors OK!&quot;);                   } catch (IOException e) {            System.out.println(e.getMessage());         }     } <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e!!! \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0421\u043d\u043e\u0432\u0430 \u043b\u0435\u0437\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e 2 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043e\u0441\u044c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/337\/1d9\/0a6\/3371d90a616bd38cf9f57ba02d537d47.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041d\u0443 \u0438 \u0432\u0441\u0435. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d:<\/p>\n<pre><code class=\"java\">import java.io.IOException; import com.pi4j.io.i2c.I2CBus; import com.pi4j.io.i2c.I2CDevice; import com.pi4j.io.i2c.I2CFactory;  public class accelerometrOne { \tstatic I2CDevice device; \tstatic I2CBus bus; \tstatic byte[] accel;     public static void main(String[] args) throws IOException {         System.out.println(&quot;Starting sensors reading:&quot;);         try {            bus = I2CFactory.getInstance(I2CBus.BUS_1);            System.out.println(&quot;Connected to bus OK!&quot;);                         device = bus.getDevice(0x18);            System.out.println(&quot;Connected to device OK!&quot;);                        device.write(0x20, (byte) 0x27);            device.write(0x23, (byte) 0x40);            System.out.println(&quot;Configuring sensors OK!&quot;);                      readingsensors();                     } catch (IOException e) {            System.out.println(e.getMessage());         }     }      private static void readingsensors() throws IOException { \t\twhile (true) { \t\t\taccel = new byte[6]; \t\t\taccel[0] = (byte) device.read(0x28); \t\t\taccel[1] = (byte) device.read(0x29); \t\t\taccel[2] = (byte) device.read(0x2a); \t\t\taccel[3] = (byte) device.read(0x2b); \t\t\taccel[4] = (byte) device.read(0x2c); \t\t\taccel[5] = (byte) device.read(0x2d); \t\t\tint accelx = asint(accel[0]) * 256 + asint(accel[1]); \t\t\tint accely = asint(accel[2]) * 256 + asint(accel[3]); \t\t\tint accelz = asint(accel[4]) * 256 + asint(accel[5]); \t\t\tSystem.out.println(&quot;accelx: &quot; + accelx + &quot;, accely: &quot; + accely \t\t\t\t\t+ &quot;, accelz: &quot; + accelz); \t\t} \t}     private static int asint(byte b) {         int i = b;         if (i &lt; 0) {             i = i + 256;         }         return i;     } }  <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/c49\/0df\/299\/c490df29931f3b17bf965b2d8ec50253.jpg\" alt=\"image\"\/> \t\t\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\/192258\/\"> http:\/\/habrahabr.ru\/post\/192258\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u0435\u043d\u044f \u0432\u0437\u044f\u043b\u0438 \u0432 \u043a\u0440\u0443\u0436\u043e\u043a \u043f\u043e \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0435. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u043b\u0441\u044f, \u044d\u0442\u043e \u0436\u0435 \u043d\u043e\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435\u2026 \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0432\u043e\u043a\u0443\u0440\u0441\u043d\u0438\u043a. \u041c\u043e\u0439 \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u044c, \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0432 \u043c\u043d\u0435 \u043e\u0431\u0449\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0441 Raspberry Pi. \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e JDK \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0430 \u0431\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441 3-\u0445 \u043e\u0441\u0435\u0432\u043e\u0433\u043e \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430. \u0412\u0437\u044f\u0432 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435, \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0434\u043e\u043c\u043e\u0439 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f. \u041a\u043e\u0433\u0434\u0430 \u044f \u0432\u0441\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b (\u0443\u0448\u043b\u043e \u043d\u0430 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0435\u0434\u0435\u043b\u044f), \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0430\u0439\u0434\u0438\u043a, \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u0438 \u044f, \u0434\u0430\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u044f \u043d\u0430\u0440\u044b\u043b, \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041d\u0443, \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f!   <\/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-192258","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192258","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=192258"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/192258\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=192258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=192258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}