{"id":301787,"date":"2020-04-13T21:00:19","date_gmt":"2020-04-13T21:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301787"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301787","title":{"rendered":"\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u043e\u0431\u043e\u0442 \u043d\u0430 \u041c\u041a esp8266 c micropython"},"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\/497062\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u043f\u0433\u0440\u0435\u0439\u0434\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/495576\/\">\u0441\u0430\u043c\u043e\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b <\/a>\u043d\u0430 \u0431\u0430\u0437\u0435 \u041c\u041a esp8266 \u0441 <a href=\"https:\/\/docs.micropython.org\/en\/latest\/\" rel=\"nofollow\">micropython<\/a>, \u0434\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430, \u043e\u0441\u043d\u0430\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u044b\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439, \u043c\u0438\u0433\u0430\u044e\u0449\u0438\u043c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c, \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u00ab\u0441\u0442\u0430\u0440\u0442\/\u0441\u0442\u043e\u043f\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u041a\u0414\u041f\u0412:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tn\/2c\/db\/tn2cdb5mt9newhvsac3lbwaeiai.jpeg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 web \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e wifi.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u2014 \u043e\u0441\u043d\u0430\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 \u0423\u0417 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c HC-SR04, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c: <br \/>  \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a \u0438 \u0441\u0435\u0440\u0432\u043e\u043c\u0430\u0448\u0438\u043d\u043a\u0443 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435, \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e <a href=\"https:\/\/www.freecadweb.org\/\" rel=\"nofollow\">FreeCAD<\/a>) \u0438 \u0438\u0437\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5v\/v6\/uv\/5vv6uvlamu1rrpqneqrvnr5jxny.jpeg\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/p5\/_y\/nk\/p5_ynknzy9p6kyuqdfsahvndlku.png\"><\/p>\n<p>  \u041f\u043e\u0442\u043e\u043c \u2014 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f:<br \/>  \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0445\u0435\u043c\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e <a href=\"https:\/\/fritzing.org\/home\/\" rel=\"nofollow\">Fritzing<\/a>) \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0446\u0438\u044e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0435\u0439:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ex\/b-\/yn\/exb-ynunffujcqaxrbqwjybm8_0.png\"><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u0437\u043b\u0435\u0442\u0435\u0442\u044c\u2026<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u043e\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0434\u043e \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f), \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"https:\/\/docs.micropython.org\/en\/latest\/library\/uasyncio.html\" rel=\"nofollow\">asyncio<\/a>. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 asyncio \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/484472\/#3\">\u044d\u0442\u043e\u0439<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/post\/337420\/\">\u044d\u0442\u043e\u0439<\/a> \u0441\u0442\u0430\u0442\u044c\u044f\u0445. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c(coroutine), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439:<\/p>\n<pre><code class=\"python\">import uasyncio as asyncio from machine import Pin  # onboard LED is connected to D0(GPIO16) syst_led =  Pin(16, Pin.OUT)  async def blink_led(led, interval_ms):     led_val = True     while True:         led_val = not(led_val)         led_state = led.value(int(led_val))         await asyncio.sleep_ms(interval_ms)  # define loop loop = asyncio.get_event_loop()  #create looped tasks loop.create_task(blink_led(syst_led, interval_ms=250))  # loop run forever loop.run_forever() <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e (\u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a).<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u043a\u0442\u043e\u0440\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435 callback \u043d\u0430 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 (\u043a\u043d\u043e\u043f\u043a\u0443), \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0443\u044e \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0443\u044e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<p>  <i>Callback \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438:<\/i><\/p>\n<pre><code class=\"python\">from machine import Pin  run_flag = False  # on\/off button button =  Pin(15, Pin.IN, Pin.PULL_UP) # connected to D8 (GPIO15)  # callback function for start\/stop button def callback(p):     global run_flag     run_flag = not(run_flag)     print('set run_flag', run_flag, p)  # create callback for button: button.irq(trigger=Pin.IRQ_FALLING, handler=callback) <\/code><\/pre>\n<p>  <i>\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u0438:<\/i><\/p>\n<pre><code class=\"python\">import uasyncio as asyncio from utime import sleep, sleep_us from machine import Pin, time_pulse_us  # HC-SR04 ultrasonic sensor connected to GPIO12(D6)-trigger and GPIO13(D7)-echo trig=Pin(12, Pin.OUT) echo=Pin(13, Pin.IN)  async def async_measure_range():     echo_timeout_us=500*2*30 # Timeout in microseconds to listen to echo pin.     trig.off() # Stabilize the sensor     sleep_us(5)     trig.on()     sleep_us(10) # Send a 10us pulse.     trig.off()     try:         pulse_time = time_pulse_us(echo, 1, echo_timeout_us)     except:         pass     dist = (pulse_time \/ 2) \/ 29.1     return dist <\/code><\/pre>\n<p>  <i>\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 (\u0441 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u0438):<\/i><\/p>\n<pre><code class=\"python\">import uasyncio as asyncio from machine import Pin, PWM  pos_actual = 75 dist_cm = 50  # servo SG90 connected to GPIO14(D5) p14 =  Pin(14, Pin.OUT) servo = PWM(p14, freq=50)  async def radar_scan(interval_ms):     pos_list = [45,75,105,75]     global pos_actual     global dist_cm     while True:         if run_flag:             for pos in pos_list:                 servo.duty(pos)                 await asyncio.sleep_ms(interval_ms)                 dist_cm = await async_measure_range()                 pos_actual = pos                 print('pos_actual = %s, dist_cm = %s' % (pos_actual, dist_cm)         elif not run_flag:             await asyncio.sleep(0) # do nothing  # define loop loop = asyncio.get_event_loop(  #create looped tasks loop.create_task(radar_scan(interval_ms=250))  # loop run forever loop.run_forever() <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441\u0435\u043d\u0441\u043e\u0440, \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u2014 <i>\u00ab\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u0438\u043a\u0430 \u2014 \u044d\u0442\u043e \u043d\u0430\u0443\u043a\u0430 \u043e \u043f\u043b\u043e\u0445\u0438\u0445 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u0445\u00bb<\/i>, \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043a\u0430\u0431\u0435\u043b\u044c \u043d\u0430\u0442\u044f\u0433\u0438\u0432\u0430\u043b\u0441\u044f \u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u0442\u0435\u0440\u044f\u043b\u0441\u044f.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">avoid_left = False avoid_right = False avoid_backward = False  async def make_decision(interval_ms, avoid_limit_cm):     global avoid_left     global avoid_right     global avoid_backward     while True:         if run_flag:             # make decision what to do             if pos_actual == 45 and dist_cm &lt; avoid_limit_cm :                 avoid_left = True                 if debug : print('avoid_left = %s' % avoid_left)             elif pos_actual == 45 and dist_cm &gt;= avoid_limit_cm :                 avoid_left = False                 if debug : print('avoid_left = %s' % avoid_left)             elif pos_actual == 75 and dist_cm &lt; avoid_limit_cm*1.25 :                 avoid_backward = True                 if debug : print('avoid_backward = %s' % avoid_backward)             elif pos_actual == 75 and dist_cm &gt;= avoid_limit_cm*1.25 :                 avoid_backward = False                 if debug : print('avoid_backward = %s' % avoid_backward)             elif pos_actual == 105 and dist_cm &lt; avoid_limit_cm :                 avoid_right = True                 if debug : print('avoid_right = %s' % avoid_right)             elif pos_actual == 105 and dist_cm &gt;= avoid_limit_cm :                 avoid_right = False                 if debug : print('avoid_right = %s' % avoid_right)             # for debuging             if debug : print('pos = %s, dist_cm = %s' % (pos_actual,dist_cm))               await asyncio.sleep_ms(interval_ms)         elif not run_flag:             await asyncio.sleep(0) # do nothing  #create looped tasks loop.create_task(make_decision(interval_ms=250, avoid_limit_cm=15)) <\/code><\/pre>\n<p>  \u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">from random import getrandbits  async def moving(interval_ms):     while True:         if run_flag:             # moving functions             if avoid_backward :                 print('avoid_backward = %s' % avoid_backward)                 await backward(interval_ms*2)                 if bool(getrandbits(1)) :                     await right_rotate(interval_ms+getrandbits(3)*100)                     await stop_all()                 else:                     await left_rotate(interval_ms+getrandbits(3)*100)                     await stop_all()             elif avoid_left :                 print('avoid_left = %s' % avoid_left)                 await left_turn(interval_ms)             elif avoid_right :                 print('avoid_right = %s' % avoid_right)                 await right_turn(interval_ms)             else:                 print('move_forward')                 await forward(interval_ms)                              await asyncio.sleep_ms(interval_ms)         elif not run_flag:             #stop all motors first             await stop_all()             await asyncio.sleep(0) # do nothing  #create looped tasks loop.create_task(moving(interval_ms=1000)) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0442\u043e\u0440\u0430\u043c\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># nodemcu pins from the motor shield p5 = Pin(5, Pin.OUT)  # connected to GPIO4(D1) p4 = Pin(4, Pin.OUT)  # connected to GPIO4(D2) revrs_L = Pin(0, Pin.OUT, value=0)  # connected to GPIO0(D3) revrs_R = Pin(2, Pin.OUT, value=0)  # connected to GPIO2(D4) , also connected to onboard wifi LED motor_L = PWM(p5, freq=1000, duty=0) motor_R = PWM(p4, freq=1000, duty=0) speed = 1023  #TODO: variable speed  async def stop_all():     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(0)  async def forward(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def backward(interval_ms):     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def right_rotate(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def left_rotate(interval_ms):     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def right_turn(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(0)     await asyncio.sleep_ms(interval_ms)  async def left_turn(interval_ms):     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"python\">async def blink_led(led, interval_ms):     led_val = True     while True:         if run_flag:             led_val = not(led_val)             led_state = led.value(int(led_val))             await asyncio.sleep_ms(interval_ms)         elif not run_flag:             await asyncio.sleep(0) # do nothing  #create looped tasks loop.create_task(blink_led(syst_led, interval_ms=250)) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u044d\u0442\u043e <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0432 \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import gc import uasyncio as asyncio from utime import sleep, sleep_us from machine import Pin, PWM, time_pulse_us from random import getrandbits  # nodemcu pins from the motor shield p5 = Pin(5, Pin.OUT)  # connected to GPIO4(D1) p4 = Pin(4, Pin.OUT)  # connected to GPIO4(D2) revrs_L = Pin(0, Pin.OUT, value=0)  # connected to GPIO0(D3) revrs_R = Pin(2, Pin.OUT, value=0)  # connected to GPIO2(D4) , also connected to onboard wifi LED motor_L = PWM(p5, freq=1000, duty=0) motor_R = PWM(p4, freq=1000, duty=0) speed = 1023  #TODO: variable speed  # servo SG90 connected to GPIO14(D5) p14 =  Pin(14, Pin.OUT) servo = PWM(p14, freq=50) # on\/off button button =  Pin(15, Pin.IN, Pin.PULL_UP) # connected to D8 (GPIO15) # onboard LED is connected to D0(GPIO16) syst_led =  Pin(16, Pin.OUT) # HC-SR04 ultrasonic sensor connected to GPIO12(D6)-trigger and GPIO13(D7)-echo trig=Pin(12, Pin.OUT) echo=Pin(13, Pin.IN)  #global flags and variables run_flag = False avoid_left = False avoid_right = False avoid_backward = False pos_actual = 75 dist_cm = 50 debug = False   # callback function for start\/stop button def callback(p):     global run_flag     run_flag = not(run_flag)     print('set run_flag', run_flag, p)  # sync fuctions def stop_all_sync():     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(0)      # async fuctions async def stop_all():     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(0)  async def forward(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def backward(interval_ms):     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def right_rotate(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def left_rotate(interval_ms):     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def right_turn(interval_ms):     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(0)     await asyncio.sleep_ms(interval_ms)  async def left_turn(interval_ms):     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(speed)     await asyncio.sleep_ms(interval_ms)  async def moving(interval_ms):     while True:         if run_flag:             # moving functions             if avoid_backward :                 print('avoid_backward = %s' % avoid_backward)                 await backward(interval_ms*2)                 if bool(getrandbits(1)) :                     await right_rotate(interval_ms+getrandbits(3)*100)                     await stop_all()                 else:                     await left_rotate(interval_ms+getrandbits(3)*100)                     await stop_all()             elif avoid_left :                 print('avoid_left = %s' % avoid_left)                 await left_turn(interval_ms)             elif avoid_right :                 print('avoid_right = %s' % avoid_right)                 await right_turn(interval_ms)             else:                 print('move_forward')                 await forward(interval_ms)                              await asyncio.sleep_ms(interval_ms)         elif not run_flag:             #stop all motors first             await stop_all()             await asyncio.sleep(0) # do nothing   async def blink_led(led, interval_ms):     led_val = True     while True:         if run_flag:             led_val = not(led_val)             led_state = led.value(int(led_val))             await asyncio.sleep_ms(interval_ms)         elif not run_flag:             await asyncio.sleep(0) # do nothing              async def async_measure_range():     echo_timeout_us=500*2*30 # Timeout in microseconds to listen to echo pin.     trig.off() # Stabilize the sensor     sleep_us(5)     trig.on()     sleep_us(10) # Send a 10us pulse.     trig.off()     try:         pulse_time = time_pulse_us(echo, 1, echo_timeout_us)     except:         pass     dist = (pulse_time \/ 2) \/ 29.1     return dist  async def make_decision(interval_ms, avoid_limit_cm):     global avoid_left     global avoid_right     global avoid_backward     while True:         if run_flag:             # make decision what to do             if pos_actual == 45 and dist_cm &lt; avoid_limit_cm :                 avoid_left = True                 if debug : print('avoid_left = %s' % avoid_left)             elif pos_actual == 45 and dist_cm &gt;= avoid_limit_cm :                 avoid_left = False                 if debug : print('avoid_left = %s' % avoid_left)             elif pos_actual == 75 and dist_cm &lt; avoid_limit_cm*1.25 :                 avoid_backward = True                 if debug : print('avoid_backward = %s' % avoid_backward)             elif pos_actual == 75 and dist_cm &gt;= avoid_limit_cm*1.25 :                 avoid_backward = False                 if debug : print('avoid_backward = %s' % avoid_backward)             elif pos_actual == 105 and dist_cm &lt; avoid_limit_cm :                 avoid_right = True                 if debug : print('avoid_right = %s' % avoid_right)             elif pos_actual == 105 and dist_cm &gt;= avoid_limit_cm :                 avoid_right = False                 if debug : print('avoid_right = %s' % avoid_right)             # for debuging             if debug : print('pos = %s, dist_cm = %s' % (pos_actual,dist_cm))               await asyncio.sleep_ms(interval_ms)         elif not run_flag:             await asyncio.sleep(0) # do nothing  async def radar_scan(interval_ms):     pos_list = [45,75,105,75]     global pos_actual     global dist_cm     while True:         if run_flag:             for pos in pos_list:                 servo.duty(pos)                 await asyncio.sleep_ms(interval_ms)                 dist_cm = await async_measure_range()                 pos_actual = pos         elif not run_flag:             await asyncio.sleep(0) # do nothing      #stop all motors first stop_all_sync()  # move servo to initial position print('Move sensor to initial position...') servo.duty(75) sleep(1) #wait 1s for servo reaching initial position print('Waiting for start button...')  #enable gc gc.enable()  # create callback fo button: button.irq(trigger=Pin.IRQ_FALLING, handler=callback)  # define loop loop = asyncio.get_event_loop()  #create looped tasks loop.create_task(blink_led(syst_led, interval_ms=250)) loop.create_task(radar_scan(interval_ms=250)) loop.create_task(make_decision(interval_ms=250, avoid_limit_cm=15)) loop.create_task(moving(interval_ms=1000))  # loop run forever loop.run_forever() <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435:  <\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.25%;\"><iframe src=\"https:\/\/www.youtube.com\/embed\/vPn3HYUs3cY?rel=0&amp;showinfo=1&amp;hl=en-US\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\" allow=\"encrypted-media; accelerometer; gyroscope; picture-in-picture\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 web-\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443\u2026<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"python\">async def web_page(request):     global auto_run_flag     motor_state=&quot;Stopped&quot;     if request.find('GET \/?forward') &gt; 0:         motor_state=&quot;Going Forward&quot;         auto_run_flag = False         forward_sync()     elif request.find('GET \/?left_rotate') &gt; 0:         motor_state=&quot;Rotate Left&quot;         auto_run_flag = False         left_rotate_sync()     elif request.find('GET \/?right_rotate') &gt; 0:         motor_state=&quot;Rotate Right&quot;         auto_run_flag = False         right_rotate_sync()     elif request.find('GET \/?left_turn') &gt; 0:         motor_state=&quot;Turn Left&quot;         auto_run_flag = False         left_turn_sync()     elif request.find('GET \/?right_turn') &gt; 0:         motor_state=&quot;Turn Right&quot;         auto_run_flag = False         right_turn_sync()     elif request.find('GET \/?backward') &gt; 0:         motor_state=&quot;Going Backward&quot;         auto_run_flag = False         backward_sync()     elif request.find('GET \/?stop') &gt; 0:         motor_state=&quot;Stopped&quot;         auto_run_flag = False         stop_all_sync()     elif request.find('GET \/?auto') &gt; 0:         auto_run_flag = not auto_run_flag         if  auto_run_flag :             motor_state=&quot;Autopilot&quot;         elif not auto_run_flag :              motor_state=&quot;Stopped&quot;              stop_all_sync()      html = &quot;&quot;&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;RoboTank WEB&lt;\/title&gt;      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;     &lt;link rel=&quot;icon&quot; href=&quot;data:,&quot;&gt; &lt;style&gt;     html{font-family: Helvetica; display:inline-block; margin: 0px auto; text-align: center;}     h1{color: #0F3376; padding: 2vh;}p{font-size: 1.5rem;}     .button{display: inline-block; background-color: #33c080; border: none;      border-radius: 4px; color: white; text-decoration: none; font-size: 30px; width:100%}     .button2{background-color: #4286f4; width:30%}     .button3{background-color: #eb2b10; width:35%}     .button4{background-color: #8386f4; width:44%}     &lt;\/style&gt;&lt;\/head&gt;     &lt;body&gt; &lt;h1&gt;RoboTank WEB&lt;\/h1&gt;      &lt;p&gt;Status : &lt;strong&gt;&quot;&quot;&quot; + motor_state + &quot;&quot;&quot;&lt;\/strong&gt;&lt;\/p&gt;     &lt;p&gt;&lt;a href='\/?forward'&gt;&lt;button class=&quot;button&quot;&gt;Forward&lt;\/button&gt;&lt;\/a&gt;&lt;\/p&gt;     &lt;p&gt;&lt;a href='\/?left_turn'&gt;&lt;button class=&quot;button button2&quot;&gt;LEFT&lt;\/button&gt;&lt;\/a&gt;     &lt;a href='\/?stop'&gt;&lt;button class=&quot;button button3&quot;&gt;STOP&lt;\/button&gt;&lt;\/a&gt;     &lt;a href='\/?right_turn'&gt;&lt;button class=&quot;button button2&quot;&gt;RIGHT&lt;\/button&gt;&lt;\/a&gt;     &lt;p&gt;&lt;a href='\/?backward'&gt;&lt;button class=&quot;button&quot;&gt;Backward&lt;\/button&gt;&lt;\/a&gt;&lt;\/p&gt;     &lt;p&gt;&lt;a href='\/?left_rotate'&gt;&lt;button class=&quot;button button4&quot;&gt;L-rotate&lt;\/button&gt;&lt;\/a&gt;     &lt;a href='\/?right_rotate'&gt;&lt;button class=&quot;button button4&quot;&gt;R-rotate&lt;\/button&gt;&lt;\/a&gt;&lt;\/p&gt;     &lt;p&gt;&lt;a href='\/?auto'&gt;&lt;button class=&quot;button button3&quot;&gt;AUTO&lt;\/button&gt;&lt;\/a&gt;&lt;\/p&gt;     &lt;\/body&gt;&lt;\/html&gt;&quot;&quot;&quot;     return html  async def web_handler(reader, writer):     try:         request = str(await reader.read(1024))         #print('request = %s' % request)         header = &quot;&quot;&quot;HTTP\/1.1 200 OK\\nContent-Type: text\/html\\nConnection: close\\n\\n&quot;&quot;&quot;         response = await web_page(request)         await writer.awrite(header)         await writer.awrite(response)         await writer.aclose()         print(&quot;Finished processing request&quot;)     except Exception as e:         print(e)      async def tcp_server(host, port):     server = await asyncio.start_server(web_handler, host, port)  #create looped tasks loop.create_task(tcp_server('0.0.0.0', 80)) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def stop_all_sync():     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(0)  def backward_sync():     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)  def forward_sync():     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)  def right_rotate_sync():     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(1)     motor_R.duty(speed)  def left_rotate_sync():     revrs_L.value(1)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(speed)      def right_turn_sync():     revrs_L.value(0)     motor_L.duty(speed)     revrs_R.value(0)     motor_R.duty(0)  def left_turn_sync():     revrs_L.value(0)     motor_L.duty(0)     revrs_R.value(0)     motor_R.duty(speed) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/a0\/mi\/t1\/a0mit1kzhbmnixb6vak2ii4qb8g.jpeg\"><\/p>\n<p>  \u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.25%;\"><iframe src=\"https:\/\/www.youtube.com\/embed\/mvn5cdsOeNc?rel=0&amp;showinfo=1&amp;hl=en-US\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\" allow=\"encrypted-media; accelerometer; gyroscope; picture-in-picture\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b <a href=\"https:\/\/github.com\/rmavrichev\/robotank\" rel=\"nofollow\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/a><\/p>\n<p>  \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f:<\/p>\n<p>  <a href=\"https:\/\/docs.micropython.org\/en\/latest\/library\/uasyncio.html\" rel=\"nofollow\">docs.micropython.org\/en\/latest\/library\/uasyncio.html<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/484446\/\">habr.com\/ru\/post\/484446<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/337420\/\">habr.com\/ru\/post\/337420<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/484472\/\">habr.com\/ru\/post\/484472<\/a><br \/>  <a href=\"https:\/\/github.com\/peterhinch\/micropython-async\/blob\/master\/TUTORIAL.md\" rel=\"nofollow\">github.com\/peterhinch\/micropython-async\/blob\/master\/TUTORIAL.md<\/a><br \/>  <a href=\"https:\/\/github.com\/rsc1975\/micropython-hcsr04\" rel=\"nofollow\">github.com\/rsc1975\/micropython-hcsr04<\/a><br \/>  <a href=\"https:\/\/medium.com\/@pgjones\/an-asyncio-socket-tutorial-5e6f3308b8b0\" rel=\"nofollow\">medium.com\/@pgjones\/an-asyncio-socket-tutorial-5e6f3308b8b0<\/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\/497062\/\"> https:\/\/habr.com\/ru\/post\/497062\/<\/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\/497062\/\">\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u043f\u0433\u0440\u0435\u0439\u0434\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/495576\/\">\u0441\u0430\u043c\u043e\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b <\/a>\u043d\u0430 \u0431\u0430\u0437\u0435 \u041c\u041a esp8266 \u0441 <a href=\"https:\/\/docs.micropython.org\/en\/latest\/\" rel=\"nofollow\">micropython<\/a>, \u0434\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430, \u043e\u0441\u043d\u0430\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0443\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u044b\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439, \u043c\u0438\u0433\u0430\u044e\u0449\u0438\u043c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c, \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u00ab\u0441\u0442\u0430\u0440\u0442\/\u0441\u0442\u043e\u043f\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u041a\u0414\u041f\u0412:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tn\/2c\/db\/tn2cdb5mt9newhvsac3lbwaeiai.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-301787","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301787","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=301787"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301787\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}