{"id":300160,"date":"2020-03-15T15:00:24","date_gmt":"2020-03-15T15:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=300160"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=300160","title":{"rendered":"Flutter + arduino nano 33 BLE sense = \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 BLE sensor"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/492404\/\">\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e bluetooth \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044e (\u043a\u0443\u0434\u0430 \u0443\u0436 \u0431\u0435\u0437 \u043d\u0435\u0435 \ud83d\ude42 ) \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Flutter \u0434\u043b\u044f \u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ep\/ad\/j7\/epadj7tyxlocbup948zmgsyafdc.jpeg\"><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0430\u043c \u0441\u0435\u043d\u0441\u043e\u0440<\/h4>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0442\u0430 <a href=\"https:\/\/store.arduino.cc\/usa\/nano-33-ble-sense\" rel=\"nofollow\">Arduino nano 33 BLE sense<\/a>.<\/p>\n<p>  \u041f\u043b\u0430\u0442\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 nrf52840. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u043b\u0430\u0442 \u0432 \u0430\u0440\u0434\u0443\u0438\u043d\u043e. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/go\/ry\/nl\/gorynl7zdxmfbzidptj5g-p7wtm.png\"><\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: <\/p>\n<ul>\n<li><a href=\"https:\/\/www.arduino.cc\/en\/Reference\/ArduinoBLE\" rel=\"nofollow\">Arduino BLE<\/a> <\/li>\n<li><a href=\"https:\/\/www.arduino.cc\/en\/Reference\/ArduinoHTS221\" rel=\"nofollow\">Arduino HTS221<\/a> <\/li>\n<li><a href=\"https:\/\/www.arduino.cc\/en\/Reference\/ArduinoLPS22HB\" rel=\"nofollow\">Arduino LPS22HB<\/a> <\/li>\n<\/ul>\n<p>  \u042d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0440\u0430\u0441\u043f\u0430\u044f\u043d\u044b \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u043f\u043b\u0430\u0442\u0435.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<\/h4>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0438\u0440\u043e\u043a\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432 \u043d\u0438\u0445 \u0432\u0441\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0440\u0435\u0436\u0438\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0439 bluetooth \u043c\u0435\u0442\u043a\u0438, \u043d\u043e \u0441 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 ManufacturerData. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 advertise \u043f\u043e\u0441\u044b\u043b\u043a\u0435.<\/p>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 advertise \u043f\u043e\u0441\u044b\u043b\u043a\u0438 31 \u0431\u0430\u0439\u0442. \u0421\u044e\u0434\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f: \u0438\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432 ManufacturerData \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 20 \u0431\u0430\u0439\u0442. \u042d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u0438.<br \/>  \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u043c \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0438, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c, \u0448\u0438\u0440\u043e\u043a\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0430. \u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u043e\u0432 \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u043f\u0440\u0438\u0435\u043c\u0430.<br \/>  ManufacturerData \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u0430\u0434\u0432\u0435\u0440\u0442\u0430\u0439\u0437\u0438\u043d\u0433\u0430.<\/p>\n<h4>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h4>\n<p>  \u0412 \u043a\u043e\u0434\u0435 \u0430\u0440\u0434\u0443\u0438\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b BLE \u0447\u0430\u0441\u0442\u0438 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 ManufacturerData<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0438\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u0430\u043a \u0435\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<pre><code class=\"cpp\">BLE.setLocalName(&quot;nrf52840.ru&quot;); BLE.setConnectable(false); byte data[8] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; BLE.setManufacturerData(data, 8); \/\/ start advertising BLE.advertise(); <\/code><\/pre>\n<p>  \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u043d\u044b \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 advertising, \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0434\u0438\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0437\u0430\u043c\u0435\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c ManufacturerData \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0435\u0449\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u042d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0435 2 \u0441\u0435\u043a.<\/p>\n<pre><code class=\"cpp\">BLE.stopAdvertise(); \/\/ read all the sensor values --------------------- \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f --------------------- byte data[8] = { 0x00, 0x01, t1, t2, h1, h2, p1, p2}; \/\/ t - \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 (2 \u0431\u0430\u0439\u0442\u0430), h - \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c (2 \u0431\u0430\u0439\u0442\u0430), p - \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (2 \u0431\u0430\u0439\u0442\u0430) BLE.setManufacturerData(data, 8); BLE.advertise(); \/\/ wait 2 second to print again delay(2000);<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0412\u0435\u0449\u0430\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0435 100\u043c\u0441 \u0438 \u043a\u0430\u0436\u0434\u044b\u0435 2\u0441\u0435\u043a \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e \u043a\u043e\u0434\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u0435\u043e \u0441\u0435\u043d\u0441\u043e\u0440.<\/p>\n<h4>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u0434\u0435\u043b\u0430\u044e \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0443: \u044f \u043d\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b VSCode \u0441 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c Flutter. \u042d\u0442\u0430 \u0441\u0440\u0435\u0434\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c Android Studio, \u043a\u0430\u043a \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 BLE \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/pub.dev\/packages\/flutter_blue\" rel=\"nofollow\">Flutter_blue<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p>  \u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u041d\u0430\u0448 \u0441\u0435\u043d\u0441\u043e\u0440 \u0432\u0435\u0449\u0430\u0435\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e Beacon, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: <\/p>\n<ol>\n<li> \u041f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0444\u0438\u0440 \u2014 \u043d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, <\/li>\n<li> \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e ManufacturerData, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435. <\/li>\n<\/ol>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 Bluetooth \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u0430\u0436\u0434\u044b\u0435 10 \u0441\u0435\u043a \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 2 \u0441\u0435\u043a. \u0427\u0430\u0449\u0435 \u0438 \u0434\u043e\u043b\u044c\u0448\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442, \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u0441\u044f, \u0430 \u0434\u0430\u0442\u0447\u0438\u043a \u0432\u0435\u0449\u0430\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u0430\u0436\u0434\u044b\u0435 100\u043c\u0441.<\/p>\n<pre><code class=\"java\">DeviceScanner() {    _subscribeToScanEvents();    _timer = new Timer.periodic(const Duration(seconds: 10), startScan);  }  void startScan(Timer timer) {    FlutterBlue.instance.startScan(timeout: Duration(seconds: 2)); } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0441\u044b\u043b\u043a\u0443, \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<pre><code class=\"java\">   void _subscribeToScanEvents() {     FlutterBlue.instance.scanResults.listen((scanResults) {       for (ScanResult scanResult in scanResults) {         if (scanResult.device.name.toString() == &quot;nrf52840.ru&quot;) {           final int rssi = scanResult.rssi;           final String name = scanResult.device.name;           final String mac = scanResult.device.id.toString();           final double temp = scanResult.advertisementData.manufacturerData[256]                   [0] +               scanResult.advertisementData.manufacturerData[256][1] * 0.01;           final double humm = scanResult.advertisementData.manufacturerData[256]                   [2] +               scanResult.advertisementData.manufacturerData[256][3] * 0.01;           final double press =               scanResult.advertisementData.manufacturerData[256][4] +                   scanResult.advertisementData.manufacturerData[256][5] * 0.01;           final SensorData sensorData = new SensorData(               name: name,               rssi: rssi,               mac: mac,               temperature: temp,               humidity: humm,               pressure: press);           _streamController.add(sensorData);           print(               'Manufacturer data ${scanResult.advertisementData.manufacturerData}');           FlutterBlue.instance.stopScan();         }          print(             '${scanResult.device.name} found! mac: ${scanResult.device.id} rssi: ${scanResult.rssi}');       }     });   } <\/code><\/pre>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u044e\u0430\u043d\u0441. Bluetooth \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f Flutter \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0439, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 int, \u0430 \u0432 \u0430\u0440\u0434\u0443\u0438\u043d\u043e \u043c\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u043a\u0443 \u0438\u0437 \u0431\u0430\u0439\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0435\u043d\u0441\u043e\u0440\u0435 \u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u0441\u044b\u043b\u043a\u0443 \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u0430\u043d\u0430\u043b\u0438\u0437. \u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 25.85 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 25 \u0438 85, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 byte \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e. <\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/27\/6z\/on\/276zonw0i_fms8koszpnnrqwifs.jpeg\"><\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441 <a href=\"https:\/\/github.com\/lmahmutov\/arduino_ble_sensor\" rel=\"nofollow\">Github<\/a>.<\/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=\"https:\/\/habr.com\/ru\/post\/492404\/\"> https:\/\/habr.com\/ru\/post\/492404\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/492404\/\">\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e bluetooth \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044e (\u043a\u0443\u0434\u0430 \u0443\u0436 \u0431\u0435\u0437 \u043d\u0435\u0435 \ud83d\ude42 ) \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Flutter \u0434\u043b\u044f \u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ep\/ad\/j7\/epadj7tyxlocbup948zmgsyafdc.jpeg\">  <\/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-300160","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300160","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=300160"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300160\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}