{"id":70,"date":"2017-09-12T20:43:22","date_gmt":"2017-09-12T12:43:22","guid":{"rendered":"http:\/\/lst.wting.me\/?p=70"},"modified":"2017-09-12T20:43:22","modified_gmt":"2017-09-12T12:43:22","slug":"%e6%a0%91%e8%8e%93%e6%b4%be%e6%99%ba%e8%83%bd%e5%ae%b6%e5%b1%85%ef%bc%9a%e6%a0%91%e8%8e%93%e6%b4%be%e5%ae%89%e8%a3%85pi4j","status":"publish","type":"post","link":"https:\/\/lst.wting.top\/?p=70","title":{"rendered":"\u6811\u8393\u6d3e\u667a\u80fd\u5bb6\u5c45\uff1a\u6811\u8393\u6d3e\u5b89\u88c5pi4j"},"content":{"rendered":"<p>\u7ecf\u8fc7\u4e0a\u5468\u672b\u4e24\u5929\u7684\u710a\u63a5\uff0c\u7ec8\u4e8e\u5b8c\u6210\u4e86433MHZ\u7684\u53d1\u5c04\u6a21\u5757\u8fde\u63a5\uff0c\u4f46\u662f\u63a5\u6536\u6a21\u5757\u5374\u59cb\u7ec8\u65e0\u6cd5\u6b63\u786e\u63a5\u6536\u4fe1\u53f7\u3002\u672c\u5468\u672b\u518d\u770b\u5982\u4f55\u91cd\u65b0\u8fde\u63a5\u7535\u8def\u4e86\u3002<\/p>\n<p>\u90a3\u4e48\u6211\u4eec\u518d\u8bb2\u4e00\u4e0b\u5982\u4f55\u4f7f\u7528\u6811\u8393\u6d3epi4j\u6765\u63a7\u5236\u6811\u8393\u6d3eGPIO\u5f15\u811a\u3002<\/p>\n<p>\u56e0\u4e3api4j\u9700\u8981\u4f9d\u8d56java\u73af\u5883\u548cwiringPi\u5e93\uff0cJava\u73af\u5883\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7sudo apt-get install oracle-java8-jdk\u547d\u4ee4\u6765\u5b89\u88c5\uff0cwiring Pi\u5b89\u88c5\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>\u70b9\u51fb\u94fe\u63a5\uff1a<a href=\"https:\/\/git.drogon.net\/?p=wiringPi;a=summary\">https:\/\/git.drogon.net\/?p=wiringPi;a=summary<\/a>\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u9009\u62e9\u4e00\u4e2a\u6700\u65b0\u7248\u7684wiringPi\uff0c\u70b9\u51fbSNAPSHOT\uff0c\u4fbf\u53ef\u4e0b\u8f7d\uff0c\u5047\u8bbe\u6211\u4eec\u4e0b\u8f7d\u7684\u5305\u662fwiringPi-98bcb20.tar.gz\u3002\u5b9e\u9645\u4e2d\u8fd9\u4e2a\u5305\u4f1a\u53ef\u80fd\u4e0d\u540c\u3002<\/p>\n<p>\u4e0b\u8f7d\u5b8c\u6bd5\u540e\u5bfc\u5165\u5230\u6811\u8393\u6d3e\u4e2d\uff0c\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff1a<\/p>\n<p>$ tar xfz wiringPi-98bcb20.tar.gz<\/p>\n<p>$ cd wiringPi-98bcb20<\/p>\n<p>$ .\/build<\/p>\n<p>\u7b49\u5f85build\u5b8c\u6bd5\u3002<\/p>\n<p>\u4e0b\u9762\u5b89\u88c5pi4j\uff0c\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff1a<\/p>\n<p>sudo curl -s get.pi4j.com | sudo bash<\/p>\n<p>\u7b49\u5f85pi4j\u5b89\u88c5\u5b8c\u6bd5\u5373\u53ef\u3002<\/p>\n<p>\u5e93\u51fd\u6570\u5b89\u88c5\u597d\u4e86\uff0c\u90a3\u6211\u4eec\u9700\u8981\u5728eclipse\u4e2d\u5bfc\u5165pi4j-core\u7684jar\u5305\uff0cmaven\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<p>&lt;dependency&gt;<\/p>\n<p>&lt;groupId&gt;com.pi4j&lt;\/groupId&gt;<\/p>\n<p>&lt;artifactId&gt;pi4j-core&lt;\/artifactId&gt;<\/p>\n<p>&lt;version&gt;1.1&lt;\/version&gt;<\/p>\n<p>&lt;\/dependency&gt;<\/p>\n<p>\u4f46\u662f\u6700\u65b0\u7248\u7684\u6811\u8393\u6d3e\u7cfb\u7edf\u5982\u679c\u4f7f\u75281.1\u7248\u672c\u4f1a\u62a5\u4e00\u4e2a\u9519\u8bef\uff1a<\/p>\n<p>Unable to determine hardware version. I see: Hardware : BCM2835- expecting BCM2708 or BCM2709.<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a1.1\u7248\u672c\u4e0d\u652f\u6301\u6700\u65b0\u7248\u7684\u6811\u8393\u6d3e\u7cfb\u7edf\uff0c\u6211\u4eec\u8fd9\u65f6\u5019\u9700\u8981\u4f7f\u75281.2-SNAPSHOT\u7248\u672c\u3002\u8fd9\u4e2a\u7248\u672c\u5728\u5f88\u591amaven\u5e93\u91cc\u8fd8\u6ca1\u6709\u6536\u5f55\uff0c\u6240\u4ee5\u5c06\u5176\u5206\u4eab\u51fa\u6765\uff0c\u94fe\u63a5\u5982\u4e0b\uff1a<\/p>\n<p><a href=\"http:\/\/lst.wting.me\/wp-content\/uploads\/2017\/09\/pi4j-core-1.2-SNAPSHOT.zip\">http:\/\/lst.wting.me\/wp-content\/uploads\/2017\/09\/pi4j-core-1.2-SNAPSHOT.zip<\/a><\/p>\n<p>\u597d\u4e86\uff0c\u73b0\u5728\u6211\u4eec\u96c6\u6210\u4e86jar\u5305\uff0c\u5c31\u80fd\u76f4\u63a5\u5f00\u53d1\u5e94\u7528\u4e86\u3002\u65b0\u5efa\u4e00\u4e2aAPP\u7c7b\uff0c\u5199\u5165\u4e0b\u9762\u7684\u65b9\u6cd5\uff1a<\/p>\n<p><strong>public<\/strong> <strong>class<\/strong> App {<\/p>\n<p><strong>public<\/strong> <strong>static<\/strong> <strong>void<\/strong> main( String[] args ){<\/p>\n<p>String get=args[0];<\/p>\n<p><strong>final<\/strong> GpioController gpio = GpioFactory.<em>getInstance<\/em>();<\/p>\n<p><strong>final<\/strong> GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin(RaspiPin.<strong><em>GPIO_00<\/em><\/strong>, &#8220;LED&#8221;, PinState.<strong><em>HIGH<\/em><\/strong>);<\/p>\n<p><strong>if<\/strong>(get.equals(&#8220;h&#8221;))<\/p>\n<p>pin.high();<\/p>\n<p><strong>else<\/strong><\/p>\n<p>pin.low();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\u5728\u8fd9\u91cc\u9644\u4e00\u4e2a\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-72 aligncenter\" src=\"http:\/\/lst.wting.me\/wp-content\/uploads\/2017\/09\/222-175x300.png\" alt=\"\" width=\"175\" height=\"300\" srcset=\"https:\/\/lst.wting.top\/wp-content\/uploads\/2017\/09\/222-175x300.png 175w, https:\/\/lst.wting.top\/wp-content\/uploads\/2017\/09\/222.png 300w\" sizes=\"(max-width: 175px) 100vw, 175px\" \/><\/p>\n<p>\u6839\u636e\u8fd9\u5f20\u56fe\u6211\u4eec\u8fd9\u4e2a\u4f8b\u5b50\u5c31\u5f88\u597d\u7406\u89e3\u4e86\uff0c\u627e\u5230GPIO_00\uff0c\u537311\u53f7\u5f15\u811a\uff0c\u8bbe\u7f6e\u9ed8\u8ba4\u503c\u9ad8\u7535\u5e73\uff0c\u7136\u540e\u6839\u636e\u4f20\u5165\u53c2\u6570\u8bbe\u7f6e\u9ad8\u7535\u5e73\u548c\u4f4e\u7535\u5e73\u3002<\/p>\n<p>\u5176\u5b9e\u5230\u8fd9\u91cc\u6211\u4eec\u5c31\u53ef\u4ee5\u63a7\u5236\u7ee7\u7535\u5668\u63a7\u5236\u706f\u5149\u4e86\uff0c\u4f46\u662f\u5f88\u9057\u61be\uff0c\u5982\u679c\u8fd9\u6837\u505a\u6211\u4eec\u53ea\u80fd\u4f7f\u7528\u5f88\u957f\u5f88\u957f\u7684\u7ebf\u8fde\u63a5\u5230\u6211\u4eec\u7684\u5f00\u5173\u5904\uff0c\u5bf9\u667a\u80fd\u5bb6\u5c45\u6765\u8bb2\u5f88\u4e0d\u53cb\u597d\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u4f7f\u7528\u65e0\u7ebf\u628a\u8fd9\u4e2a\u5f15\u811a\u7684\u4fe1\u53f7\u53d1\u5c04\u51fa\u53bb\u3002<\/p>\n<p>\u90a3\u4e48\u6211\u4eec\u4ecb\u7ecd\u4e00\u4e0b\u5f53\u524d\u7684\u8bbe\u8ba1\uff1a<\/p>\n<p>\u6811\u8393\u6d3e\u63a7\u5236\u5f15\u811a\u8f93\u51fa\u9ad8\u7535\u5e73\uff0c\u9ad8\u7535\u5e73\u6fc0\u6d3bEV1527\u82af\u7247\u8fdb\u884c\u7f16\u7801\uff0c\u7f16\u7801\u540e\u7684\u6570\u636e\u4f20\u9001\u7ed9433MHZ\u7684H34B\u65e0\u7ebf\u53d1\u5c04\u6a21\u5757\u5c06\u6570\u636e\u53d1\u9001\u51fa\u53bb\u3002\u63a5\u6536\u7aef\u662f\u4e00\u4e2aLR43B\u7684\u65e0\u7ebf\u63a5\u6536\u6a21\u5757\uff0c\u63a5\u6536\u5230\u7684\u6570\u636e\u4f7f\u7528RFE273\u89e3\u7801\u82af\u7247\u8fdb\u884c\u89e3\u7801\uff0c\u89e3\u7801\u540e\u7684\u5f15\u811a\u4e00\u5b9a\u4f1a\u6709\u4e00\u4e2a\u9ad8\u7535\u5e73\uff0c\u4f46\u662f\u6211\u4eec\u4e0d\u80fd\u8ba9\u53d1\u5c04\u6a21\u5757\u548c\u63a5\u6536\u6a21\u5757\u4e00\u76f4\u5904\u4e8e\u53d1\u5c04\u72b6\u6001\uff0c\u6240\u4ee5\u6b64\u65f6\u9700\u8981\u4e00\u4e2a\u9501\u5b58\u5668\u9501\u5b58\u5f53\u524d\u7684\u72b6\u6001\uff0c\u7ecf\u8fc7\u9501\u5b58\u5668\u540e\u7684\u6570\u636e\u63a5\u4e00\u4e2a\u8d1f\u8f7d\uff0c\u5373220V\u7684\u56fa\u6001\u7ee7\u7535\u5668\uff0c\u63a7\u5236\u706f\u5149\u7684\u5f00\u5173\u3002<\/p>\n<p>\u6211\u4eec\u5148\u4ecb\u7ecd\u4e00\u4e0bEV1527\u7684\u8fde\u63a5\u7535\u8def\u5427\u3002<\/p>\n<p>EV1527 \u662f\u4e00\u7247\u7531 CMOS \u8bbe\u8ba1\u5236\u9020\u7684\u53ef\u9884\u70e7\u5185\u7801\u7684\u5b66\u4e60\u7801\u7f16\u7801\u82af\u7247\uff0c\u7531\u8f6f\u4ef6\u89e3\u7801\uff0c\u5185\u7801\u5171\u6709 20 \u4f4d\u5143\u53ef\u9884\u70e7 100 \u4e07\u7ec4\u5185\u7801\u7ec4\u5408\uff0c\u5927\u5927\u964d\u4f4e\u4e86\u4f7f\u7528\u7f16\u7801\u4e0a\u91cd\u590d\u7684\u673a\u7387\u3002\u66f4\u91cd\u8981\u7684\u662f\u5176\u4e0d\u53ef\u590d\u5236\u6027\uff0c\u5e76\u4e14\u7531\u4e8e\u53ef\u4ee5\u81ea\u5b66\u4e60\uff0c\u5f53\u53d1\u5c04\u6a21\u5757\u4e22\u4e86\uff0c\u53ea\u8981\u5bf9\u63a5\u6536\u6a21\u5757\u8fdb\u884c\u81ea\u5b66\u4e60\u5c31\u53ef\u4ee5\u4f7f\u539f\u5148\u7684\u53d1\u5c04\u6a21\u5757\u5931\u6548\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5b89\u5168\u6027\u3002<\/p>\n<p>\u7535\u8def\u56fe\u5982\u4e0b\u56fe\u6240\u793a\u3002\u56fe\u4e2d ev1527 \u7684\u7b2c 5 \u811a\u81f3\u7b2c 8 \u811a\u662f\u6309\u952e\u8f93\u5165\u811a \uff0c\u5185\u542b\u63a5\u5730\u7535\u963b \uff0c\u5916\u63a5\u4e00\u4e2a4. 7 k\u03a9\u7684\u7535\u963b ,\u518d\u901a\u8fc7\u6309\u952e\u8fde\u5230\u7535\u6e90\u4e0a\u3002\u5f53 S1\uff5eS4 \u6709\u952e\u6309\u4e0b\u65f6 , EV1527 \u7684\u5bf9\u5e94\u811a\u4e0a\u5c31\u6709\u4e86\u4e00\u4e2a\u9ad8\u7535\u5e73\uff0c\u4e8e\u662f\u89e6\u53d1 EV1527 \u82af\u7247 \uff0c\u7b2c 4 \u811a\u5c31\u8f93\u51fa\u76f8\u5e94\u7684\u6570\u636e\u4e32\uff0c\u5b9e\u9645\u4f7f\u7528\u4e2d 4 \u811a\u63a5\u65e0\u7ebf\u53d1\u5c04\u6a21\u5757 DAT \u811a\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-71 aligncenter\" src=\"http:\/\/lst.wting.me\/wp-content\/uploads\/2017\/09\/2222222222222-300x171.png\" alt=\"\" width=\"300\" height=\"171\" srcset=\"https:\/\/lst.wting.top\/wp-content\/uploads\/2017\/09\/2222222222222-300x171.png 300w, https:\/\/lst.wting.top\/wp-content\/uploads\/2017\/09\/2222222222222.png 567w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u4e3a\u4e86\u80fd\u591f\u66f4\u597d\u7684\u96c6\u6210\u8fd9\u4e9b\u82af\u7247\uff0c\u6211\u4eec\u9700\u8981\u8d2d\u7f6ePCB\u53cc\u9762\u9540\u9521\u677f\u548c\u4e00\u5b9a\u7684\u7535\u963b\uff0c\u7bc7\u5e45\u6709\u9650\uff0c\u63a5\u4e0b\u6765\u6162\u6162\u8bb2\u89e3\u5173\u4e8e\u53d1\u5c04\u6a21\u5757\u7684\u57fa\u672c\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ecf\u8fc7\u4e0a\u5468\u672b\u4e24\u5929\u7684\u710a\u63a5\uff0c\u7ec8\u4e8e\u5b8c\u6210\u4e86433MHZ\u7684\u53d1\u5c04\u6a21\u5757\u8fde\u63a5\uff0c\u4f46\u662f\u63a5\u6536\u6a21\u5757\u5374\u59cb\u7ec8\u65e0\u6cd5\u6b63\u786e\u63a5\u6536\u4fe1\u53f7\u3002\u672c\u5468\u672b\u518d\u770b\u5982\u4f55 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/posts\/70"}],"collection":[{"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lst.wting.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70"}],"version-history":[{"count":1,"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/lst.wting.top\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/lst.wting.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lst.wting.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lst.wting.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}