{"id":214759,"date":"2014-03-06T11:57:03","date_gmt":"2014-03-06T07:57:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=214759"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=214759","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 Windows 8. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c Sphero \u0441 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440 \u0438 \u0434\u0430\u0442\u0447\u0438\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/426\/e89\/a98\/426e89a981d2afaeda3d4e210ec3effe.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <a href=\"http:\/\/www.gosphero.com\/\">Sphero<\/a> \u0438 \u0435\u0433\u043e <a href=\"https:\/\/github.com\/orbotix\/Sphero-Win-SDK\">SDK<\/a>. <br \/>  \u041d\u0430 \u043f\u043e\u0432\u0435\u0441\u0442\u043a\u0435 \u0434\u043d\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0430 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438<\/h4>\n<p>  \u0412 <a href=\"http:\/\/habrahabr.ru\/company\/microsoft\/blog\/213797\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 <a href=\"http:\/\/www.gosphero.com\/\">Sphero<\/a> \u0438 \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u043d\u0430 Windows 8.1 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"http:\/\/www.visualstudio.com\/downloads\/download-visual-studio-vs\">Visual Studio 2013<\/a>. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438. \u041d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u00ab\u0440\u0443\u043b\u0438\u0442\u044c\u00bb \u0440\u043e\u0431\u043e\u0442\u043e\u043c \u043d\u0430\u043a\u043b\u043e\u043d\u044f\u044f \u043f\u043b\u0430\u043d\u0448\u0435\u0442 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440 \u043c\u043e\u0435\u0433\u043e \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0430 \u0438 \u0434\u0430\u0442\u0447\u0438\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u0430 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c.<\/p>\n<h5>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440<\/h5>\n<p>  \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 Windows 8.1 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c WinRT \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0435\u043d\u0441\u043e\u0440\u0430\u043c\u0438, \u0435\u0441\u043b\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:  <\/p>\n<ul>\n<li>\u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440;<\/li>\n<li>\u041a\u043e\u043c\u043f\u0430\u0441;<\/li>\n<li>\u0413\u0438\u0440\u043e\u043c\u0435\u0442\u0440;<\/li>\n<li>\u0414\u0430\u0442\u0447\u0438\u043a \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f;<\/li>\n<li>\u0418\u043d\u043a\u043b\u0438\u043d\u043e\u043c\u0435\u0442\u0440;<\/li>\n<li>\u0413\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044f.<\/li>\n<\/ul>\n<p>  \u0410\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440 \u2013 \u044d\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0432 \u0442\u0440\u0435\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u042d\u0442\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043e\u0431\u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <a href=\"http:\/\/msdn.microsoft.com\/ru-ru\/library\/windows\/apps\/windows.devices.sensors.accelerometer\">Accelerometer<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 <a href=\"http:\/\/msdn.microsoft.com\/ru-ru\/library\/windows\/apps\/windows.devices.sensors.accelerometerreading.aspx\">AccelerometerReading<\/a> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:   <\/p>\n<ul>\n<li>AccelerationX: \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432\u0434\u043e\u043b\u044c \u043e\u0441\u0438 \u0425;<\/li>\n<li>AccelerationY: \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432\u0434\u043e\u043b\u044c \u043e\u0441\u0438 Y;<\/li>\n<li>AccelerationZ: \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432\u0434\u043e\u043b\u044c \u043e\u0441\u0438 Z;<\/li>\n<li>Timestamp: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0441\u043d\u044f\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<\/ul>\n<p>  \u041c\u044b \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430, \u0443\u0441\u043a\u043e\u0440\u044f\u044f, \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u044f \u0438\u043b\u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/781\/1d2\/252\/7811d2252c2fd20e5b4ab60c156deb99.png\" alt=\"image\"\/><\/p>\n<p>  \u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">protected override void OnNavigatedTo(NavigationEventArgs e) { \u2026 Accelerometer _accelerometer = Accelerometer.GetDefault();   _accelerometer.ReadingChanged += new TypedEventHandler&lt;Accelerometer, AccelerometerReadingChangedEventArgs&gt;(ReadingChanged); \u2026 } async private void ReadingChanged(object sender, AccelerometerReadingChangedEventArgs e) { \u2026 } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h5>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u0441 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f Sphero \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<br \/>  \u0412 Sphero SDK \u0434\u043b\u044f Windows 8.1 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <b>Roll<\/b>, \u043a\u043e\u0442o\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c Sphero \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:  <\/p>\n<ul>\n<li>Heading \u2013 \u0443\u0433\u043e\u043b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f. <br \/>   \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/480\/f38\/bc0\/480f38bc0a9240ad4c770bc8987957fc.png\" alt=\"image\"\/><br \/>   \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 359.<\/li>\n<li>Speed \u2013 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f. <br \/>   0 \u2013 \u043d\u0435 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f.<br \/>   255 \u2013 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.<\/li>\n<\/ul>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, Sphero \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 x = 0, y = 0, heading = 0, speed = 0.<\/p>\n<h5>\u0414\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f<\/h5>\n<p>  Sphero \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u0431\u0430\u0432\u043d\u0443\u044e \u0432\u0435\u0449\u044c, \u043a\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f (<a href=\"http:\/\/orbotixinc.github.io\/Sphero-Docs\/docs\/collision-detection\/index.html\">Collision Detection<\/a>). \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 <a href=\"http:\/\/orbotixinc.github.io\/Sphero-Docs\/docs\/collision-detection\/index.html\">\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e<\/a>, \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. <\/p>\n<p>  \u0412 Sphero SDK \u0434\u043b\u044f Windows 8.1 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <b>CollisionDetectedEvent<\/b>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0438 \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private void OnRobotConnected(object sender, Robot robot) { \u2026 robot.CollisionControl.StartDetectionForWallCollisions(); robot.CollisionControl.CollisionDetectedEvent += OnCollisionDetectedEvent;  \u2026 } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0439:  <\/p>\n<pre><code class=\"cs\">robot.CollisionControl.StartDetectionForWallCollisions(); <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0434\u0430\u0442\u0447\u0438\u043a \u0432\u0430\u043c \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0443\u0436\u0435\u043d \u2013 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0435\u0433\u043e:  <\/p>\n<pre><code class=\"cs\">robot.CollisionControl.StopDetection(); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h5>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Sphero SDK<\/h5>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u043e\u0431\u043e\u0442\u043e\u043c, \u043d\u0430\u043c \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Sphero SDK \u0434\u043b\u044f Windows 8.1:<\/p>\n<p>  SetBackLED(intensity) \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0437\u0430\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u043e\u0431\u043e\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0443\u0434\u0430 \u043e\u043d \u043f\u043e\u0435\u0434\u0435\u0442. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<br \/>  1.0f \u2013 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0430 \u043f\u043e\u043b\u043d\u0443\u044e \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c. <br \/>  0.0f \u2014 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442.<\/p>\n<p>  SetHeading(heading) \u2013 \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 0 \u0434\u043e 359.<\/p>\n<p>  SetRGBLED(red, green, blue) \u2013 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0446\u0432\u0435\u0442 \u0448\u0430\u0440\u0430.<\/p>\n<p>  Roll(heading, speed) \u2013 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f:<br \/>  heading \u2013 \u0443\u0433\u043e\u043b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 359.<br \/>  speed \u2013 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f. 0 \u2013 \u043d\u0435 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f. 255 \u2013 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.<\/p>\n<p>  Sleep() \u2013 \u0443\u0441\u044b\u043f\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430.<\/p>\n<h4>Pa\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h4>\n<p>  <\/p>\n<h5>\u0417\u0430\u0434\u0430\u0447\u0430<\/h5>\n<p>  \u041f\u0435\u0440\u0435\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440. \u041f\u0440\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u2013 \u043a\u0440\u0430\u0441\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430 \u043a\u0440\u0430\u0441\u043d\u044b\u043c.<\/p>\n<h5>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h5>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043b\u0430\u043d\u0448\u0435\u0442 Microsoft Surface 2 Pro<\/li>\n<li>OS Windows 8.1<\/li>\n<li>\u0421\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438: <a href=\"http:\/\/www.visualstudio.com\/\">Visual Studio 2013<\/a><\/li>\n<li>\u042f\u0437\u044b\u043a: C#<\/li>\n<li><a href=\"https:\/\/github.com\/orbotix\/Sphero-Win-SDK\">Sphero SDK<\/a> \u0434\u043b\u044f Windows 8.1<\/li>\n<\/ul>\n<p>  <\/p>\n<h5>\u041f\u0440\u043e\u0446\u0435\u0441\u0441<\/h5>\n<p>  1. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Visual Studio 2013 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442 File \/ New \/ Project \/ <b>Blank App<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/cd8\/8e0\/e0c\/cd88e0e0c777e275c4664f7ba7a129db.png\" alt=\"image\"\/><\/p>\n<p>  2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443 <b>RobotKit.dll<\/b> \u0438\u0437 <a href=\"https:\/\/github.com\/orbotix\/Sphero-Win-SDK\">Sphero SDK<\/a> \u0434\u043b\u044f Windows 8.1<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f35\/bca\/8ee\/f35bca8eecf42af725dc8d210ca58ff1.png\" alt=\"image\" width=\"300\"\/><\/p>\n<p>  3. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Bluetooth RFCOMM \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <b>Package.appxmanifest<\/b> \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <b>Capabilities<\/b> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Bluetooth RFCOMM \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;wb:DeviceCapability Name=&quot;bluetooth.rfcomm&quot;&gt; &lt;wb:Device Id=&quot;any&quot;&gt; &lt;wb:Function Type=&quot;serviceId:00001101-0000-1000-8000-00805F9B34FB&quot; \/&gt; &lt;\/wb:Device&gt; &lt;\/wb:DeviceCapability&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  4. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0434\u0435\u043c:  <\/p>\n<ul>\n<li>\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u0430 (\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\\\u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d);<\/li>\n<li>\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f;<\/li>\n<li>\u043a\u043d\u043e\u043f\u043a\u0438 Start \u0438 Stop \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0433\u0440\u044b.<\/li>\n<\/ul>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b<b> MainPage.xaml<\/b> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0432\u0441\u0451 \u044d\u0442\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;Page     x:Class=&quot;SpheroRace.MainPage&quot;     xmlns=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&quot;     xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;     xmlns:local=&quot;using:SpheroRace&quot;     xmlns:d=&quot;http:\/\/schemas.microsoft.com\/expression\/blend\/2008&quot;     xmlns:mc=&quot;http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006&quot;     mc:Ignorable=&quot;d&quot;   &gt;     &lt;Grid Margin=&quot;100&quot; &gt;                 &lt;Grid.RowDefinitions &gt;             &lt;RowDefinition Height=&quot;60&quot;\/&gt;             &lt;RowDefinition Height=&quot;60&quot;\/&gt;             &lt;RowDefinition\/&gt;         &lt;\/Grid.RowDefinitions&gt;         &lt;Grid.ColumnDefinitions&gt;             &lt;ColumnDefinition\/&gt;             &lt;ColumnDefinition\/&gt;         &lt;\/Grid.ColumnDefinitions&gt;         &lt;TextBlock x:Name=&quot;SpheroName&quot; Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; Text=&quot;No Sphero Connected&quot; FontSize=&quot;24&quot;\/&gt;         &lt;ToggleSwitch x:Name=&quot;ConnectionToggle&quot; Grid.Row=&quot;1&quot; Grid.Column=&quot;0&quot; Toggled=&quot;ConnectionToggle_Toggled&quot; \/&gt;         &lt;Button Name=&quot;StartBtn&quot; Click=&quot;StartBtn_Click&quot; Grid.Row=&quot;2&quot; Grid.Column=&quot;0&quot; Content=&quot;Start&quot; VerticalAlignment=&quot;Bottom&quot; HorizontalAlignment=&quot;Left&quot; Padding=&quot;100&quot; &gt;&lt;\/Button&gt;         &lt;Button Name=&quot;StopBtn&quot; Click=&quot;StopBtn_Click&quot; Grid.Row=&quot;2&quot; Grid.Column=&quot;1&quot; Content=&quot;Stop&quot; VerticalAlignment=&quot;Bottom&quot; HorizontalAlignment=&quot;Right&quot; Padding=&quot;100&quot; IsEnabled=&quot;False&quot; &gt;&lt;\/Button&gt;     &lt;\/Grid&gt; &lt;\/Page&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  5. \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 <b>MainPage.xaml.cs<\/b> \u0438 \u043e\u043f\u0438\u0448\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0438\u0433\u0440\u044b. \u0414\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u043e Sphero \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e SDK.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u043e\u0433\u0438\u043a\u0430 \u0438\u0433\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">public sealed partial class MainPage : Page     {         private Sphero m_robot = null;         private long   m_lastTimeMs;         private double m_currentX = 0;         private double m_currentY = 0;          private bool m_isStarted = false;          private const string c_noSpheroConnected = &quot;No Sphero Connected&quot;;         private const string c_connectingToSphero = &quot;Connecting to {0}&quot;;         private const string c_spheroConnected = &quot;Connected to {0}&quot;;          public MainPage()         {             this.InitializeComponent();         }                   \/\/\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u044d\u043a\u0440\u0430\u043d         protected override void OnNavigatedTo(NavigationEventArgs e)         {             base.OnNavigatedTo(e);              SetupRobotConnection();             Application app = Application.Current;             app.Suspending += OnSuspending;                          Accelerometer _accelerometer = Accelerometer.GetDefault();                 _accelerometer.ReadingChanged += new TypedEventHandler&lt;Accelerometer, AccelerometerReadingChangedEventArgs&gt;(ReadingChanged);          }          \/\/\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430         protected override void OnNavigatedFrom(NavigationEventArgs e)         {             base.OnNavigatedFrom(e);              ShutdownRobotConnection();              Application app = Application.Current;             app.Suspending -= OnSuspending;              Accelerometer _accelerometer = Accelerometer.GetDefault();             _accelerometer.ReadingChanged -= new TypedEventHandler&lt;Accelerometer, AccelerometerReadingChangedEventArgs&gt;(ReadingChanged);         }          \/\/handle the application entering the background         private void OnSuspending(object sender, SuspendingEventArgs args)         {             ShutdownRobotConnection();         }          \/\/\u0418\u0449\u0435\u043c \u0440\u043e\u0431\u043e\u0442\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0435\u043c\u0443         private void SetupRobotConnection()         {             SpheroName.Text = c_noSpheroConnected;              RobotProvider provider = RobotProvider.GetSharedProvider();             provider.DiscoveredRobotEvent += OnRobotDiscovered;             provider.NoRobotsEvent += OnNoRobotsEvent;             provider.ConnectedRobotEvent += OnRobotConnected;             provider.FindRobots();         }                      \/\/\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0440\u043e\u0431\u043e\u0442\u043e\u043c         private void ShutdownRobotConnection()         {             if (m_robot != null && m_robot.ConnectionState == ConnectionState.Connected)             {                 m_robot.SensorControl.StopAll();                 m_robot.CollisionControl.StopDetection();                 m_robot.Sleep();                                 m_robot.Disconnect();                  ConnectionToggle.OffContent = &quot;Disconnected&quot;;                 SpheroName.Text = c_noSpheroConnected;                 SetRedColor();                      RobotProvider provider = RobotProvider.GetSharedProvider();                 provider.DiscoveredRobotEvent -= OnRobotDiscovered;                 provider.NoRobotsEvent -= OnNoRobotsEvent;                 provider.ConnectedRobotEvent -= OnRobotConnected;             }         }                 \/\/\u0420\u043e\u0431\u043e\u0442 \u043d\u0430\u0439\u0434\u0435\u043d!         private void OnRobotDiscovered(object sender, Robot robot)         {                       if (m_robot == null)             {                                 RobotProvider provider = RobotProvider.GetSharedProvider();                 provider.ConnectRobot(robot);                 ConnectionToggle.OnContent = &quot;Connecting...&quot;;                 m_robot = (Sphero)robot;                  SpheroName.Text = string.Format(c_connectingToSphero, robot.BluetoothName);             }         }          \/\/\u0420\u043e\u0431\u043e\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d :(         private void OnNoRobotsEvent(object sender, EventArgs e)         {             MessageDialog dialog = new MessageDialog(c_noSpheroConnected);             dialog.DefaultCommandIndex = 0;             dialog.CancelCommandIndex = 1;             dialog.ShowAsync();         }              \/\/\u0420\u043e\u0431\u043e\u0442 \u0433\u043e\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b         private void OnRobotConnected(object sender, Robot robot)         {             ConnectionToggle.IsOn = true;             ConnectionToggle.OnContent = &quot;Connected&quot;;              SpheroName.Text = string.Format(c_spheroConnected, robot.BluetoothName);              if (m_robot != null && m_robot.ConnectionState == ConnectionState.Connected)             {                 m_robot.CollisionControl.StartDetectionForWallCollisions();                 m_robot.CollisionControl.CollisionDetectedEvent += OnCollisionDetectedEvent;                  SetRedColor();             }         }          \/\/\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430         async private void ReadingChanged(object sender, AccelerometerReadingChangedEventArgs e)         {             if (!m_isStarted)                 return;              await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =&gt;             {                 Windows.Devices.Sensors.AccelerometerReading reading = e.Reading;                 SendRollCommand(reading.AccelerationX, reading.AccelerationY, reading.AccelerationZ);             });         }          \/\/\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c         private void OnCollisionDetectedEvent(object sender, RobotKit.CollisionData data)         {             SetRedColor();             m_robot.Roll(0, 0);         }                  \/\/\u041a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u0430         private void ConnectionToggle_Toggled(object sender, RoutedEventArgs e)         {             ConnectionToggle.OnContent = &quot;Connecting...&quot;;             if (ConnectionToggle.IsOn)             {                 if (m_robot == null || m_robot.ConnectionState != ConnectionState.Connected)                 {                     SetupRobotConnection();                 }             }             else             {                 ShutdownRobotConnection();             }         }          \/\/\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430         private void StartBtn_Click(object sender, RoutedEventArgs e)         {             m_isStarted = true;             StartBtn.IsEnabled = false;             StopBtn.IsEnabled = true;                           SetGreenColor();             m_robot.Roll(0, 0);                    }          \/\/\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0430         private void StopBtn_Click(object sender, RoutedEventArgs e)         {             m_isStarted = false;             StartBtn.IsEnabled = true;             StopBtn.IsEnabled = false;              SetRedColor();             m_robot.Roll(0, 0);         }          \/\/\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u0430. \u041e\u043d \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u043e\u0434\u0432\u0438\u0436\u043d\u043e \u0441\u0442\u043e\u0438\u0442         private void SetGreenColor()         {             m_robot.SetHeading(0);             m_robot.SetBackLED(1.0f);             m_robot.SetRGBLED(0, 255, 0);         }          \/\/\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c         private void SetRedColor()         {             m_robot.SetHeading(0);             m_robot.SetBackLED(1.0f);             m_robot.SetRGBLED(255, 0, 0);         }          \/\/\u041b\u043e\u0433\u0438\u043a\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0440\u043e\u0431\u043e\u0442\u0430 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430         private async void SendRollCommand(double newX, double newY, double newZ)         {             float x = (float)newX;             float y = (float)newY;             float z = (float)newZ;              float speed = Math.Abs(z);             speed = (speed == 0) ? 0 : (float)Math.Sqrt(speed);             if (speed &gt; 1f)                 speed = 0.01f;              int heading = Convert.ToInt32(Math.PI \/ 2.0 - Math.Atan2((double)y - m_currentY, (double)x - m_currentX));              long milliseconds = DateTime.Now.Ticks \/ TimeSpan.TicksPerMillisecond;             if ((milliseconds - m_lastTimeMs) &gt; 1000)             {                 SetGreenColor();                 m_robot.Roll(heading, speed);                  m_lastTimeMs = milliseconds;                 m_currentX = x;                 m_currentY = y;             }         }         } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  6. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a Sphero \u043f\u043e Bluetooth<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/155\/795\/b08\/155795b08d2b7beb8abd6294c0e6f443.png\" alt=\"image\"\/><\/p>\n<p>  7. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/03a\/421\/e34\/03a421e34509ecb32224177225b99963.png\" alt=\"image\"\/><\/p>\n<p>  8. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Start \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0438\u0433\u0440\u0443 \u043d\u0430 \u0434\u0435\u043b\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e23\/be0\/f24\/e23be0f24b0ad0330295f0e3cefef193.png\" alt=\"image\"\/> <\/p>\n<h5>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h5>\n<p>  \u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u0433\u0440\u0443\u0448\u043a\u0430. \u0415\u0451 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c, \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0433\u043e\u043d\u043a\u0438 \u0440\u043e\u0431\u043e\u0442\u043e\u0432, \u0438\u043b\u0438 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0441 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u043c \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u043c.<\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0432\u0438\u0434\u0435\u043e.<br \/>  <iframe loading=\"lazy\" src=\"https:\/\/onedrive.live.com\/embed?cid=DA8C144CFF7C40EE&amp;resid=DA8C144CFF7C40EE%2153859&amp;authkey=AAsv2Bez63HqQY0\" width=\"320\" height=\"179\" scrolling=\"no\"><\/iframe><\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u0443\u0442: <a href=\"https:\/\/github.com\/MissUFO\/SpheroRace\">github.com\/MissUFO\/SpheroRace<\/a> <\/p>\n<h4>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  <a href=\"http:\/\/habrahabr.ru\/users\/missufo\/topics\/\">\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 Windows 8. \u041c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0440 Sphero<\/a><br \/>  <a href=\"http:\/\/www.gosphero.com\/\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 Sphero <\/a><br \/>  <a href=\"https:\/\/developer.gosphero.com\/\">\u0426\u0435\u043d\u0442\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 Sphero<\/a> <br \/>  <a href=\"https:\/\/github.com\/orbotix\/Sphero-Win-SDK\">Sphero SDK \u0434\u043b\u044f Windows 8.1<\/a><br \/>  <a href=\"http:\/\/code.msdn.microsoft.com\/windowsapps\/Sphero-SDK-Sample-2b18913c\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Sphero SDK \u0434\u043b\u044f Windows 8.1<\/a> <br \/>  <a href=\"http:\/\/code.msdn.microsoft.com\/windowsapps\/Accelerometer-Sensor-Sample-22982671\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u0432 Windows 8.1<\/a><br \/>  <a href=\"http:\/\/www.youtube.com\/playlist?list=PLECE4BD55445BDA51&amp;feature=plcp\">\u041a\u0430\u043d\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Sphero \u043d\u0430 youtube<\/a><br \/>  <a href=\"http:\/\/www.visualstudio.com\/downloads\/download-visual-studio-vs\">\u0421\u043a\u0430\u0447\u0430\u0442\u044c Visual Studio 2013<\/a><br \/>  <a href=\"http:\/\/www.visualstudio.com\/products\/visual-studio-online-overview-vs\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e Visual Studio Online<\/a><br \/>  <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=307137&amp;clcid=0x419\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 Visual Studio Online<\/a>    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/microsoft\/blog\/214759\/\"> http:\/\/habrahabr.ru\/company\/microsoft\/blog\/214759\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/426\/e89\/a98\/426e89a981d2afaeda3d4e210ec3effe.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <a href=\"http:\/\/www.gosphero.com\/\">Sphero<\/a> \u0438 \u0435\u0433\u043e <a href=\"https:\/\/github.com\/orbotix\/Sphero-Win-SDK\">SDK<\/a>. <br \/>  \u041d\u0430 \u043f\u043e\u0432\u0435\u0441\u0442\u043a\u0435 \u0434\u043d\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u0431\u043e\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0430 \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435\u043c.   <\/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-214759","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214759","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=214759"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214759\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}