{"id":338384,"date":"2022-09-15T09:00:07","date_gmt":"2022-09-15T09:00:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338384"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338384","title":{"rendered":"<span>\u041f\u0430\u0442\u0442\u0435\u0440\u043d \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 .NET nanoFramework \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habrastorage.org\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\" alt=\".NET nanoFramework Weatherstation\" data-src=\"https:\/\/habrastorage.org\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\" data-blurred=\"true\"\/><\/a><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u043b\u043e\u043c\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u043c\u0438\u0440 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u0412 .NET \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 (Dependency injection, DI). \u0421\u0443\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043b\u0430\u0431\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0439, \u0431\u043e\u043b\u0435\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0439. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0438 \u0437\u0430\u043c\u0435\u043d\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/549012\/\">.NET nanoFramework<\/a> \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/584144\/\">ESP32<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d DI \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0435\u0433\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 LCD \u044d\u043a\u0440\u0430\u043d\u0430.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u041f\u0430\u0442\u0442\u0435\u0440\u043d \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h1>\n<p>  \u041f\u0430\u0442\u0442\u0435\u0440\u043d \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0412\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 ASP.NET. \u041d\u0430 \u0441\u0430\u043c\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u043c\u043d\u043e\u0433\u0438\u0435 .NET \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e <a href=\"https:\/\/metanit.com\/sharp\/aspnet5\/6.1.php\">\u0421\u0435\u0440\u0432\u0438\u0441\u044b \u0438 Dependency Injection<\/a> \u043d\u0430 metanit.<\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 DI \u0434\u043b\u044f <a href=\"https:\/\/habr.com\/ru\/post\/549012\/\">nanoFramework<\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 nuget-\u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/github.com\/nanoframework\/nanoFramework.DependencyInjection\">nanoFramework.DependencyInjection<\/a>. \u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 DI \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. API \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d \u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c\u0443 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/extensions\/dependency-injection\">.NET Dependency Injection<\/a>. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432 \u0432 .NET nanoFramework.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 DI \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:  <\/p>\n<ul>\n<li><strong>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (Object Composition)<\/strong> \u2014 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f;<\/li>\n<li><strong>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (Registering Services)<\/strong> \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <i>ServiceCollection<\/i> \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0436\u0438\u0437\u043d\u0438;<\/li>\n<li><strong>\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0443\u0441\u043b\u0443\u0433 (Service Provider)<\/strong> \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0443\u0441\u043b\u0443\u0433 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/li>\n<\/ul>\n<p>  DI \u0431\u044b\u043b \u0431\u044b \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u043c \u0431\u0435\u0437 <i>Generic Host<\/i> (\u043e\u0431\u0449\u0438\u0439 \u0445\u043e\u0441\u0442). \u0412 nanoFramework \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 nuget-\u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/github.com\/nanoframework\/nanoFramework.Hosting\">nanoFramework.Hosting<\/a>. <i>Generic Host<\/i> \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f DI, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 DI \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c. \u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f <i>Host<\/i>, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <i>Start()<\/i> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <i>IHostedService<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0445\u043e\u0441\u0442\u0430. \u0412 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <i>IHostedService<\/i>, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <i>BackgroundService<\/i> \u0438\u043b\u0438 <i>SchedulerService<\/i>, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <i>ExecuteAsync()<\/i>. API \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d \u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c\u0443 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/extensions\/generic-host\">.NET Generic Host.<\/a> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 DI.<\/p>\n<h1>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h1>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f DI, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044e. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u044d\u043a\u0440\u0430\u043d\u0430. \u0412\u0441\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<ul>\n<li>\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f;<\/li>\n<li>\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c;<\/li>\n<li>\u0414\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u044b. \u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 NTP-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0432 \u0441\u0435\u0442\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442.<\/p>\n<p>  \u041c\u0435\u0442\u0435\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:  <\/p>\n<ul>\n<li>\u041f\u043b\u0430\u0442\u0430 <a href=\"https:\/\/devdotnet.org\/post\/iot-platforma-esp32-devkit-v1-na-baze-mcu-esp-wroom-32\/\">ESP32 DevKit v1<\/a> \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 ESP-WROOM-32;<\/li>\n<li>\u0426\u0432\u0435\u0442\u043d\u043e\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 SSD1306 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0438 \u0432 \u043f\u043e\u0441\u0442\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/669700\/\">\u0427\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 .NET nanoFramework? \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c LCD \u044d\u043a\u0440\u0430\u043d, \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c Wi-Fi \u0441\u0435\u0442\u0438<\/a>;<\/li>\n<li>\u0414\u0430\u0442\u0447\u0438\u043a BME280 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0438 \u0432 \u043f\u043e\u0441\u0442\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/584144\/\">\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b ESP32 \u0438 STM32 \u043d\u0430 C# (nanoFramework)<\/a>;<\/li>\n<li>\u0415\u043c\u043a\u043e\u0441\u0442\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u043d\u0430 \u0431\u0430\u0437\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MPR121.<\/li>\n<\/ul>\n<p>  <strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/strong>  <\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63208e94014ea38d512a0cd9\" data-style=\"\" id=\"63208e94014ea38d512a0cd9\" width=\"\"><\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u0412\u0441\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0448\u0438\u043d\u0435 I2C. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d LCD SSD1306 c 7-pin \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0430\u043a\u0442 GPIO \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f 4-pin \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:  <\/p>\n<ul>\n<li>\u0414\u0430\u0442\u0447\u0438\u043a <a href=\"https:\/\/aliexpress.ru\/item\/32862421810.html\">BME280<\/a>, \u0448\u0438\u043d\u0430 I2C, \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b: 21-pin DATA, 22-pin CLOCK;<\/li>\n<li>\u042d\u043a\u0440\u0430\u043d <a href=\"https:\/\/aliexpress.ru\/item\/32638662748.html\">SSD1306<\/a> OLED \u0441 7-pin I2C\/SPI, \u0448\u0438\u043d\u0430 I2C, \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b: 21-pin DATA, 22-pin CLOCK, 18-pin RES \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438;<\/li>\n<li>\u0415\u043c\u043a\u043e\u0441\u0442\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u043d\u0430 \u0431\u0430\u0437\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 <a href=\"https:\/\/aliexpress.ru\/item\/32922795822.html\">MPR121<\/a>, \u0448\u0438\u043d\u0430 I2C, \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b: 21-pin DATA, 22-pin.<\/li>\n<\/ul>\n<p>  \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <a href=\"https:\/\/habrastorage.org\/webt\/g1\/qj\/ad\/g1qjad-qnkmpq35-7gd0dx047ck.png\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/g1\/qj\/ad\/g1qjad-qnkmpq35-7gd0dx047ck.png\" alt=\".NET nanoFramework Weatherstation\" data-src=\"https:\/\/habrastorage.org\/webt\/g1\/qj\/ad\/g1qjad-qnkmpq35-7gd0dx047ck.png\"\/><\/a><br \/>  <em>\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043a ESP32 DevKit v1 (<a href=\"https:\/\/github.com\/devdotnetorg\/Site\/tree\/master\/Uploads\/nf-esp32-di-weatherstation.fzz\">fzz<\/a>)<\/em><\/p>\n<h1>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0430\u0442\u0447\u0438\u043a \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439. \u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430 \u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432. \u0422\u0430\u043a \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b:  <\/p>\n<ul>\n<li><strong>ISensorsService<\/strong> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u044b;<\/li>\n<li><strong>IKeyboardService<\/strong> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u043d\u043e\u043f\u043a\u0438;<\/li>\n<li><strong>IDisplayService<\/strong> \u2014 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b<\/h3>\n<p>  <strong>ISensorsService<\/strong><\/p>\n<p>  \u0412 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <i>ISensorsService<\/i> \u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<pre><code class=\"cs\">public interface ISensorsService {   public SensorsResult GetSensorsResult(); }  public class SensorsResult {   public SensorsResult() { }   public SensorsResult(double temperature, double pressure, double humidity)   {     Temperature = temperature;     Pressure = pressure;     Humidity = humidity;   }   public double Temperature { get; }   public double Pressure { get; }   public double Humidity { get; } } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0436\u0435\u0441\u0442\u043a\u0430\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <strong>IKeyboardService<\/strong><\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <i>IKeyboardService<\/i> \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043a\u043d\u043e\u043f\u043a\u0438. \u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435\u0432\u0430\u0436\u043d\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043e\u0447\u043d\u0430\u044f \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0430\u044f \u043a \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430 <a href=\"https:\/\/www.dfrobot.com\/product-197.html\">Analog ADKeyboard Module.<\/a><\/p>\n<p>  <a href=\"https:\/\/habrastorage.org\/webt\/31\/cg\/fs\/31cgfsf3hcamyaokptol-lmvims.jpeg\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/31\/cg\/fs\/31cgfsf3hcamyaokptol-lmvims.jpeg\" alt=\".NET nanoFramework Weatherstation\" data-src=\"https:\/\/habrastorage.org\/webt\/31\/cg\/fs\/31cgfsf3hcamyaokptol-lmvims.jpeg\" data-blurred=\"true\"\/><\/a><br \/>  <em>\u041c\u043e\u0434\u0443\u043b\u044c Analog ADKeyboard Module<\/em><\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043a\u043d\u043e\u043f\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<pre><code class=\"cs\">public interface IKeyboardService {   public int ReadKey(); } <\/code><\/pre>\n<p>  <strong>IDisplayService<\/strong><br \/>  \u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f <i>IDisplayService<\/i> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">public interface IDisplayService {   public void Show(Screen screen, object obj); }  public enum Screen {   Clear_0,   DateTime_1,   TempHum_2,   Pressure_3, } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0430\u0442\u0447\u0438\u043a\u0438<\/h3>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 <a href=\"https:\/\/learn.adafruit.com\/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial\">Mpr121<\/a>. \u041a\u043b\u0430\u0441\u0441 <i>KeyboardSingleton<\/i> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 <i>IKeyboardService<\/i> \u0438 <i>IDisposable<\/i>. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>ReadKey()<\/i> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <i>IKeyboardService<\/i>.<\/p>\n<p>  \u0424\u0430\u0439\u043b <a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework-samples\/blob\/master\/nanoframework-esp32-di-weatherstation\/Services\/KeyboardSingleton.cs\">KeyboardSingleton.cs<\/a>:<\/p>\n<pre><code class=\"cs\">internal class KeyboardSingleton : IKeyboardService, IDisposable {   private const int busId = 1; \/\/ bus id on the MCU   private I2cDevice _i2cDevice;   private Mpr121 _mpr121;      public KeyboardSingleton()   {     this.InitMpr121();   }      private void InitMpr121()   {     Debug.WriteLine(\"Init InitMpr121!\");     I2cConnectionSettings i2cSettings = new(busId, Mpr121.DefaultI2cAddress);     _i2cDevice = I2cDevice.Create(i2cSettings);     _mpr121 = new Mpr121(_i2cDevice);   }    public int ReadKey()   {     bool[] channelStatuses = _mpr121.ReadChannelStatuses();     int key = -1;     for (int i = 0; i &lt; channelStatuses.Length; i++)     {       if (channelStatuses[i])       {         key = i;         break;       }     }     return key;   } } <\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u0438 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430 \u0442\u0430\u043a \u0436\u0435.<\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441\u044b IHostedService<\/h3>\n<p>  \u0421\u0435\u0440\u0432\u0438\u0441\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 <i>ServiceCollection()<\/i>. <i>Host builder<\/i> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b <i>Start()<\/i> \u0438 <i>Stop()<\/i> \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 <i>IHostedService<\/i> \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <i>ConfigureService()<\/i> \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 DI.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public class CustomService : IHostedService {   public void Start() { }    public void Stop() { } } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 MonitorService<\/h3>\n<p>  \u0412\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 <i>MonitorService<\/i>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  \u0424\u0430\u0439\u043b <a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework-samples\/blob\/master\/nanoframework-esp32-di-weatherstation\/Services\/MonitorService.cs\">MonitorService.cs<\/a>:<\/p>\n<pre><code class=\"cs\">internal class MonitorService : IHostedService {   private ISensorsService _sensorsService { get; }   private IDisplayService _displayService { get; set; }   private IKeyboardService _keyboardService { get; }   private Thread _handlerThread;   private CancellationTokenSource _cs;    public MonitorService(ISensorsService sensorsService, IDisplayService displayService, IKeyboardService keyboardService)   {     _sensorsService = sensorsService;     _displayService = displayService;     _keyboardService = keyboardService;   } <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <i>KeyboardSingleton<\/i> \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <i>IKeyboardService<\/i>. \u0421\u0430\u043c \u043a\u043b\u0430\u0441\u0441 <i>MonitorService<\/i> \u043d\u0435 \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0441\u043b\u0430\u0431\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <i>ISensorsService<\/i>, \u0438 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <i>IDisplayService<\/i>.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u0435\u0442\u043e\u0434 <i>Start()<\/i> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a, \u0432 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u0439.  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0430\u0439\u043b MonitorService.cs<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">public void Start() {   ...   _handlerThread = new Thread(() =>   {     while (!csToken.IsCancellationRequested)     {       \/\/sensors       sensorsResult = _sensorsService.GetSensorsResult();             \/\/key       key = _keyboardService.ReadKey();       switch (key)       {         case 8:           currentScreen = Screen.DateTime_1;           break;         ...       }       \/\/screen       switch (currentScreen)       {         case Screen.DateTime_1:           DateTime currentDateTime = DateTime.UtcNow + TimeSpan.FromHours(3); \/\/ +3 GMT           _displayService.Show(Screen.DateTime_1, currentDateTime);           break;         case Screen.TempHum_2:           _displayService.Show(Screen.TempHum_2, sensorsResult);           break;         ...       }       Thread.Sleep(500);     }   });   _handlerThread.Start(); } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432:<\/p>\n<pre><code class=\"cs\">sensorsResult = _sensorsService.GetSensorsResult();   <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<pre><code class=\"cs\">key = _keyboardService.ReadKey(); <\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0413\u0434\u0435 <i>Screen.DateTime_1<\/i> \u0438 <i>Screen.TempHum_2<\/i> \u0442\u0438\u043f \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f <i>object<\/i> \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">switch (currentScreen)       {         case Screen.DateTime_1:           DateTime currentDateTime = DateTime.UtcNow + TimeSpan.FromHours(3); \/\/ +3 GMT           _displayService.Show(Screen.DateTime_1, currentDateTime);           break;         case Screen.TempHum_2:           _displayService.Show(Screen.TempHum_2, sensorsResult);           break; ... <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <i>Stop()<\/i>.<\/p>\n<pre><code class=\"cs\">public void Stop() {   Debug.WriteLine(\"MonitorService stopped\");   _cs.Cancel();   Thread.Sleep(2000);   if (_handlerThread.ThreadState == ThreadState.Running) _handlerThread.Abort(); } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 <i>host builder<\/i>.<\/p>\n<h1>Generic Host<\/h1>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0445\u043e\u0441\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0445\u043e\u0441\u0442\u0430 (host builder), \u0432 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442.\u0435. \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f <i>ServiceProvider<\/i> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>Main()<\/i>, \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework-samples\/blob\/master\/nanoframework-esp32-di-weatherstation\/Program.cs\">Program.cs<\/a>:<\/p>\n<pre><code class=\"cs\">public static void Main() {   \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/   \/\/ when connecting to an ESP32 device, need to configure the I2C GPIOs   Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);   Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);   \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/               IHost host = CreateHostBuilder().Build();   \/\/ starts application and blocks the main calling thread    host.Run(); } <\/code><\/pre>\n<p>  \u0414\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 \u0448\u0438\u043d\u0435 I2C \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b 21-pin \u0438 22-pin.<\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0445\u043e\u0441\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <i>host<\/i> \u0438 \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <i>Run()<\/i>.<\/p>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>CreateHostBuilder()<\/i>:<\/p>\n<pre><code class=\"cs\">public static IHostBuilder CreateHostBuilder() => Host.CreateDefaultBuilder()   .ConfigureServices(services =>   {     \/\/Receiving data from sensors     services.AddSingleton(typeof(ISensorsService), typeof(SensorsSingleton));     \/\/Data output to the display     services.AddSingleton(typeof(IDisplayService), typeof(DisplaySingleton));     \/\/Keyboard     services.AddSingleton(typeof(IKeyboardService), typeof(KeyboardSingleton));     \/\/MonitorService     services.AddHostedService(typeof(MonitorService));     \/\/Connecting to WiFi and time synchronization     services.AddHostedService(typeof(ConnectionService));   }); <\/code><\/pre>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b <i>Singleton<\/i> \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u044e\u0442\u0441\u044f \u0438\u0437 <i>HostedService<\/i>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e Wi-Fi \u043a \u0441\u0435\u0442\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h1>\u041a\u043b\u0430\u0441\u0441\u044b BackgroundService \u0438 SchedulerService<\/h1>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b <i>SchedulerService<\/i> \u0438 <i>BackgroundService<\/i>, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 <i>IHostedService<\/i>.<\/p>\n<p>  <strong>\u041a\u043b\u0430\u0441\u0441 SchedulerService<\/strong><\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <a href=\"https:\/\/docs.nanoframework.net\/api\/System.Threading.Timer.html\">Timer<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <i>ExecuteAsync()<\/i>. \u0422\u0430\u0439\u043c\u0435\u0440 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <i>Stop()<\/i>.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 SchedulerService:<\/p>\n<pre><code class=\"cs\">public class DisplayService : SchedulerService {   \/\/ represents a timer control that involks ExecuteAsync at a    \/\/ specified interval of time repeatedly   public DisplayService() : base(TimeSpan.FromSeconds(1)) {}    protected override void ExecuteAsync(object state)   {      } } <\/code><\/pre>\n<p>  <strong>\u041a\u043b\u0430\u0441\u0441 BackgroundService<\/strong><\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0433\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <i>ExecuteAsync()<\/i>. \u0420\u0430\u0431\u043e\u0442\u0430 <i>ExecuteAsync()<\/i> \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <i>CancellationRequested<\/i> \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 BackgroundService:<\/p>\n<pre><code class=\"cs\">public class SensorService : BackgroundService {   protected override void ExecuteAsync()   {     while (!CancellationRequested)     {       \/\/ to allow other threads time to process include        \/\/ at least one millsecond sleep in loop       Thread.Sleep(1);     }   } } <\/code><\/pre>\n<p>  \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <i>BackgroundService<\/i> \u0440\u0435\u0430\u0437\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 Wi-Fi.<\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 ConnectionService<\/h3>\n<p>  \u0412 \u0437\u0430\u0434\u0430\u0447\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0442\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u00ab0.fr.pool.ntp.org\u00bb, \u0430\u0434\u0440\u0435\u0441 NTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0424\u0430\u0439\u043b ConnectionService.cs<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">protected override void ExecuteAsync() {   \/\/connecting to WiFi   const string Ssid = \"ssid\";   const string Password = \"password\";   \/\/ Give 60 seconds to the wifi join to happen   CancellationTokenSource cs = new(60000);   bool flag = false;   while (!flag)   {     var success = WifiNetworkHelper.ConnectDhcp(Ssid, Password, System.Device.Wifi.WifiReconnectionKind.Manual, requiresDateTime: false, token: cs.Token);     if (!success)     {       \/\/ Something went wrong, you can get details with the ConnectionError property:       Debug.WriteLine($\"Can't connect to the network, error: {WifiNetworkHelper.Status}\");       if (WifiNetworkHelper.HelperException != null)         Debug.WriteLine($\"ex: {WifiNetworkHelper.HelperException}\");     }     else     {       Debug.WriteLine($\"success\");       flag = true;     }   }   \/\/time synchronization              Sntp.Server1 = \"0.fr.pool.ntp.org\";   Sntp.UpdateNow();   Debug.WriteLine($\"Now: {DateTime.UtcNow}\"); } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <strong>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: <\/strong><a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework-samples\/tree\/master\/nanoframework-esp32-di-weatherstation\">GitHub \u2014 nanoframework-esp32-di-weatherstation<\/a><\/p>\n<h1>\u0414\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f SSD1306 OLED<\/h1>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework.IoT.Device\/tree\/change-ssd13xx_v2\/devices\/Ssd13xx\">nanoFramework.Iot.Device.Ssd13xx<\/a> \u0431\u044b\u043b\u0430 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 7-pin \u043a\u043e\u043d\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f, <a href=\"https:\/\/github.com\/nanoframework\/nanoFramework.IoT.Device\/pull\/550\">Pull requests #550<\/a>. \u041d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0438\u0441\u043f\u043b\u0435\u0435\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0441\u044f \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0430\u0443\u0437\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u0438 \u0432\u044b\u0432\u043e\u0434\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c 1 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043f\u043b\u0435\u0435\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043f\u043b\u0435\u0435\u043c:<\/p>\n<pre><code class=\"cs\">using Ssd1306 device = new Ssd1306(I2cDevice.Create(new I2cConnectionSettings(1, Ssd1306.SecondaryI2cAddress)), Ssd13xx.DisplayResolution.OLED128x64, 18);  device.ClearScreen(); device.Font = new BasicFont(); device.DrawString(2, 2, \"nF IOT!\", 2);\/\/large size 2 font device.DrawString(2, 32, \"nanoFramework\", 1, true);\/\/centered text device.Display(); <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 <i>ClearScreen()<\/i> \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0414\u0430\u043b\u0435\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <i>DrawString()<\/i> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u041c\u0435\u0442\u043e\u0434 <i>Display()<\/i> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u0435 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0438\u0434\u043d\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <i>ClearScreen()<\/i> \u0438 <i>Display()<\/i> \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <i>Display()<\/i> \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0443\u044f \u0441\u0442\u0430\u0434\u0438\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u0438 \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>  \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <i>ClearScreen()<\/i>, \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u044b\u043b\u0430 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <i>Display()<\/i> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f.<\/p>\n<p>  \u0424\u0430\u0439\u043b <a href=\"https:\/\/github.com\/devdotnetorg\/nanoFramework-samples\/blob\/master\/nanoframework-esp32-di-weatherstation\/Drivers\/Ssd13xx\/Ssd13xx.cs\">Ssd13xx.cs<\/a>, \u043c\u0435\u0442\u043e\u0434 <i>ClearScreen()<\/i>:<\/p>\n<pre><code class=\"cs\">public void ClearScreen() {   Array.Clear(_genericBuffer, 0, _genericBuffer.Length);    \/\/---> Display(); } <\/code><\/pre>\n<p>  <\/p>\n<h1>\u0420\u0435\u0441\u0443\u0440\u0441\u044b<\/h1>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/nanoframework\/nanoFramework.DependencyInjection\">.NET nanoFramework Dependency Injection Library \u2014 Github<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nanoframework\/nanoFramework.Hosting\">.NET nanoFramework Generic Host Library repository \u2014 Github<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nanoframework\/Samples\">nanoFramework team code samples \u2014 Github<\/a><\/li>\n<\/ul>\n<p>  <a href=\"https:\/\/cloud.timeweb.com\/vds-vps?utm_source=habr&amp;utm_medium=banner&amp;utm_campaign=vds-promo-6-rub\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/p-\/u9\/l2\/p-u9l27ynelxi92bcmdxhu76ma8.png\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/p-\/u9\/l2\/p-u9l27ynelxi92bcmdxhu76ma8.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/company\/timeweb\/blog\/688052\/\"> https:\/\/habr.com\/ru\/company\/timeweb\/blog\/688052\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habrastorage.org\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\" alt=\".NET nanoFramework Weatherstation\" data-src=\"https:\/\/habrastorage.org\/webt\/li\/ct\/6-\/lict6-h8tm6ozcwmcyqocwn43uy.jpeg\" data-blurred=\"true\"\/><\/a><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u043b\u043e\u043c\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u043c\u0438\u0440 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u0412 .NET \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 (Dependency injection, DI). \u0421\u0443\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043b\u0430\u0431\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0439, \u0431\u043e\u043b\u0435\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0439. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0436\u0435\u0441\u0442\u043a\u043e \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0438 \u0437\u0430\u043c\u0435\u043d\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/549012\/\">.NET nanoFramework<\/a> \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/584144\/\">ESP32<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d DI \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0435\u0433\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 LCD \u044d\u043a\u0440\u0430\u043d\u0430.  <\/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-338384","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338384","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=338384"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338384\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}