{"id":7496,"date":"2021-02-01T23:17:35","date_gmt":"2021-02-01T14:17:35","guid":{"rendered":"http:\/\/fisherman.jp\/23\/?p=7496"},"modified":"2021-02-07T16:41:22","modified_gmt":"2021-02-07T07:41:22","slug":"%e6%a4%9c%e8%a8%bc-gpio-%e5%87%ba%e5%8a%9b%e3%83%9d%e3%83%bc%e3%83%88%e3%82%92%e5%8f%8d%e8%bb%a2-%e3%83%88%e3%82%b0%e3%83%ab%e5%87%ba%e5%8a%9b","status":"publish","type":"post","link":"http:\/\/fisherman.jp\/23\/7496","title":{"rendered":"\u691c\u8a3c GPIO \u51fa\u529b\u30dd\u30fc\u30c8\u3092\u53cd\u8ee2 \u30c8\u30b0\u30eb\u51fa\u529b"},"content":{"rendered":"<p>\u691c\u8a3c GPIO \u51fa\u529b\u30dd\u30fc\u30c8\u3092\u53cd\u8ee2 \u30c8\u30b0\u30eb\u51fa\u529b Raspberry PI Zero WH<br \/>\n(test.py)<br \/>\nimport RPi.GPIO as GPIO<br \/>\n#GPIO\u30dd\u30fc\u30c8\u8a2d\u5b9a<br \/>\nGPIO.setwarnings(False) #disable RuntimeWarning: This channel is already in use, continuing anyway<br \/>\nGPIO.setmode(GPIO.BCM)<br \/>\nGPIO.setup(17, GPIO.OUT, initial=GPIO.HIGH) #default=HIGH?<br \/>\nGPIO.setup(18, GPIO.OUT) #default=HIGH? \u524d\u56de\u306e\u8a2d\u5b9a\u304c\u7d99\u7d9a\u3055\u308c\u308b<\/p>\n<p>GPIO.output(17, 0) #\u30c8\u30b0\u30eb\u4fe1\u53f7\u767a\u4fe1<br \/>\nprint(GPIO.input(17)) #0\u304c\u8868\u793a\u3055\u308c\u308b<br \/>\nGPIO.output(17, 1) #\u30c8\u30b0\u30eb\u4fe1\u53f7\u767a\u4fe1<br \/>\nprint(GPIO.input(17)) #1\u304c\u8868\u793a\u3055\u308c\u308b<\/p>\n<p>print(not 0,not 1,1^1,1^0) #True False 0 1<\/p>\n<p>GPIO.output(18, 1^GPIO.input(18)) #xor \u30d3\u30c3\u30c8\u53cd\u8ee2 #\u5165\u529b\u30d4\u30f3\u306e\u5024\u306a\u306e\u304b\u51fa\u529b\u30ec\u30b8\u30b9\u30bf\u5024\u306a\u306e\u304b\u306f\u4e0d\u660e<br \/>\nprint(GPIO.input(18))<\/p>\n<p>#GPIO.cleanup(17) #GPIO.cleanup(here) OR GPIO.setwarnings(above)<\/p>\n<p>#\u5165\u529b\u30d4\u30f3\u306e\u5024\u306a\u3089\u30ce\u30a4\u30ba\u306e\u5f71\u97ff\u3092\u53d7\u3051\u308b<br \/>\n<a href=\"http:\/\/fisherman.jp\/23\/7496\/screenshot-from-2021-02-01-23-10-11\" rel=\"attachment wp-att-7497\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-7497\" src=\"http:\/\/fisherman.jp\/23\/wp-content\/uploads\/2021\/02\/Screenshot-from-2021-02-01-23-10-11-80x80.png\" alt=\"\" width=\"80\" height=\"80\" \/><\/a> <a href=\"http:\/\/fisherman.jp\/23\/7496\/screenshot-from-2021-02-01-23-10-19\" rel=\"attachment wp-att-7498\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-7498\" src=\"http:\/\/fisherman.jp\/23\/wp-content\/uploads\/2021\/02\/Screenshot-from-2021-02-01-23-10-19-80x80.png\" alt=\"\" width=\"80\" height=\"80\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u691c\u8a3c GPIO \u51fa\u529b\u30dd\u30fc\u30c8\u3092\u53cd\u8ee2 \u30c8\u30b0\u30eb\u51fa\u529b Raspberry PI Zero WH (test.py) import RPi.GPIO as GPIO #GPIO\u30dd\u30fc\u30c8\u8a2d\u5b9a GPIO.setwarnings(Fals [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-7496","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/posts\/7496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/comments?post=7496"}],"version-history":[{"count":3,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/posts\/7496\/revisions"}],"predecessor-version":[{"id":7519,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/posts\/7496\/revisions\/7519"}],"wp:attachment":[{"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/media?parent=7496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/categories?post=7496"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fisherman.jp\/23\/wp-json\/wp\/v2\/tags?post=7496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}