{"id":3596,"date":"2017-02-24T19:51:13","date_gmt":"2017-02-24T10:51:13","guid":{"rendered":"http:\/\/denasu.com\/blog\/?p=3596"},"modified":"2017-03-26T16:18:53","modified_gmt":"2017-03-26T07:18:53","slug":"raspberry-pi%e3%82%92%e3%81%84%e3%81%98%e3%82%8b","status":"publish","type":"post","link":"https:\/\/denasu.com\/blog\/2017\/02\/diary3596","title":{"rendered":"Raspberry Pi\u3092\u3044\u3058\u308b"},"content":{"rendered":"<p>\u3061\u3087\u3063\u3068\u524d\u306bRaspberry Pi\u3092\u8cb7\u3063\u3066\u3044\u305f\u306e\u3067\u3044\u3058\u3063\u3066\u307f\u308b\u3002<\/p>\n<a href=\"http:\/\/denasu.com\/blog\/wp-content\/uploads\/2017\/02\/2017022501.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/denasu.com\/blog\/wp-content\/uploads\/2017\/02\/2017022501.jpg\" alt=\"\" width=\"400\" height=\"300\" class=\"size-full wp-image-3599\" \/><\/a>\n<p>Raspberry Pi\u306f\u5c0f\u3055\u3044\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u3001SD\u30ab\u30fc\u30c9\u306b\u5165\u308c\u305fOS\u3092\u8d77\u52d5\u3067\u304d\u308b\u3002\u307e\u305f\u3001\u96fb\u5b50\u90e8\u54c1\u3092\u4ed8\u3051\u3089\u308c\u308b\u30d4\u30f3\u304c\u3042\u308b\u306e\u3067\u96fb\u5b50\u5de5\u4f5c\u304c\u3067\u304d\u308b\u3002\u672c\u5f53\u306fArduino\u306bWi-Fi\u3068\u30ab\u30e1\u30e9\u3092\u4ed8\u3051\u3066\u30e9\u30b8\u30b3\u30f3\u3092\u30d1\u30ef\u30fc\u30a2\u30c3\u30d7\u3055\u305b\u305f\u304b\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u30e2\u30fc\u30bf\u30fc2\u500b\u3068Bluetooth\u3092\u4ed8\u3051\u305f\u6642\u70b9\u3067\u4ed6\u306e\u90e8\u54c1\u3092\u3064\u3051\u3089\u308c\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u6700\u521d\u304b\u3089Wi-Fi\u304c\u4ed8\u3044\u3066\u3044\u3066\u30ab\u30e1\u30e9\u7528\u7aef\u5b50\u306e\u4ed8\u3044\u3066\u3044\u308bRaspberry Pi\u3092\u8a66\u305d\u3046\u304b\u3068\u3002<\/p>\n<p>Raspberry Pi\u3068SD\u30ab\u30fc\u30c9\u3092\u8cb7\u3063\u3066\u304d\u3066\u3001HDMI\u3067\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3001USB\u3067\u30de\u30a6\u30b9\u3068\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u3064\u306a\u3050\u3002PC\u5074\u3067Raspbian\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306eLinux\uff09\u3092SD\u30ab\u30fc\u30c9\u306b\u5165\u308c\u3066\u6e96\u5099\u5b8c\u4e86\u3002\u3042\u3068\u306fRaspberry Pi\u3092\u8d77\u52d5\u3057\u3066OS\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u305f\u308aWi-Fi\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3001\u305d\u3053\u304b\u3089\u306fPC\u304b\u3089SSH\u3067\u64cd\u4f5c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>\u306a\u3093\u3060\u3051\u3069\u3001\u5bb6\u3067\u306fWi-Fi\u30eb\u30fc\u30bf\u3001\u5916\u3067\u30c6\u30b6\u30ea\u30f3\u30b0\u3067\u3064\u306a\u3054\u3046\u3068\u3059\u308b\u3068\u3001\u3069\u3046\u3057\u3066\u3082DHCP\u306b\u306a\u3063\u3066\u3064\u306a\u304e\u306b\u304f\u3044\u3002\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3092\u3064\u306a\u3044\u3067ifconfig\u3068\u304b\u306f\u304b\u306a\u308a\u9762\u5012\u3002\u3066\u3053\u3068\u3067\u307e\u305a\u6700\u521d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u3057\u3066\u3001Raspberry Pi\u3092\u8d77\u52d5\u3057\u305f\u3089IP\u30a2\u30c9\u30ec\u30b9\u3092Web\u306b\u901a\u77e5\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002\u521dPython\u3060\u3051\u3069\u3001\u3044\u308d\u3093\u306a\u30b3\u30d4\u30da\u306a\u306e\u3067\u3042\u307e\u308a\u3088\u304f\u5206\u304b\u3063\u3066\u306f\u3044\u306a\u3044\u3002<\/p>\n<pre class=\"brush:csharp\">\r\n# coding: utf-8\r\nimport urllib2\r\nimport subprocess\r\n\r\nurl = 'http:\/\/xxxxx\/cgi-bin\/xxxxx.cgi?ip='\r\ncmd = \"hostname -I\"\r\nip = subprocess.check_output(cmd,shell=True)\r\nurllib2.urlopen(url + ip)\r\n<\/pre>\n<p>\u3042\u3068\u306f\u3001Raspberry Pi\u3092\u8d77\u52d5\u3059\u308b\u3068\u52dd\u624b\u306bpi\u30e6\u30fc\u30b6\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u307f\u305f\u3044\u306a\u306e\u3067\u3001pi\u30e6\u30fc\u30b6\u306e.bashrc\u306b\u4ee5\u4e0b\u3092\u5165\u308c\u3066\u307f\u305f\u3002<\/p>\n<pre class=\"brush:csharp\">\r\npython \/home\/pi\/xxx.py &\r\n<\/pre>\n<p>Web\u5074\u306f\u3068\u308a\u3042\u3048\u305aCGI\u306b\u3057\u305f\u304c\u3001\u81ea\u4f5c\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u3044\u308d\u3044\u308d\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3053\u3053\u306b\u306f\u8f09\u305b\u304d\u308c\u306a\u3044\u3002\u3082\u3089\u3063\u305fIP\u30a2\u30c9\u30ec\u30b9\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3093\u3067\u3001\u6a19\u6e96\u51fa\u529b\u306b\u51fa\u3059\u3060\u3051\u306e\u3082\u306e\u3092\u3055\u304f\u3063\u3068\u4f5c\u3063\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067IP\u30a2\u30c9\u30ec\u30b9\u304c\u5206\u304b\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3082\u30de\u30a6\u30b9\u3068\u30ad\u30fc\u30dc\u30fc\u30c9\u3082\u4f7f\u3046\u5fc5\u8981\u304c\u306a\u304f\u306a\u3063\u305f\u3002\u4fbf\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3061\u3087\u3063\u3068\u524d\u306bRaspberry Pi\u3092\u8cb7\u3063\u3066\u3044\u305f\u306e\u3067\u3044\u3058\u3063\u3066\u307f\u308b\u3002 Raspberry Pi\u306f\u5c0f\u3055\u3044\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u3001SD\u30ab\u30fc\u30c9\u306b\u5165\u308c\u305fOS\u3092\u8d77\u52d5\u3067\u304d\u308b\u3002\u307e\u305f\u3001\u96fb\u5b50\u90e8\u54c1\u3092\u4ed8\u3051\u3089\u308c\u308b\u30d4\u30f3\u304c\u3042\u308b\u306e\u3067\u96fb\u5b50\u5de5\u4f5c\u304c\u3067\u304d\u308b\u3002\u672c\u5f53\u306fArduino\u306bWi-Fi\u3068\u30ab\u30e1\u30e9\u3092\u4ed8\u3051\u3066\u30e9\u30b8\u30b3\u30f3\u3092\u30d1\u30ef\u30fc\u30a2\u30c3\u30d7\u3055\u305b\u305f\u304b\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u30e2\u30fc\u30bf\u30fc2\u500b\u3068Bluetooth\u3092\u4ed8\u3051\u305f\u6642\u70b9\u3067\u4ed6\u306e\u90e8\u54c1\u3092\u3064\u3051\u3089\u308c\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u6700\u521d\u304b\u3089Wi-Fi\u304c\u4ed8\u3044\u3066\u3044\u3066\u30ab\u30e1\u30e9\u7528\u7aef\u5b50\u306e\u4ed8\u3044\u3066\u3044\u308bRaspberry Pi\u3092\u8a66\u305d\u3046\u304b\u3068\u3002 Raspberry Pi\u3068SD\u30ab\u30fc\u30c9\u3092\u8cb7\u3063\u3066\u304d\u3066\u3001HDMI\u3067\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3001USB\u3067\u30de\u30a6\u30b9\u3068\u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u3064\u306a\u3050\u3002PC\u5074\u3067Raspbian\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306eLinux\uff09\u3092SD\u30ab\u30fc\u30c9\u306b\u5165\u308c\u3066\u6e96\u5099\u5b8c\u4e86\u3002\u3042\u3068\u306fRaspberry Pi\u3092\u8d77\u52d5\u3057\u3066OS\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u305f\u308aWi-Fi\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3001\u305d\u3053\u304b\u3089\u306fPC\u304b\u3089SSH\u3067\u64cd\u4f5c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002 \u306a\u3093\u3060\u3051\u3069\u3001\u5bb6\u3067\u306fWi-Fi\u30eb\u30fc\u30bf\u3001\u5916\u3067\u30c6\u30b6\u30ea\u30f3\u30b0\u3067\u3064\u306a\u3054\u3046\u3068\u3059\u308b\u3068\u3001\u3069\u3046\u3057\u3066\u3082DHCP\u306b\u306a\u3063\u3066\u3064\u306a\u304e\u306b\u304f\u3044\u3002\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3092\u3064\u306a\u3044\u3067ifconfig\u3068\u304b\u306f\u304b\u306a\u308a\u9762\u5012\u3002\u3066\u3053\u3068\u3067\u307e\u305a\u6700\u521d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u3057\u3066\u3001Raspberry Pi\u3092\u8d77\u52d5\u3057\u305f\u3089IP\u30a2\u30c9\u30ec\u30b9\u3092Web\u306b\u901a\u77e5\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3002\u521dPython\u3060\u3051\u3069\u3001\u3044\u308d\u3093\u306a\u30b3\u30d4\u30da\u306a\u306e\u3067\u3042\u307e\u308a\u3088\u304f\u5206\u304b\u3063\u3066\u306f\u3044\u306a\u3044\u3002 # coding: utf-8 import urllib2 import subprocess url = &#8216;http:\/\/xxxxx\/cgi-bin\/xxxxx.cgi?ip=&#8217; cmd = &#8220;hostname -I&#8221; ip = subprocess.check_output(cmd,shell=True) urllib2.urlopen(url + ip) \u3042\u3068\u306f\u3001Raspberry Pi\u3092\u8d77\u52d5\u3059\u308b\u3068\u52dd\u624b\u306bpi\u30e6\u30fc\u30b6\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u307f\u305f\u3044\u306a\u306e\u3067\u3001pi\u30e6\u30fc\u30b6\u306e.bashrc\u306b\u4ee5\u4e0b\u3092\u5165\u308c\u3066\u307f\u305f\u3002 python \/home\/pi\/xxx.py &#038; Web\u5074\u306f\u3068\u308a\u3042\u3048\u305aCGI\u306b\u3057\u305f\u304c\u3001\u81ea\u4f5c\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u3044\u308d\u3044\u308d\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3053\u3053\u306b\u306f\u8f09\u305b\u304d\u308c\u306a\u3044\u3002\u3082\u3089\u3063\u305fIP\u30a2\u30c9\u30ec\u30b9\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3093\u3067\u3001\u6a19\u6e96\u51fa\u529b\u306b\u51fa\u3059\u3060\u3051\u306e\u3082\u306e\u3092\u3055\u304f\u3063\u3068\u4f5c\u3063\u305f\u3002 \u3053\u308c\u3067IP\u30a2\u30c9\u30ec\u30b9\u304c\u5206\u304b\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3082\u30de\u30a6\u30b9\u3068\u30ad\u30fc\u30dc\u30fc\u30c9\u3082\u4f7f\u3046\u5fc5\u8981\u304c\u306a\u304f\u306a\u3063\u305f\u3002\u4fbf\u5229\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,3,41],"tags":[45],"class_list":["post-3596","post","type-post","status-publish","format-standard","hentry","category-programming","category-computer","category-41","tag-raspberrypi"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4ZThs-W0","_links":{"self":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/3596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/comments?post=3596"}],"version-history":[{"count":11,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/3596\/revisions"}],"predecessor-version":[{"id":3622,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/3596\/revisions\/3622"}],"wp:attachment":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/media?parent=3596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/categories?post=3596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/tags?post=3596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}