{"id":1762,"date":"2024-03-05T17:02:11","date_gmt":"2024-03-05T09:02:11","guid":{"rendered":"http:\/\/www.autouav.net.cn\/?p=1762"},"modified":"2024-03-05T17:02:11","modified_gmt":"2024-03-05T09:02:11","slug":"ardupilot%e6%b7%bb%e5%8a%a0%e8%87%aa%e5%ae%9a%e4%b9%89rgbled%e9%97%aa%e7%83%81%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.autouav.net.cn\/?p=1762","title":{"rendered":"ardupilot\u6dfb\u52a0\u81ea\u5b9a\u4e49RGBLed\u95ea\u70c1\u529f\u80fd"},"content":{"rendered":"<h1 class=\"postTitle\"><a id=\"cb_post_title_url\" class=\"postTitle2 vertical-middle\" href=\"https:\/\/www.cnblogs.com\/jiayezi\/p\/15438570.html\"><span role=\"heading\" aria-level=\"2\">ardupilot\u6dfb\u52a0\u81ea\u5b9a\u4e49RGBLed\u95ea\u70c1\u529f\u80fd<\/span><\/a><\/h1>\n<p>1\u3001\u5728ardupilot\u4e2d\u5bf9RGBLed\u7684\u63a7\u5236\u662f\u5728l\u8def\u5f84<strong>libraries\\AP_Notify<\/strong>\u4e0b\uff0c\u590d\u5236\u8be5\u6587\u4ef6\u5939\uff0c\u5e76\u7c98\u8d34\u5728<strong>libraries<\/strong>\u4e0b\uff0c\u6839\u636e\u81ea\u5df1\u7684\u559c\u597d\u66f4\u6362\u6587\u4ef6\u5939\u540d\u79f0<\/p>\n<p>\u6211\u8fd9\u91cc\u5c06\u5176\u547d\u540d\u4e3a\uff1aAP_My_Notify,\u5e76\u5c06\u5176\u76ee\u5f55\u4e0b\u5bf9\u672c\u6b21\u8bd5\u9a8c\u6ca1\u6709\u7528\u7684\u6587\u4ef6\u5220\u9664\uff0c\u540c\u65f6\u5c06\u5404\u6587\u4ef6\u8fdb\u884c\u91cd\u547d\u540d\uff0c\u8fd9\u91cc\u5728\u6bcf\u4e2a\u6587\u4ef6\u540d\u79f0\u524d\u9762\u52a0\u4e0a<strong>\u201cMy\u201d<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022113647067-1330845995.png\" alt=\"\" width=\"1469\" height=\"825\" \/><\/p>\n<p>\u5c06\u6587\u4ef6\u590d\u5236\u5e76\u91cd\u547d\u540d\u597d\u540e\uff0c\u9700\u8981\u4fee\u6539\u6240\u4f7f\u7528\u5230\u7684\u7c7b\uff0c<\/p>\n<p>2\u3001\u5bf9\u6240\u6709\u7684\u7c7b\u8fdb\u884c\u91cd\u547d\u540d\u64cd\u4f5c\u540e\uff0c\u5c06\u6240\u9700\u8981\u66ff\u6362\u7684\u5730\u65b9\u5168\u90e8\u66ff\u6362\u6389\uff1b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022114026509-1414160739.png\" alt=\"\" width=\"1468\" height=\"824\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022114309256-154498433.png\" alt=\"\" width=\"1463\" height=\"821\" \/><\/p>\n<p>3\u3001\u5728My_RGBLed.cpp\u4e2d\u5bf9void My_RGBLed::update_colours(void)\u8fdb\u884c\u4fee\u6539\uff0c\u6539\u4e3a\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>\/\/ _scheduled_update - updates _red, _green, _blue according to notify flags\r\nuint8_t _i_Step = 0;\r\nvoid My_RGBLed::update_colours(void)\r\n{\r\n    uint8_t brightness = _led_bright;\r\n\r\n    switch (_i_Step) {\r\n    case 0:\r\n        _red_des = brightness;\r\n        _blue_des = _led_off;\r\n        _green_des = _led_off;\r\n        _i_Step = 1;\r\n        break;\r\n    case 1:\r\n        _red_des = _led_off;\r\n        _blue_des = brightness;\r\n        _green_des = _led_off;\r\n        _i_Step = 2;\r\n        break;\r\n    case 2:\r\n        _red_des = _led_off;\r\n        _blue_des = _led_off;\r\n        _green_des = brightness;\r\n        _i_Step = 0;\r\n        break;\r\n    }\r\n}<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>\u8be5\u90e8\u5206\u7a0b\u5e8f\u610f\u601d\u4e3a\u63a7\u5236RGBLed\u706f\u6ce1\u7ea2\u3001\u84dd\u3001\u7eff\uff0c\u4e09\u79cd\u989c\u8272\u4f9d\u6b21\u70b9\u4eae\uff0c\u5e76\u5faa\u73af\u6267\u884c\uff1b<\/p>\n<p>4\u3001\u4fee\u6539\u597d\u5e95\u5c42\u7a0b\u5e8f\u540e\u5f00\u59cb\u4fee\u6539\u4e0a\u5c42\u5e94\u7528<\/p>\n<p>\u5728\u4fee\u6539\u4e0a\u5c42\u5e94\u7528\u4e4b\u524d\u9700\u8981\u5148\u8ba9\u7a0b\u5e8f\u8bc6\u522b\u5230\u6211\u4eec\u81ea\u5df1\u5b9a\u4e49\u7684\u7a0b\u5e8f\uff0c\u8fd9\u91cc\u9700\u8981\u6253\u5f00<strong>ArduCopter\\wscript<\/strong>\u548c<strong>ArduCopter\\make.inc<\/strong>\uff0c\u5728\u5bf9\u5e94\u7684\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0a\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u6587\u4ef6\u5939\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022134559862-228410251.png\" alt=\"\" width=\"1474\" height=\"828\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022134720913-1163786727.png\" alt=\"\" width=\"1475\" height=\"829\" \/><\/p>\n<p>5\u3001\u5f00\u59cb\u5bf9\u9876\u5c42\u5e94\u7528\u8fdb\u884c\u4fee\u6539\uff1a<br \/>\n\u2460\u3001\u5728\u5934\u6587\u4ef6Copter.h\u4e2d\u5bfc\u5165\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u5934\u6587\u4ef6#include &lt;AP_My_Notify\/My_AP_Notify.h&gt;\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022135007943-1538045300.png\" alt=\"\" width=\"1503\" height=\"845\" \/><\/p>\n<p>\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b\u7684\u5bf9\u8c61\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022135246237-1525790202.png\" alt=\"\" width=\"1509\" height=\"848\" \/><\/p>\n<p>\u521b\u5efa\u4e00\u4e2aleds.cpp\u7684\u6587\u4ef6\uff0c\u7528\u4e8e\u5bf9\u5e95\u5c42\u51fd\u6570\u7684\u8c03\u7528\uff1b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022135441985-1460989377.png\" alt=\"\" width=\"1510\" height=\"848\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5c06\u51fd\u6570\u6dfb\u52a0\u5230\u4efb\u52a1\u5217\u8868<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022135621186-283400472.png\" alt=\"\" width=\"1512\" height=\"850\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5bf9init_ardupilot\u51fd\u6570\u8fdb\u884c\u4fee\u6539\uff0c\u5c06\u81ea\u5b9a\u4e49\u7684\u529f\u80fd\u5728\u8fd9\u91cc\u521d\u59cb\u5316\uff08\u7531\u4e8e\u8fd9\u91cc\u81ea\u5b9a\u4e49\u7684\u662f\u5bf9RGBLed\u7684\u63a7\u5236\uff0c\u56e0\u6b64\u8981\u5c06\u539f\u6765\u7684AP_Notify\u7684\u521d\u59cb\u5316\u505a\u5c4f\u853d\u5904\u7406\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2024\/03\/2082318-20211022135811451-1599715793.png\" alt=\"\" width=\"1507\" height=\"847\" \/><\/p>\n<p>\u6b64\u65f6\u53ef\u5bf9\u7a0b\u5e8f\u7f16\u8bd1\uff0c\u82e5\u7f16\u8bd1\u901a\u8fc7\uff0c\u5c06\u56fa\u4ef6\u70e7\u5f55\u8fdbPixhawk\u4e0a\u7684\u706f\u4f1a\u7ea2\u7eff\u84dd\u4e09\u8272\u4ea4\u66ff\u95ea\u70c1\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ardupilot\u6dfb\u52a0\u81ea\u5b9a\u4e49RGBLed\u95ea\u70c1\u529f\u80fd 1\u3001\u5728ardupilot\u4e2d\u5bf9RGBLed\u7684\u63a7\u5236\u662f\u5728l\u8def\u5f84libraries\\AP_Notify\u4e0b\uff0c\u590d\u5236\u8be5\u6587\u4ef6\u5939\uff0c\u5e76\u7c98\u8d34\u5728libraries\u4e0b\uff0c\u6839\u636e\u81ea\u5df1&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1762","post","type-post","status-publish","format-standard","hentry","category-25"],"_links":{"self":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1762"}],"version-history":[{"count":1,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1762\/revisions"}],"predecessor-version":[{"id":1765,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1762\/revisions\/1765"}],"wp:attachment":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}