﻿{"id":848,"date":"2021-11-03T16:05:23","date_gmt":"2021-11-03T13:05:23","guid":{"rendered":"http:\/\/allchina.a-lisa.org\/?p=848"},"modified":"2022-12-31T21:05:35","modified_gmt":"2022-12-31T18:05:35","slug":"micropython-%d0%bd%d0%b0-gsmgps-%d0%bc%d0%be%d0%b4%d1%83%d0%bb%d0%b5-a9g","status":"publish","type":"post","link":"https:\/\/allchina.a-lisa.org\/?p=848","title":{"rendered":"Micropython \u043d\u0430 GSM+GPS \u043c\u043e\u0434\u0443\u043b\u0435 A9G"},"content":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 GPS-\u0442\u0440\u044d\u043a\u0435\u0440 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041d\u0430 \u0440\u044b\u043d\u043a\u0435 \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0434\u043b\u044f \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f\u043c\u0438, \u0433\u0440\u0443\u0437\u043e\u043c, \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430\u043c\u0438, \u0431\u0430\u0433\u0430\u0436\u043e\u043c, \u0434\u0435\u0442\u044c\u043c\u0438 \u0438 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u043c\u0438. \u041f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0421\u041c\u0421. \u0411\u043e\u043b\u0435\u0435 \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Find my phone, \u043d\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441\u0443.<br \/>\n\u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0442\u0440\u0435\u043a\u0435\u0440\u043e\u043c: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0431\u0435\u0437 \u0421\u041c\u0421 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u041f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u0435\u043b\u043e \u043c\u0435\u043d\u044f \u043d\u0430 \u043f\u0430\u0440\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438\u0437 \u043f\u043e\u0434\u043d\u0435\u0431\u0435\u0441\u043d\u043e\u0439, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445, A9G pudding board, \u044f \u0438 \u0437\u0430\u043a\u0430\u0437\u0430\u043b (~15$).<\/p>\n<p><!--more--><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/f7f\/b34\/fe0\/f7fb34fe016bb3a6c532712b9b2e75e1.png\" alt=\"\u041c\u043e\u0434\u0443\u043b\u044c\" \/><\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c python \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 A9G \u2014 \u0430\u043d\u0430\u043b\u043e\u0433 ESP (\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c, \u043a\u0441\u0442\u0430\u0442\u0438, \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435), \u0442\u043e \u0441\u0430\u043c pudding board \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u043c \u043f\u043b\u0430\u0442\u044b NodeMCU \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430 pudding board \u043d\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u0430 USB-UART. \u0417\u0430\u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e. \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442 <a href=\"https:\/\/github.com\/Ai-Thinker-Open\/GPRS_C_SDK\/blob\/master\/README_EN.md\">\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/a>:<\/p>\n<ul>\n<li>\u044f\u0434\u0440\u043e 32 bit (RISC), \u0434\u043e 312MHz<\/li>\n<li>29x GPIO (\u0432\u0441\u0435 \u0440\u0430\u0441\u043f\u0430\u044f\u043d\u044b, \u0432 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432\u0441\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b)<\/li>\n<li>\u0447\u0430\u0441\u044b \u0438 watchdog<\/li>\n<li>1x \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 USB 1.1 (\u044f \u0435\u0433\u043e \u0442\u0430\u043c \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u044e \u0441 \u043e\u0444\u0441\u0430\u0439\u0442\u0430) \u0438 microUSB \u0434\u043b\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f<\/li>\n<li>2x UART (+1 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439)<\/li>\n<li>2x SPI (\u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b)<\/li>\n<li>3x I2C (\u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b)<\/li>\n<li>1x SDMMC (\u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u043b\u043e\u0442\u043e\u043c)<\/li>\n<li>2x \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u0430 (10 \u0431\u0438\u0442, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043b\u0438\u0442\u0438\u0435\u0432\u044b\u0445 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432)<\/li>\n<li>4Mb flash<\/li>\n<li>4Mb PSRAM<\/li>\n<li>ADC (\u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d, \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430 \u043f\u043b\u0430\u0442\u0435) \u0438 DAC (\u0434\u0438\u043d\u0430\u043c\u0438\u043a, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442)<\/li>\n<li>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0437\u0430\u0440\u044f\u0434\u0430 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 (\u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u043d\u0435\u0442)<\/li>\n<li>\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, GSM (800, 900, 1800, 1900 MHz) \u0441 SMS, \u0433\u043e\u043b\u043e\u0441\u043e\u043c \u0438 GPRS<\/li>\n<li>GPS, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 UART2 (\u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c &#171;A9&#187; \u0431\u0435\u0437 \u043d\u0435\u0433\u043e)<\/li>\n<li>\u0441\u043b\u043e\u0442 \u0434\u043b\u044f SIM (nanoSIM)<\/li>\n<li>\u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 (\u043e\u0434\u043d\u0430 reset, \u0434\u0440\u0443\u0433\u0430\u044f \u2014 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f)<\/li>\n<li>\u0434\u0432\u0430 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430<\/li>\n<\/ul>\n<p>\u0420\u0430\u0431\u043e\u0447\u0435\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 3.3\u0412, \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u2014 5-3.8\u0412 (\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f). \u0412\u043e\u043e\u0431\u0449\u0435, \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0436\u0435\u043b\u0435\u0437\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043d\u043e\u043f\u043e\u0447\u043d\u044b\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442. \u041d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043a\u0438\u0442\u0430\u0439\u0446\u044b \u0435\u0433\u043e \u043f\u043e\u043a\u0443\u043f\u0430\u044e\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u0438\u0437 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u0432 \u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u0432 \u0441 \u0430\u0437\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0438\u0433\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 SIM800, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435\u0442 SDK \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 (\u0442.\u0435. \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u0440\u043e\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a AT \u043c\u043e\u0434\u0435\u043c\u044b).<\/p>\n<h1>SDK<\/h1>\n<p>\u041a \u043c\u043e\u0434\u0443\u043b\u044e \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Ai-Thinker-Open\/GPRS_C_SDK\">SDK<\/a> \u043d\u0430 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 Ubuntu, \u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f Windows \u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0442\u044b\u043a\u0430\u043d\u0438\u0435 \u0432 GUI: ESPtool \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0442\u044c. \u0421\u0430\u043c\u0430 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f Makefile-\u043e\u043c. \u0414\u0435\u0431\u0430\u0433\u0433\u0435\u0440 \u043d\u0430\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443\u0435\u0442: \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u043d\u0443\u0442\u044c, \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442 stack trace \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043f\u043e\u0440\u0442. \u041d\u043e \u043b\u0438\u0447\u043d\u043e \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430 (gdb \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0438\u0447\u0435\u043c\u0443 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442). \u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 Linux \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0433\u043e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434 Windows (\u0438 \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 github). \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0442 <a href=\"https:\/\/ai-thinker-open.github.io\/GPRS_C_SDK_DOC\/en\/c-sdk\/installation_linux.html\">\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f<\/a> \u0434\u043b\u044f Linux. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0435\u0439 \u0432 .bashrc \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c (\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c) \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b <code>CSDTK\/lib\/libQt*<\/code>: \u0438\u043d\u0430\u0447\u0435, \u043f\u0440\u043e\u0448\u0438\u0432\u0430\u043b\u044c\u0449\u0438\u043a (\u043e\u043d \u0436\u0435 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440) \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430 \u0441, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c libQt.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/7a7\/955\/5bc\/7a79555bca02e1ad6363b8da9559c91e.png\" alt=\"\u041f\u0440\u043e\u0448\u0438\u0432\u0430\u043b\u044c\u0449\u0438\u043a\" \/><\/p>\n<p>\u041a \u043f\u0440\u043e\u0448\u0438\u0432\u0430\u043b\u044c\u0449\u0438\u043a\u0443 \u0438\u0434\u0451\u0442 <a href=\"https:\/\/ai-thinker-open.github.io\/GPRS_C_SDK_DOC\/en\/c-sdk\/burn-debug.html\">\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f<\/a>.<\/p>\n<h1>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c, \u043d\u0430 NodeMCU. \u041c\u043e\u0434\u0443\u043b\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u0445\u043e\u0436\u0435, \u043d\u043e \u043d\u0430 pudding board \u043d\u0435\u0442 USB-TTY \u0447\u0438\u043f\u0430 \u0438 microUSB \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f USB-TTY \u043d\u0430 3.3V. \u0410 \u043b\u0443\u0447\u0448\u0435 \u2014 \u0434\u0432\u0430: \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433 \u043f\u043e\u0440\u0442\u0430 \u0438 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0434\u043b\u044f UART1: \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0430\u0449\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u043e\u043f\u043b\u0438 \u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b USB \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u0438\u0442\u0435\u043b\u044c \u043d\u0430 4 \u043f\u043e\u0440\u0442\u0430 \u0441 \u0434\u0432\u0443\u0445\u043c\u0435\u0442\u0440\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u043e\u043c \u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0431\u043b\u043e\u043a\u043e\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u044f (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d). \u0421\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 25-30$ (\u0431\u0435\u0437 \u0431\u043b\u043e\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430).<\/p>\n<h1>\u041f\u0440\u043e\u0448\u0438\u0432\u043a\u0430<\/h1>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441 AT \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u043e\u0439: \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a 3.3\u0412 \u0430\u0440\u0434\u0443\u0438\u043d\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u043e\u0434\u0435\u043c\u0430 \u0447\u0435\u0440\u0435\u0437 UART1. \u0421\u0432\u043e\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043d\u0430 C. <code>make<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438: \u043e\u0434\u0438\u043d \u0448\u044c\u0451\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e \u043c\u0438\u043d\u0443\u0442\u044b, \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e. \u0428\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432: \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u044b \u2014 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439. \u0421\u0443\u043c\u043c\u0430\u0440\u043d\u043e, \u0443 \u043c\u0435\u043d\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0430 \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0430\u044f SDK (<code>coolwatcher<\/code>) \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c, miniterm \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 stdio \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043a\u043e\u0434\u0430.<\/p>\n<h1>API<\/h1>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 <a href=\"https:\/\/ai-thinker-open.github.io\/GPRS_C_SDK_DOC\/en\/\">API<\/a> \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0432\u0435\u0440\u0445\u0443 \u0438 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 ESP8266 \u0432 \u0441\u0432\u043e\u0438 \u0440\u0430\u043d\u043d\u0438\u0435 \u0434\u043d\u0438: \u0443 \u043c\u0435\u043d\u044f \u0443\u0448\u043b\u043e \u0447\u0430\u0441\u0430 3 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c HelloWorld. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d: \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0435 \u043d\u0430 SIM-\u043a\u0430\u0440\u0442\u0435, \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u043e\u0442\u043e\u0432\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0447\u0435\u0435. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e API \u0435\u0449\u0451 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043b\u043d\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b (\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0432\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u0430) \u0438 include-\u0444\u0430\u0439\u043b\u044b. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u0435 \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e SSL-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439: \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445.<\/p>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u043e\u0433\u043e API \u043d\u0430\u0434\u043e \u043b\u044e\u0431\u0438\u0442\u044c. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c <a href=\"https:\/\/github.com\/Neutree\/micropython\/\">\u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/a> <a href=\"https:\/\/micropython.org\/\">micropython<\/a> \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c. \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 open-source \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u0431\u0440\u043e\u0435 \u0434\u0435\u043b\u043e (\u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438).<\/p>\n<h1>micropython<\/h1>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/9a1\/b46\/e00\/9a1b46e00d290db2f478ebb54f7d9e74.jpg\" alt=\"logo\" \/><\/p>\n<p>Micropython \u2014 \u044d\u0442\u043e open-source \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 cPython \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u041f\u0435\u0440\u0432\u043e\u0435 \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043e\u0431\u0449\u0438\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 core-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 python: \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043b\u0430\u0441\u0441\u044b, \u0441\u0442\u0440\u043e\u043a\u0438, \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438 \u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0447\u0435\u0435. \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u044d\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0440\u0442\u044b: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e &#171;\u043d\u0430\u0443\u0447\u0438\u0442\u044c&#187; \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 UART \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430, \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u044d\u043a \u043f\u043e\u0434 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443, \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439. \u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0436\u0435\u043b\u0435\u0437\u043e\u043c: GPIO, \u043f\u0438\u0442\u0430\u043d\u0438\u0435, \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c, \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430.<br \/>\n\u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043d\u0430 \u0447\u0438\u0441\u0442\u044b\u0445 \u0421 \u0441 \u043c\u0430\u043a\u0440\u043e\u0441\u0430\u043c\u0438: \u0443 micropython \u0435\u0441\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 ROM \u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u044d\u0442\u043e\u043c\u0443, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435 (\u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043e\u0431 \u043e\u0431\u044a\u0451\u043c\u0435 \u043f\u0430\u043c\u044f\u0442\u0438). \u041a\u0443\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u0442\u0430\u0432\u044f\u0442 \u0446\u0435\u043b\u044c\u044e <a href=\"https:\/\/github.com\/micropython\/micropython\/wiki\/ContributorGuidelines\">\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0436\u0430\u043d\u0433\u0443<\/a> (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u0431\u0443\u0445\u0430\u043d\u043a\u043e\u0439 \u0445\u043b\u0435\u0431\u0430). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u043a\u043b\u0430\u043c\u044b: \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u043e\u0434\u0430\u0451\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 <a href=\"https:\/\/store.micropython.org\/\">pyboard<\/a>, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 ESP8266 \u0438 ESP32.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u0430 \u0438 \u0437\u0430\u043b\u0438\u0442\u0430 \u2014 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435\u0441\u044c \u043a \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 UART \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442\u0435 \u0432 \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u0438\u0439 REPL.<\/p>\n<pre><code>$ miniterm.py \/dev\/ttyUSB1 115200 --raw MicroPython cd2f742 on 2017-11-29; unicorn with Cortex-M3 Type \"help()\" for more information. &gt;&gt;&gt; print(\"hello\") hello<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c <a href=\"https:\/\/github.com\/micropython\/micropython\/wiki\/Differences\">\u043d\u0430 \u043f\u043e\u0447\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c python3<\/a>, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043e\u0431 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c A9G \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e (\u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <code>micropython\/ports<\/code>, \u0438\u0445 \u043e\u043a\u043e\u043b\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430). \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0436\u0435\u043b\u0435\u0437\u0430 \u0444\u043e\u0440\u043a\u043d\u0443\u043b micropython \u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u0440\u0442\u0430 A9G: <a href=\"https:\/\/github.com\/Neutree\/micropython\/tree\/master\/ports\/gprs_a9\"><code>micropython\/ports\/gprs_a9<\/code><\/a>, \u0437\u0430 \u0447\u0442\u043e \u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043f\u043e\u0440\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043c\u0435\u043d\u044f REPL. \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 GPIO: \u043d\u0438\u0447\u0435\u0433\u043e, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e \u0438 GPS \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435 \u0431\u044b\u043b\u043e. \u042f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u0435\u0431\u0435 \u0446\u0435\u043b\u044c \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f GPS-\u0442\u0440\u0435\u043a\u0435\u0440\u0430. <a href=\"https:\/\/micropython-dev-docs.readthedocs.io\/en\/latest\/adding-module.html\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0438\u0437\u043b\u0438\u0448\u043d\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430: \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<h2>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0438\u0434\u0451\u043c \u0432 <code>micropython\/ports<\/code> \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>micropython\/ports\/minimal<\/code> \u0432 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0440\u0442. \u0417\u0430\u0442\u0435\u043c, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c <code>main.c<\/code> \u043f\u043e\u0434 \u0432\u0430\u0448\u0443 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443. \u0418\u043c\u0435\u0439\u0442\u0435 \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0432\u0441\u044f \u0432\u043a\u0443\u0441\u043d\u044f\u0442\u0438\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main<\/code>, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 <code>mp_init()<\/code>, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0432 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438 \u0441\u0442\u044d\u043a. \u041f\u043e\u0442\u043e\u043c, \u0434\u043b\u044f event-driven API, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>pyexec_event_repl_init()<\/code> \u0438 \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 UART \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>pyexec_event_repl_process_char(char)<\/code>. \u042d\u0442\u043e \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 REPL. \u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b \u2014 <code>micropython\/ports\/minimal\/uart_core.c<\/code> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432\u0432\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0432 UART. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f STM32 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043b\u0435\u043d\u044c \u0438\u0441\u043a\u0430\u0442\u044c.<\/p>\n<p><code>main.c<\/code><\/p>\n<pre><code>int main(int argc, char **argv) { int stack_dummy; stack_top = (char*)&amp;stack_dummy; #if MICROPY_ENABLE_GC gc_init(heap, heap + sizeof(heap)); #endif mp_init(); #if MICROPY_ENABLE_COMPILER #if MICROPY_REPL_EVENT_DRIVEN pyexec_event_repl_init(); for (;;) { int c = mp_hal_stdin_rx_chr(); if (pyexec_event_repl_process_char(c)) { break; } } #else pyexec_friendly_repl(); #endif \/\/do_str(\"print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\", MP_PARSE_SINGLE_INPUT); \/\/do_str(\"for i in range(10):\\r\\n print(i)\", MP_PARSE_FILE_INPUT); #else pyexec_frozen_module(\"frozentest.py\"); #endif mp_deinit(); return 0; }<\/code><\/pre>\n<p><code>uart_core.c<\/code><\/p>\n<pre><code>\/\/ Receive single character int mp_hal_stdin_rx_chr(void) { unsigned char c = 0; #if MICROPY_MIN_USE_STDOUT int r = read(0, &amp;c, 1); (void)r; #elif MICROPY_MIN_USE_STM32_MCU \/\/ wait for RXNE while ((USART1-&gt;SR &amp; (1 &lt;&lt; 5)) == 0) { } c = USART1-&gt;DR; #endif return c; } \/\/ Send string of given length void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { #if MICROPY_MIN_USE_STDOUT int r = write(1, str, len); (void)r; #elif MICROPY_MIN_USE_STM32_MCU while (len--) { \/\/ wait for TXE while ((USART1-&gt;SR &amp; (1 &lt;&lt; 7)) == 0) { } USART1-&gt;DR = *str++; } #endif }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c Makefile \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \/ \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f: \u0442\u0443\u0442 \u0432\u0441\u0451 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \u0412\u0441\u0451, \u044d\u0442\u043e\u0433\u043e \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c: \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c, \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u0438 \u0432\u0438\u0434\u0438\u043c REPL \u0432 UART.<br \/>\n\u041f\u043e\u0441\u043b\u0435 \u043e\u0436\u0438\u0432\u043b\u0435\u043d\u0438\u044f <code>micropython<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043c \u0441\u0430\u043c\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0438: \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043d\u0430 Ctrl-D (soft reset) \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f: \u0441\u043c. \u0444\u0430\u0439\u043b <code>mpconfigport.h<\/code>.<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u043e\u0434\u0443\u043b\u044c<\/h2>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0418\u0442\u0430\u043a, \u043c\u043e\u0434\u0443\u043b\u044c (\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <code>mod[\u0438\u043c\u044f].c<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Makefile<\/code> (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>SRC_C<\/code> \u0435\u0441\u043b\u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u043d\u0446\u0438\u0438). \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>\/\/ nlr - non-local return: \u0432 C \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043d\u0435\u0442, \u0438 \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f goto-\u043c\u0430\u0433\u0438\u044f \u0438 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440. \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f nlr_raise \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0442\u043e\u0447\u043a\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u043f\u043e \u0441\u0442\u044d\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a. #include \"py\/nlr.h\" \/\/ \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 mp_map_elem_t, \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c. #include \"py\/obj.h\" \/\/ \u0412\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u043e\u043c. mp_raise_ValueError(char* msg) \u0438 mp_raise_OSError(int errorcode) \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c. \/\/ \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 mp_call_function_* \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u0438\u0445 Callable (\u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f callback-\u043b\u043e\u0433\u0438\u043a\u0438). #include \"py\/runtime.h\" #include \"py\/binary.h\" \/\/ \u041e\u0431\u0449\u0438\u0439 header \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439: \u0442\u0443\u0442 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u0442\u0435 \u0442\u0430\u043a \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0439\u0442\u0435 #include \"portmodules.h\" \/\/ \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0441\u0435\u0445-\u0432\u0441\u0435\u0445-\u0432\u0441\u0435\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044f. \u0418\u043c\u0435\u043d\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u043a\u0440\u043e\u0441 MP_QSTR_[\u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430]. MP_OBJ_NEW_QSTR \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u0443\u044e \u043e\u0431\u0435\u0440\u0442\u043a\u0443. \/\/ \u0412 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043c\u0430\u043a\u0440\u043e\u0441\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 RAM. \/\/ \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 - \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u043b\u0435 __name__ STATIC const mp_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, }; \/\/ \u041f\u0438\u0442\u043e\u043d\u0441\u043a\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441\u0432\u0435\u0440\u0445\u0443 STATIC MP_DEFINE_CONST_DICT (mp_module_mymodule_globals, mymodule_globals_table); \/\/ \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f: \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0441\u0432\u0435\u0440\u0445\u0443 const mp_obj_module_t mp_module_mymodule = { .base = { &amp;mp_type_module }, .globals = (mp_obj_dict_t*)&amp;mp_module_mymodule_globals, };<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u0440\u0442 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u0442 \u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 <code>mp_module_mymodule<\/code>: \u0435\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>MICROPY_PORT_BUILTIN_MODULES<\/code> \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u043e\u0440\u0442\u0430 <code>mpconfigport.h<\/code>. \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435\u0441\u043a\u0443\u0447\u043d\u044b\u0435 \u043e\u0431\u043e\u0438 \u0438\u043c\u044f \u0447\u0438\u043f\u0430 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u0430 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u0436\u0435 \u0442\u0430\u043c. \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437 REPL. \u0423 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>__name__<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044f (\u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 REPL \u0447\u0435\u0440\u0435\u0437 Tab).<\/p>\n<pre><code>&gt;&gt;&gt; import mymodule &gt;&gt;&gt; mymodule.__name__ 'mymodule'<\/code><\/pre>\n<h2>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/h2>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a (<code>INPUT<\/code>, <code>OUTPUT<\/code>, <code>HIGH<\/code>, <code>LOW<\/code> \u0438 \u0442.\u043f.) \u0422\u0443\u0442 \u0432\u0441\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u043e\u0442, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <code>magic_number = 10<\/code>:<\/p>\n<pre><code>STATIC const mp_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, { MP_OBJ_NEW_QSTR(MP_QSTR_magic_number), MP_OBJ_NEW_SMALL_INT(10) }, };<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c:<\/p>\n<pre><code>&gt;&gt;&gt; import mymodule &gt;&gt;&gt; mymodule.magic_number 10<\/code><\/pre>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443: \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c, \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438).<\/p>\n<pre><code>\/\/ \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c STATIC mp_obj_t conditional_add_one(mp_obj_t value) { \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0446\u0435\u043b\u043e\u0435 int. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 - \u043d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c: \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. int value_int = mp_obj_get_int(value); value_int ++; if (value_int == 10) { \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0442 None return mp_const_none; } \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u043e\u0433\u043e int return mp_obj_new_int(value); } \/\/ \u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0414\u043b\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \/\/ runtime.h \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. STATIC MP_DEFINE_CONST_FUN_OBJ_1(conditional_add_one_obj, conditional_add_one); \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c STATIC const mp_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, { MP_OBJ_NEW_QSTR(MP_QSTR_magic_number), MP_OBJ_NEW_SMALL_INT(10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_conditional_add_one), (mp_obj_t)&amp;conditional_add_one_obj }, };<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442\u0438\u043c:<\/p>\n<pre><code>&gt;&gt;&gt; import mymodule &gt;&gt;&gt; mymodule.conditional_add_one(3) 4 &gt;&gt;&gt; mymodule.conditional_add_one(9) &gt;&gt;&gt; <\/code><\/pre>\n<h2>\u041a\u043b\u0430\u0441\u0441\u044b (\u0442\u0438\u043f\u044b)<\/h2>\n<p>\u0421 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 (\u0442\u0438\u043f\u0430\u043c\u0438) \u0432\u0441\u0451 \u0442\u043e\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u043d\u0443 \u043f\u043e\u0447\u0442\u0438):<\/p>\n<pre><code>\/\/ \u041f\u0443\u0441\u0442\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 STATIC const mp_map_elem_t mymodule_hello_locals_dict_table[] = {}; \/\/ \u0421\u043b\u043e\u0432\u0430\u0440\u043d\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430 STATIC MP_DEFINE_CONST_DICT(mymodule_hello_locals_dict, mymodule_hello_locals_dict_table); \/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0442\u0438\u043f\u043e\u043c const mp_obj_type_t mymodule_helloObj_type = { \/\/ \u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f { &amp;mp_type_type }, \/\/ \u0418\u043c\u044f: helloObj .name = MP_QSTR_helloObj, \/\/ \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b .locals_dict = (mp_obj_dict_t*)&amp;mymodule_hello_locals_dict, }; \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c STATIC const mp_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, { MP_OBJ_NEW_QSTR(MP_QSTR_magic_number), MP_OBJ_NEW_SMALL_INT(10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_conditional_add_one), (mp_obj_t)&amp;conditional_add_one_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_conditional_add_one), (mp_obj_t)&amp;mymodule_helloObj_type }, };<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442\u0438\u043c:<\/p>\n<pre><code>&gt;&gt;&gt; mymodule.helloObj &lt;type 'helloObj'&gt;<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0442\u0438\u043f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u0442 \u043d\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043d\u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f &#171;\u0440\u044f\u0434\u043e\u043c&#187; \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c: \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0438\u0442\u043e\u043d\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code>\/\/ \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0434-\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430. \u0414\u0430, \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u0430 typedef struct _mymodule_hello_obj_t { \/\/ \u041f\u0438\u0442\u043e\u043d\u0441\u043a\u0438\u0439 \u0442\u0438\u043f mp_obj_base_t base; \/\/ \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 uint8_t hello_number; } mymodule_hello_obj_t;<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438? \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u2014 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.<\/p>\n<pre><code>\/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0430\u044f \u0442\u0438\u043f (\u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 mymodule_helloObj_type \/\/ \u043f\u043e \u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0447\u0442\u043e \u0442\u0438\u043f \u0431\u044b\u043b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u0447\u0435\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (args \u0438 kwargs) \u0438 \/\/ \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435: args, kwargs STATIC mp_obj_t mymodule_hello_make_new( const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args ) { \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 mp_arg_check_num(n_args, n_kw, 1, 1, true); \/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 mymodule_hello_obj_t *self = m_new_obj(mymodule_hello_obj_t); \/\/ \u041f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e self-&gt;base.type = &amp;mymodule_hello_type; \/\/ \u041f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 self-&gt;hello_number = mp_obj_get_int(args[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">0<\/span>]) \/\/ \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 return MP_OBJ_FROM_PTR(self); \/\/ \u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 __init__, \u0432\u0438\u0434\u0438\u043c\u043e, \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 } \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0438\u0434\u0435\u0442\u044c \u0432 \u043f\u043e\u043b\u0435 make_new const mp_obj_type_t mymodule_helloObj_type = { { &amp;mp_type_type }, .name = MP_QSTR_helloObj, .locals_dict = (mp_obj_dict_t*)&amp;mymodule_hello_locals_dict, \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 .make_new = mymodule_hello_make_new, };<\/code><\/pre>\n<p>\u0418\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0435\u0441\u0442\u044c \u0435\u0449\u0451 <code>.print<\/code>, \u0438, \u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0432\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f <code>Python3<\/code>.<\/p>\n<p>\u041d\u043e <code>make_new<\/code> \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430: \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412\u043e\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 <code>micropython\/ports\/esp32\/modsocket.c<\/code>:<\/p>\n<pre><code>\/\/ \u0414\u0440\u0443\u0433\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b STATIC mp_obj_t get_socket(size_t n_args, const mp_obj_t *args) { socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t); sock-&gt;base.type = &amp;socket_type; sock-&gt;domain = AF_INET; sock-&gt;type = SOCK_STREAM; sock-&gt;proto = 0; sock-&gt;peer_closed = false; if (n_args &gt; 0) { sock-&gt;domain = mp_obj_get_int(args[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">0<\/span>]); if (n_args &gt; 1) { sock-&gt;type = mp_obj_get_int(args[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">1<\/span>]); if (n_args &gt; 2) { sock-&gt;proto = mp_obj_get_int(args[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">2<\/span>]); } } } sock-&gt;fd = lwip_socket(sock-&gt;domain, sock-&gt;type, sock-&gt;proto); if (sock-&gt;fd &lt; 0) { exception_from_errno(errno); } _socket_settimeout(sock, UINT64_MAX); return MP_OBJ_FROM_PTR(sock); } \/\/ \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 0-3 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(get_socket_obj, 0, 3, get_socket);<\/code><\/pre>\n<h2>\u041f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b (bound methods)<\/h2>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>\/\/ \u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u043d\u043e 1 (self) STATIC mp_obj_t mymodule_hello_increment(mp_obj_t self_in) { mymodule_hello_obj_t *self = MP_OBJ_TO_PTR(self_in); self-&gt;hello_number += 1; return mp_const_none; } \/\/ \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 MP_DEFINE_CONST_FUN_OBJ_1(mymodule_hello_increment_obj, mymodule_hello_increment); \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c 'inc' STATIC const mp_map_elem_t mymodule_hello_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_inc), (mp_obj_t)&amp;mymodule_hello_increment_obj }, }<\/code><\/pre>\n<p>\u0412\u0441\u0451!<\/p>\n<pre><code>&gt;&gt;&gt; x = mymodule.helloObj(12) &gt;&gt;&gt; x.inc()<\/code><\/pre>\n<h2>\u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b: <strong>getattr<\/strong>, <strong>setattr<\/strong><\/h2>\n<p>\u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435-\u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>@property<\/code> \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e <code>__getattr__<\/code>? \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430: \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432 \u043e\u0431\u0445\u043e\u0434 <code>mymodule_hello_locals_dict_table<\/code>.<\/p>\n<pre><code>\/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 ... STATIC void mymodule_hello_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { mymodule_hello_obj_t *self = MP_OBJ_TO_PTR(self_in); if (dest[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">0<\/span>] != MP_OBJ_NULL) { \/\/ __setattr__ if (attr == MP_QSTR_val) { self-&gt;val = dest[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">1<\/span>]; dest[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">0<\/span>] = MP_OBJ_NULL; } } else { \/\/ __getattr__ if (attr == MP_QSTR_val) { dest[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">0<\/span>] = self-&gt;val; } } } \/\/ ... \u0438\u0434\u0451\u0442 \u043f\u0440\u044f\u043c\u0438\u043a\u043e\u043c \u0432 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 attr const mp_obj_type_t mymodule_helloObj_type = { { &amp;mp_type_type }, .name = MP_QSTR_helloObj, \/\/ \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \/\/.locals_dict = (mp_obj_dict_t*)&amp;mymodule_hello_locals_dict, .make_new = mymodule_hello_make_new, \/\/ \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e - attr .attr = mymodule_hello_attr, }; <\/code><\/pre>\n<p>\u0427\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u044c\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 attr \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f, \u0441\u043a\u0430\u0436\u0435\u0442\u0435 \u0432\u044b. \u0413\u0434\u0435 \u0436\u0435 \u0432\u0441\u0435 \u044d\u0442\u0438 <code>mp_raise_AttributeError<\/code> (<em>\u043f\u0440\u0438\u043c<\/em>: \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442)? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, <code>AttributeError<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0421\u0435\u043a\u0440\u0435\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <code>dest<\/code> \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0432\u0443\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b &#171;\u0432\u044b\u0432\u043e\u0434\u0430&#187;, write-only: \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>MP_OBJ_SENTINEL<\/code> \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 <code>MP_OBJ_NULL<\/code> \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f <code>MP_OBJ_NULL<\/code> \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438 \u0447\u0442\u043e-\u0442\u043e <code>mp_obj_t<\/code> \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c. \u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u2014 &#171;\u0432\u0432\u043e\u0434&#187;, read-only: \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 <code>MP_OBJ_NULL<\/code>, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c. \u041c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0434\u043e.<\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c:<\/p>\n<pre><code>&gt;&gt;&gt; x = mymodule.helloObj(12) &gt;&gt;&gt; x.val = 3 &gt;&gt;&gt; x.val 3<\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u0422\u0430b \u0432 REPL \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 <code>.val<\/code>! \u042f, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432 C, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0433\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 (\u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;==&#8217;).<\/p>\n<h2>\u041f\u043e\u0440\u0442<\/h2>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u043c\u043e\u0434\u0443\u043b\u044e A9G, \u044f <a href=\"https:\/\/github.com\/pulkin\/micropython\/tree\/master\/ports\/gprs_a9\">\u043e\u043f\u0438\u0441\u0430\u043b<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, SMS, GPRS (usockets), GPS, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043b\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<pre><code>import cellular as c import usocket as sock import time import gps import machine # \u041e\u0436\u0438\u0434\u0430\u0435\u043c \u0441\u0435\u0442\u044c print(\"Waiting network registration ...\") while not c.is_network_registered(): time.sleep(1) time.sleep(2) # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c GPRS print(\"Activating ...\") c.gprs_activate(\"internet\", \"\", \"\") print(\"Local IP:\", sock.get_local_ip()) # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c GPS gps.on() # \u041e\u0442\u0434\u0430\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 thingspeak host = \"api.thingspeak.com\" api_key = \"some-api-key\" fields = ('latitude', 'longitude', 'battery', 'sat_visible', 'sat_tracked') # \u041a\u0430\u043a\u0430\u044f \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u0430 \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435! fields = dict(zip(fields, map(lambda x: \"field{}\".format(x+1), range(len(fields))) )) x, y = gps.get_location() level = machine.get_input_voltage()[<span style=\"transition: opacity 0.2s ease-in-out 0s, color 0.2s ease-in-out 0s, text-decoration 0.2s ease-in-out 0s, background-color 0.2s ease-in-out 0s, -webkit-text-decoration 0.2s ease-in-out 0s; color: #f5871f; quotes: '\u00ab' '\u00bb';\">1<\/span>] sats_vis, sats_tracked = gps.get_satellites() s = sock.socket() print(\"Connecting ...\") s.connect((host, 80)) print(\"Sending ...\") # \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0441\u043e\u043a\u0435\u0442\u044b \u043c\u0430\u043b\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 \u0441\u044b\u0440\u043e\u0439 HTTP. \u0412 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c \u043f\u0438\u0442\u043e\u043d\u0435 \u0434\u043b\u044f HTTP, SSL \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e print(\"Sent:\", s.send(\"GET \/update?api_key={}&amp;{latitude}={:f}&amp;{longitude}={:f}&amp;{battery}={:f}&amp;{sat_visible}={:d}&amp;{sat_tracked}={:d} HTTP\/1.1\\r\\nHost: {}\\r\\nConnection: close\\r\\n\\r\\n\".format( api_key, x, y, level, sats_vis, sats_tracked, host, **fields ))) print(\"Receiving ...\") print(\"Received:\", s.recv(128)) s.close()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 GPS-\u0442\u0440\u044d\u043a\u0435\u0440 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041d\u0430 \u0440\u044b\u043d\u043a\u0435 \u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[98],"tags":[],"class_list":["post-848","post","type-post","status-publish","format-standard","hentry","category-arduino"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7OYvE-dG","_links":{"self":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=848"}],"version-history":[{"count":1,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/848\/revisions"}],"predecessor-version":[{"id":892,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=\/wp\/v2\/posts\/848\/revisions\/892"}],"wp:attachment":[{"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/allchina.a-lisa.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}