{"id":1245,"date":"2018-05-02T20:12:37","date_gmt":"2018-05-02T11:12:37","guid":{"rendered":"https:\/\/www.dogrow.net\/elecronics\/?p=1245"},"modified":"2019-10-21T03:49:41","modified_gmt":"2019-10-20T18:49:41","slug":"blog23","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/elecronics\/blog23\/","title":{"rendered":"(23) \u3010\u9023\u8f091-3\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1aLED\u70b9\u6ec5"},"content":{"rendered":"<h1 class=\"my_h\">1. \u3084\u3063\u3066\u307f\u305f\u3044\u3053\u3068<\/h1>\n<p><a href=\"https:\/\/www.dogrow.net\/elecronics\/blog21\/\">(21) \u30101-1\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u9078\u5b9a<\/a> \u3067\u306f\u3001\u300c\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u3067\u96fb\u5b50\u5de5\u4f5c\u300d\u306e\u4f5c\u696d\u74b0\u5883\u3068\u3057\u3066 Raspberry Pi \u3092\u4f7f\u3046\u3068\u6c7a\u3081\u305f\u3002<br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog22\/\">(22) \u30101-2\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u30e9\u30ba\u30d1\u30a4\u521d\u671f\u8a2d\u5b9a<\/a> \u3067\u306f\u30e9\u30ba\u30d1\u30a4\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u30bb\u30c3\u30c6\u30a3\u30f3\u30b0\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u30e9\u30ba\u30d1\u30a4\u3092\u4f7f\u3063\u3066\u3001\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u4e0a\u306b\u5b9f\u88c5\u3057\u305f LED\u3092\u70b9\u6ec5\u3055\u305b\u3066\u307f\u305f\u3044\u3002<br \/>\n\u3044\u308d\u3044\u308d\u306a\u3068\u3053\u308d\u3067\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u6271\u308f\u308c\u3066\u3044\u308b\u57fa\u672c\u4e2d\u306e\u57fa\u672c\u3060\u3002<\/p>\n<p>\u30e9\u30ba\u30d1\u30a4\u306e I\/O\u30dd\u30fc\u30c8\u3092\u5f04\u308b\u8a18\u5ff5\u3059\u3079\u304d\u7b2c\u4e00\u6b69\u3060\u3002<br \/>\n\u3061\u3083\u3093\u3068\u8a18\u9332\u3057\u3066\u304a\u304d\u305f\u3044\u3002<\/p>\n<h1 class=\"my_h\">2. I\/O<\/h1>\n<h3 class=\"my_h\">(1) I\/O\u30dd\u30fc\u30c8\u3068\u306f\uff1f<\/h3>\n<p>I\/O\u306f Input\uff08\u5165\u529b\uff09\u3068 Output\uff08\u51fa\u529b\uff09\u306e\u5148\u982d 2\u6587\u5b57\u3092\u53d6\u3063\u3066\u7e4b\u3052\u305f\u3082\u306e\u3002<br \/>\n\u30dd\u30fc\u30c8\u306f Port\uff08\u6e2f\uff09\u306e\u3053\u3068\u3002<\/p>\n<p>\u3064\u307e\u308a&#8230;<\/p>\n<p class=\"my_fc_deeppink my_fs_big3\">I\/O\u30dd\u30fc\u30c8\u3068\u306f\u30de\u30a4\u30b3\u30f3\u3068\u5916\u90e8\u56de\u8def\u3068\u306e\u9593\u3092\u7269\u304c\u5165\u3063\u305f\u308a\u51fa\u305f\u308a\u3059\u308b\u6e2f<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3002<\/p>\n<p>\u96fb\u5b50\u56de\u8def\u306b\u3068\u3063\u3066\u306f\u300c\u51fa\u5165\u308a\u3059\u308b\u7269\u300d\u3068\u306f\u60c5\u5831\uff08\uff1d\u30c7\u30b8\u30bf\u30eb\u4fe1\u53f7\u3084\u30a2\u30ca\u30ed\u30b0\u4fe1\u53f7\uff09\u306e\u3053\u3068\u3002<br \/>\n\u5b9f\u969b\u306b\u306f I\/O\u306e\u7aef\u5b50\u306b\u304b\u304b\u308b\u610f\u5473\u3092\u6301\u3063\u305f\u96fb\u5727\u306e\u5927\u304d\u3055\u306e\u3053\u3068\u3002<\/p>\n<p>\u30c7\u30b8\u30bf\u30eb\u4fe1\u53f7\u3067\u3042\u308c\u3070\u3001\u7e4b\u304c\u308c\u305f\u4e21\u8005\u306f\u3001\u96fb\u5727\u306e\u3042\u308b\u95be\u5024\u3092\u5883\u306b High \/ Low \u3068\u8a8d\u8b58\u3059\u308b\u3057\u3001<br \/>\n\u30a2\u30ca\u30ed\u30b0\u4fe1\u53f7\u3067\u3042\u308c\u3070\u3001\u7e4b\u304c\u308c\u305f\u4e21\u8005\u306f\u3001\u96fb\u5727\u306e\u5024\u81ea\u4f53\u306b\u610f\u5473\u3092\u8a8d\u8b58\u3059\u308b\u3002<\/p>\n<h3 class=\"my_h\">(2) GPIO\u3068\u306f\uff1f<\/h3>\n<p>Global Purpose I\/O\u3092\u7565\u3057\u305f\u3082\u306e\u3002<\/p>\n<p>\u3064\u307e\u308a&#8230;<br \/>\nGlobal\uff08\u6c4e\u7528\u7684\u306a\uff09Purpose\uff08\u76ee\u7684\uff09\u3067\u4f7f\u3046 I\/O\u306e\u3053\u3068\u3002<\/p>\n<p>\u3064\u307e\u308a&#8230;<br \/>\n\u30de\u30a4\u30b3\u30f3\u306e I\/O\u7aef\u5b50\u304c\u30de\u30a4\u30b3\u30f3\u5185\u90e8\u3067\u7279\u5b9a\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\uff08\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3001AD\u30b3\u30f3\u30d0\u30fc\u30bf\u3001\u30e1\u30e2\u30ea\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u7b49\u3005\uff09\u306b\u7e4b\u304c\u308c\u3066\u3044\u308b\u306e\u3067\u306f\u306a\u304f\u3001<\/p>\n<p class=\"my_fc_deeppink my_fs_big3\">\u30de\u30a4\u30b3\u30f3\u4e0a\u3067\u52d5\u4f5c\u3059\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3067\u597d\u304d\u306b\u4f7f\u3063\u3066\u3088\u3044\u3067\u3059\u3088<\/p>\n<p>\u3068\u3044\u3046\u6c4e\u7528\u76ee\u7684\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308b I\/O\u30dd\u30fc\u30c8\u306e\u3053\u3068\u3002<\/p>\n<p>\u3088\u3063\u3066&#8230;<br \/>\n\u3053\u3053\u306b LED\u3092\u7e4b\u3052\u3066\u70b9\u706f\u3001\u6d88\u706f\u3092\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3067\u5236\u5fa1\u3057\u3066\u3088\u3044\u306e\u3060\u3002<\/p>\n<h1 class=\"my_h\">3. \u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u4e0a\u306bLED\u70b9\u706f\u56de\u8def\u3092\u5b9f\u88c5<\/h1>\n<p><a href=\"https:\/\/www.dogrow.net\/elecronics\/blog1\/\">(1) LED\u3092\u70b9\u706f\u3055\u305b\u308b<\/a> \u3067\u7d44\u3093\u3060\u3082\u306e\u3092\u4f7f\u7528\u3059\u308b\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/001-2.png\" alt=\"\" \/><\/p>\n<h1 class=\"my_h\">4. \u30e9\u30ba\u30d1\u30a4\u3068\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u3092\u63a5\u7d9a<\/h1>\n<h3 class=\"my_h\">(1) \u30e9\u30ba\u30d1\u30a4 GPIO\u306e\u3069\u3053\u3068\u7e4b\u3050\uff1f<\/h3>\n<p>\u524d\u8ff0\u306e\u3088\u3046\u306b GPIO\u306f\u300c\u30bd\u30d5\u30c8\u3067\u81ea\u7531\u306b\u4f7f\u3063\u3066\u3088\u3044\u3088\u300d\u3068\u3044\u3046 I\/O\u306a\u306e\u3067\u3001\u3069\u3053\u3092\u4f7f\u3063\u3066\u3082\u3088\u3044\u3002<\/p>\n<p>\u305f\u3060\u3057&#8230;<br \/>\n<span class=\"my_fc_crimson\">GPIO2\u306f SDA1\u3068\u517c\u7528<\/span><br \/>\n\u306e\u3088\u3046\u306b\u3001\u4ed6\u306e\u7528\u9014\u3068\u517c\u7528\u3067\u304d\u308b\u7aef\u5b50\u3082\u3042\u308b\u306e\u3067\u4f7f\u3044\u65b9\u306b\u6ce8\u610f\u3059\u308b\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u4ed6\u3068\u517c\u7528\u3055\u308c\u3066\u3044\u306a\u3044 GPIO No.17\uff08\uff1dPin #11\uff09\u3092\u4f7f\u3046\u3053\u3068\u306b\u3059\u308b\u3002<br \/>\n\u3053\u306e\u7aef\u5b50\u306f High\u72b6\u614b\u3067 3.3V\u3092\u51fa\u529b\u3059\u308b\u306e\u3067\u4e7e\u96fb\u6c60 2\u500b\u5206\u3068\u601d\u3048\u3070\u3088\u3044\u3002<\/p>\n<p>\u3053\u306e\u7aef\u5b50\u3092\u51fa\u529b\u30dd\u30fc\u30c8\uff08\uff1d\u30de\u30a4\u30b3\u30f3 \u2192 \u5916\u90e8\u56de\u8def\u306e\u8f38\u51fa\u65b9\u5411\u3067\u4f7f\u7528\uff09\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u3001\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3067\u3053\u306e\u30dd\u30fc\u30c8\u306e\u96fb\u5727\u306e High\/Low \u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u306b\u3088\u308a\u3001LED\u306e\u70b9\u706f\/\u6d88\u706f\u3092\u5236\u5fa1\u3059\u308b\u306e\u3060\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/028.png\" alt=\"\" \/><br \/>\n<a href=\"https:\/\/www.raspberrypi.org\/documentation\/usage\/gpio\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.raspberrypi.org\/documentation\/usage\/gpio\/README.md<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/004-2.png\" alt=\"\" \/><\/a><\/p>\n<p><span class=\"my_fc_crimson\">GPIO\u306e\u30d4\u30f3\u914d\u7f6e\u3092\u30d7\u30ea\u30f3\u30c8\u3057\u3066\u624b\u5143\u306b\u7f6e\u3044\u3066\u304a\u304b\u306a\u3051\u308c\u3070\uff01<\/span><\/p>\n<p>\u3063\u3066\u601d\u3063\u305f\u3051\u3069\u3001<br \/>\nGPIO\u306e\u30d4\u30f3\u914d\u7f6e\u306f Terminal\u3067 pinout \u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u898b\u3089\u308c\u308b\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/098.png\" alt=\"\" \/><\/p>\n<h3 class=\"my_h\">(2) \u63a5\u7d9a<\/h3>\n<p>\u30b8\u30e3\u30f3\u30d1\u30fc\u7dda\uff08\u30aa\u30b9\uff0d\u30e1\u30b9\uff09\uff58 2\u672c\u4f7f\u3044\u3001\u30e9\u30ba\u30d1\u30a4\u3068\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u3092\u7e4b\u3050\u3002<br \/>\n\u30fb1\u672c\u76ee\uff08\u8d64\u8272\uff09\uff1a Pin#11\uff08GPIO17\uff09\uff0d \u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\uff08\u96fb\u6e90\u30e9\u30a4\u30f3\uff09<br \/>\n\u30fb2\u672c\u76ee\uff08\u9ed2\u8272\uff09\uff1a Pin#6\uff08GND\uff09 \uff0d \u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\uff08\u30b0\u30e9\u30a6\u30f3\u30c9\u30e9\u30a4\u30f3\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/002-2.png\" alt=\"\" \/><\/p>\n<h1 class=\"my_h\">5. \u307e\u305a\u306f Python Shell\u4e0a\u3067\u7df4\u7fd2<\/h1>\n<p><span class=\"my_fc_deeppink\">Raspberry Pi\u306e Pi\u306f Python \u306e Pi<\/span><br \/>\n\u3068\u3044\u3046\u30eb\u30fc\u30c4\u3060\u305d\u3046\u306a\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e Python\u3067\u66f8\u304f\u3002<\/p>\n<p>Python\u306f Python Shell\u4e0a\u3067 1\u884c\u305a\u3064\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<br \/>\n\u307e\u3068\u307e\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u4e00\u6c17\u306b\u5b9f\u884c\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u307e\u305a\u306f 1\u884c\u305a\u3064\u5b9f\u884c\u3057\u3066\u7df4\u7fd2\u3059\u308b\u3002<\/p>\n<h3 class=\"my_h\">(1) \u30bf\u30fc\u30df\u30ca\u30eb\u3092\u8d77\u52d5\u3057\u3001Python3\u3092\u5b9f\u884c\u3059\u308b\u3002<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npython3\r\n<\/pre>\n<h3 class=\"my_h\">(2) \u5fc5\u8981\u306a Python\u30e2\u30b8\u30e5\u30fc\u30eb\uff08\uff1d\u30d1\u30c3\u30b1\u30fc\u30b8\uff09\u3092\u8aad\u307f\u8fbc\u3080\u3002<\/h3>\n<p>\u30e9\u30ba\u30d1\u30a4\u306e GPIO\u3092\u5236\u5fa1\u3057\u3066\u304f\u308c\u308b Python\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3044\u308d\u3044\u308d\u3042\u308b\u304c\u3001\u3053\u3053\u3067\u306f Raspbian OS\u306b\u6700\u521d\u304b\u3089\u5165\u3063\u3066\u3044\u308b <a href=\"https:\/\/sourceforge.net\/projects\/raspberry-gpio-python\/\" target=\"_blank\" rel=\"noopener noreferrer\">RPi.GPIO<\/a> \u3092\u4f7f\u3046\u3002\u4f7f\u7528\u3059\u308b\u5ea6\u306b\u300cRPi.GPIO\u300d\u3068\u66f8\u304f\u3068\u9577\u3044\u306e\u3067\u3001alias\uff08\u77ed\u3044\u540d\u524d\uff09\u3068\u3057\u3066 GPIO\u3092\u5ba3\u8a00\u3057\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport RPi.GPIO as GPIO\r\n<\/pre>\n<h3 class=\"my_h\">(3) GPIO\u3092\u521d\u671f\u5316\u3059\u308b\u3002<\/h3>\n<p>GPIO\u5236\u5fa1\u95a2\u6570\u3067\u5236\u5fa1\u5bfe\u8c61\u306e\u30d4\u30f3\u3092\u6307\u5b9a\u3059\u308b\u969b\u306b\u3001\u30d4\u30f3\u756a\u53f7\u3067\u306f\u306a\u304f GPIO\u756a\u53f7\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306b\u3059\u308b\u3002<br \/>\n\u30fb\u30d4\u30f3\u756a\u53f7\u6307\u5b9a\uff1a GPIO.BOARD<br \/>\n\u30fbGPIO\u756a\u53f7\u6307\u5b9a\uff1a GPIO.BCM<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nGPIO.setmode(GPIO.BCM)\r\n<\/pre>\n<p>GPIO17\u3092\u51fa\u529b\u30dd\u30fc\u30c8\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nGPIO.setup(17, GPIO.OUT)\r\n<\/pre>\n<h3 class=\"my_h\">(4) LED\u3092\u70b9\u706f \/ \u6d88\u706f\u3059\u308b\u3002<\/h3>\n<p>\u70b9\u706f\u3059\u308b\u3002\uff08\u96fb\u5727 3.3V\uff09<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nGPIO.output(17, GPIO.HIGH)\r\n<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/003-2.png\" alt=\"\" \/><\/p>\n<p>\u6d88\u706f\u3059\u308b\u3002\uff08\u96fb\u5727 0V\uff09<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nGPIO.output(17, GPIO.LOW)\r\n<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/004-3.png\" alt=\"\" \/><\/p>\n<p>\u307e\u3068\u3081\u308b\u3068&#8230;<br \/>\n\u305f\u3063\u305f\u306e 5\u884c\u306e\u547d\u4ee4\u3067 LED\u306e\u70b9\u706f\/\u6d88\u706f\u304c\u3067\u304d\u3066\u3057\u307e\u3063\u305f\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport RPi.GPIO as GPIO\r\nGPIO.setmode(GPIO.BCM)\r\nGPIO.setup(17, GPIO.OUT)\r\nGPIO.output(17, GPIO.HIGH)\r\nGPIO.output(17, GPIO.LOW)\r\n<\/pre>\n<p>\u30e9\u30ba\u30d1\u30a4\u516c\u5f0f\u30da\u30fc\u30b8\u3067\u306f\u3001GPIO\u5236\u5fa1\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066 <a href=\"https:\/\/www.raspberrypi.org\/documentation\/usage\/gpio\/python\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">GPIO Zero<\/a> \u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3046\u3068\u3082\u3063\u3068\u7c21\u5358\u306b\u66f8\u3051\u308b\u3088\u3046\u3060\u3051\u308c\u3069\u3082\u3001\u904e\u5270\u30b5\u30fc\u30d3\u30b9\u3068\u8a00\u3046\u304b\u3001GPIO\u3092\u96a0\u3057\u3059\u304e\u3066\u3044\u308b\u611f\u3058\u304c\u3057\u305f\u306e\u3067\u4f7f\u308f\u306a\u304b\u3063\u305f\u3002\u56e0\u307f\u306b\u4e0a\u306e 5\u884c\u306e\u547d\u4ee4\u3092 GPIO Zero\u3092\u4f7f\u3063\u3066\u66f8\u304d\u63db\u3048\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nfrom gpiozero import LED\r\nled = LED(17)\r\nled.on()\r\nled.off()\r\n<\/pre>\n<p>\u307e\u3041\u597d\u307f\u306e\u554f\u984c\u3060\u306a&#8230;<\/p>\n<h1 class=\"my_h\">6. LED\u3092\u70b9\u6ec5\uff08\uff1d\u5468\u671f\u7684\u306b\u70b9\u706f\/\u6d88\u706f\uff09\u3055\u305b\u308b\u3002<\/h1>\n<p>\u4e0a\u306e Python Shell\u3067\u5b9f\u884c\u3057\u305f\u3082\u306e\u3092\u5468\u671f\u7684\u306b\u5b9f\u884c\u3055\u305b\u308c\u3070\u3088\u3044\u3060\u3051\u3002<\/p>\n<h3 class=\"my_h\">(1) \u307e\u305a\u306f Python Shell\u4e0a\u3067\u5b9f\u884c<\/h3>\n<p>\u4eca\u56de\u306f\u3001\u5468\u671f\u51e6\u7406\u306e\u5b9f\u73fe\u624b\u6bb5\u3068\u3057\u3066\u3001\u30d7\u30ed\u30bb\u30b9\u3092\u30b9\u30ea\u30fc\u30d7\u72b6\u614b\u306b\u3055\u305b\u308b time.sleep() \u3092\u4f7f\u7528\u3059\u308b\u3002<\/p>\n<p>\u4eca\u5ea6\u306f RPi.GPIO\u306f Alias\u3092\u4f7f\u308f\u305a\u306b\u66f8\u3044\u3066\u307f\u308b\u3002<br \/>\n\u500b\u4eba\u7684\u306b\u306f Alias\u3092\u4f7f\u308f\u306a\u3044\u65b9\u304c\u6240\u5c5e\u304c\u308f\u304b\u3063\u3066\u898b\u3084\u3059\u3044\u306e\u3067\u597d\u304d\u3060\u3002\uff08case by case\u3060\u3051\u308c\u3069\u3082&#8230;\uff09<\/p>\n<p>LED\u306e\u70b9\u706f\u6d88\u706f\u3092 1\u79d2\u9593\u9694\u3067 5\u56de\u7e70\u308a\u8fd4\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u3092 Python Shell\u4e0a\u3067\u66f8\u3044\u3066\u307f\u308b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport RPi\r\nimport time\r\n\r\nRPi.GPIO.setmode(RPi.GPIO.BCM)\r\nRPi.GPIO.setup(17, RPi.GPIO.OUT)\r\n\r\nfor i in range(0,5):\r\n    RPi.GPIO.output(17, RPi.GPIO.HIGH)\r\n    time.sleep(1)\r\n    RPi.GPIO.output(17, RPi.GPIO.LOW)\r\n    time.sleep(1)\r\n\r\nRPi.GPIO.cleanup()\r\n<\/pre>\n<p>LED\u3092\u70b9\u6ec5\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u305f\uff01<\/p>\n<p>\u6700\u5f8c\u306e<br \/>\nRPi.GPIO.cleanup()<br \/>\n\u3067\u306f\u3001\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u30bb\u30c3\u30c6\u30a3\u30f3\u30b0\u3057\u305f GPIO\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30af\u30ea\u30a2\u3057\u3066\u3044\u308b\u3002<\/p>\n<h3 class=\"my_h\">(2) \u30d7\u30ed\u30b0\u30e9\u30e0\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u3044\u3066\u30b7\u30a7\u30eb\u304b\u3089\u5b9f\u884c<\/h3>\n<p>\u4e0a\u8a18(1)\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304f\u3002<br \/>\n\u3053\u3053\u3067\u306f\u30e9\u30ba\u30d1\u30a4\u4e0a\u306e VI\u30a8\u30c7\u30a3\u30bf\u3067\u66f8\u3044\u305f\u304c\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u306a\u3089\u4f55\u3067\u3082\u3088\u3044\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/elecronics\/wp-content\/uploads\/2018\/05\/010-1.png\" alt=\"\" \/><\/p>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3002<br \/>\npython3\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u5f15\u6570\u306b\u3001\u4e0a\u3067\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308c\u3070\u3088\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npython3 test23.py\r\n<\/pre>\n<p>\u3067\u304d\u305f\uff01<br \/>\n<video style=\"max-width:100%\" src=\"https:\/\/www.dogrow.net\/elecronics\/samples\/00023\/ledonoff.mp4\" controls><\/video><\/p>\n<h1 class=\"my_h\">7. \u6240\u611f<\/h1>\n<p>\u30e9\u30ba\u30d1\u30a4\u306b\u671f\u5f85\u3057\u305f\u901a\u308a\u3001\u3068\u3063\u3066\u3082\u7c21\u5358\u306a\u624b\u9806\u3067 GPIO\u7d4c\u7531\u3067\u5916\u90e8\u306e\u30c7\u30d0\u30a4\u30b9\u3092\u5236\u5fa1\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u305f\u3002<\/p>\n<p>\u3067\u3082&#8230;<br \/>\n\u3068\u3063\u3066\u3082\u5927\u5207\u306a\u90e8\u5206\u304c RPi\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u96a0\u3055\u308c\u3066\u3044\u3066\u30d6\u30e9\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u611f\u306f\u5426\u3081\u306a\u3044&#8230;<\/p>\n<p>\u305d\u306e\u8fba\u308a\u307e\u3067\u5f04\u308a\u305f\u304f\u306a\u3063\u305f\u3089\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u3051\u3070\u3088\u3044\u306e\u3060\u3002<br \/>\n\u4eca\u56de\u306e\u76ee\u7684\u306f\u3001\u30de\u30a4\u30b3\u30f3\u5236\u5fa1\u3092\u5b66\u3076\u3053\u3068\u3067\u306f\u306a\u304f\u3001I\/O\u30dd\u30fc\u30c8\u306e\u5148\u306b\u7e4b\u304c\u3063\u3066\u3044\u308b\u96fb\u5b50\u5de5\u4f5c\u7269\u3092\u52d5\u304b\u3059\u3053\u3068\u3060\u3002<\/p>\n<p>\u3088\u3063\u3066<\/p>\n<p class=\"my_fc_deeppink my_fs_big6\">\u4eca\u306f\u3053\u308c\u3067\u3088\u3057\uff01<\/p>\n<p>\u3068\u5272\u308a\u5207\u308b\u3002<\/p>\n<p>\u3057\u304b\u3057\u3068\u3063\u3066\u3082\u697d\u3060&#8230;<br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog12\/\">(12) LED\u3092\u70b9\u6ec5\u3055\u305b\u308b<\/a> \u3067\u306f\u30c8\u30e9\u30f3\u30b8\u30b9\u30bf\u3068\u30b3\u30f3\u30c7\u30f3\u30b5\u3068\u62b5\u6297\u3092\u7d44\u307f\u5408\u308f\u305b\u3066 LED\u3092\u70b9\u6ec5\u3055\u305b\u305f\u3002<br \/>\n\u70b9\u6ec5\u5468\u671f\u3092\u5909\u3048\u305f\u3051\u308c\u3070\u5bb9\u91cf\u306e\u9055\u3046\u30b3\u30f3\u30c7\u30f3\u30b5\u3092\u7e4b\u3052\u305f\u308a\u3001\u62b5\u6297\u306e\u5927\u304d\u3055\u3092\u5909\u3048\u305f\u308a\u3057\u3066\u3044\u305f\u3002<\/p>\n<p>\u3067\u3082&#8230;<br \/>\n\u30de\u30a4\u30b3\u30f3\u3092\u4f7f\u3048\u3070\u3001LED\u70b9\u706f\u56de\u8def\u3060\u3051\u3067\u70b9\u6ec5\u3082\u51fa\u6765\u3066\u3057\u307e\u3046\u3002<br \/>\n\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u4e0a\u306e\u30d1\u30fc\u30c4\u5dee\u3057\u63db\u3048\u3084\u30ce\u30d6\u56de\u8ee2\u306a\u3069\u3092\u305b\u305a\u306b\u3001\u70b9\u6ec5\u5468\u671f\u3092\u5909\u3048\u3089\u308c\u3066\u3057\u307e\u3046\u3002<\/p>\n<p>\u96fb\u5b50\u56de\u8def\u3092\u7d44\u307f\u66ff\u3048\u3066\u3044\u308d\u3044\u308d\u3068\u5236\u5fa1\u3057\u3088\u3046\u3068\u3059\u308b\u6c17\u304c\u5931\u305b\u3066\u3057\u307e\u3046\u304f\u3089\u3044\u306b\u697d\u3060&#8230;<\/p>\n<p class=\"my_fc_deeppink my_fs_big3\">\u3060\u304b\u3089\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304c\u3042\u3061\u3053\u3061\u3067\u4f7f\u308f\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3060\u306a\u3041<\/p>\n<p>\u3068\u6539\u3081\u3066\u5b9f\u611f\u3057\u305f\u3002<\/p>\n<h1 class=\"my_h\">\u53c2\u8003\u60c5\u5831<\/h1>\n<p>\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002 m(_ _)m<br \/>\n<a href=\"https:\/\/qiita.com\/masato\/items\/715e28e0c0c945a54297\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/qiita.com\/masato\/items\/715e28e0c0c945a54297<\/a><br \/>\n<a href=\"https:\/\/tool-lab.com\/make\/raspberrypi-startup-22\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/tool-lab.com\/make\/raspberrypi-startup-22\/<\/a><\/p>\n<h1 class=\"my_h\">\u9023\u8f09<\/h1>\n<p>Raspberry Pi\u306e\u521d\u671f\u8a2d\u5b9a\u304b\u3089\u7c21\u5358\u306a\u52d5\u4f5c\u5b9f\u9a13\u307e\u3067\u3001\u4ee5\u4e0b\u306f\u30de\u30a4\u30b3\u30f3\u5236\u5fa1\u5165\u9580\u306e\u9023\u8f09\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog21\/\" rel=\"noopener noreferrer\">(21) \u3010\u9023\u8f091-1\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u9078\u5b9a<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog22\/\" rel=\"noopener noreferrer\">(22) \u3010\u9023\u8f091-2\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u30e9\u30ba\u30d1\u30a4\u521d\u671f\u8a2d\u5b9a<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog23\/\" rel=\"noopener noreferrer\">(23) \u3010\u9023\u8f091-3\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1aLED\u70b9\u6ec5<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog24\/\" rel=\"noopener noreferrer\">(24) \u3010\u9023\u8f091-4\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u6642\u5831\u3092\u4f5c\u308b<\/a>\u3000<span class=\"my_fc_deeppinkBBig\">\u2190\u6b21\u56de<\/span><br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog26\/\" rel=\"noopener noreferrer\">(26) \u3010\u9023\u8f091-5\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u30fc\u3092\u5efb\u3059<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/elecronics\/blog27\/\" rel=\"noopener noreferrer\">(27) \u3010\u9023\u8f091-6\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u5408\u6210\u97f3\u58f0\u3067\u6642\u5831<\/a><\/p>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>1. \u3084\u3063\u3066\u307f\u305f\u3044\u3053\u3068 (21) \u30101-1\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u9078\u5b9a \u3067\u306f\u3001\u300c\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u3067\u96fb\u5b50\u5de5\u4f5c\u300d\u306e\u4f5c\u696d\u74b0\u5883\u3068\u3057\u3066 Raspberry Pi \u3092\u4f7f\u3046\u3068\u6c7a\u3081\u305f\u3002 (22) \u30101-2\u3011\u30de\u30a4\u30b3\u30f3\u3067\u96fb\u5b50\u5de5\u4f5c\u5165\u9580\uff1a\u30e9\u30ba\u30d1\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/elecronics\/blog23\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,18,17,19],"tags":[],"class_list":["post-1245","post","type-post","status-publish","format-standard","hentry","category-led","category-raspberry-pi","category-17","category-micom"],"views":5069,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/posts\/1245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/comments?post=1245"}],"version-history":[{"count":87,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/posts\/1245\/revisions"}],"predecessor-version":[{"id":1919,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/posts\/1245\/revisions\/1919"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/media?parent=1245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/categories?post=1245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/elecronics\/wp-json\/wp\/v2\/tags?post=1245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}