{"id":2152,"date":"2018-08-16T22:22:40","date_gmt":"2018-08-16T13:22:40","guid":{"rendered":"https:\/\/mattyan.net\/blog\/?p=2152"},"modified":"2018-08-16T22:22:40","modified_gmt":"2018-08-16T13:22:40","slug":"arduino%e3%82%92%e8%a7%a6%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=2152","title":{"rendered":"Arduino\u3092\u89e6\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>\u524d\u306b<a href=\"http:\/\/gihyo.jp\/book\/2018\/978-4-7741-9919-1\">arduino\u3067\u697d\u3057\u3080\u9244\u9053\u6a21\u578b<\/a>\u306e\u672c\u3068\u5b9f\u9a13\u57fa\u677f\u3092\u8cb7\u3063\u3066\u305f\u3051\u3069\u3001\u6628\u65e5\u96fb\u6e90\u30b1\u30fc\u30d6\u30eb\u3092\u8cb7\u3063\u3066\u304d\u305f\u306e\u3067\u89e6\u3063\u3066\u307f\u305f\u3002<br \/>\n<!--more--><br \/>\n\u307e\u305a\u306f<a href=\"https:\/\/www.arduino.cc\/\">arduino\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8<\/a>\u304b\u3089\u958b\u767a\u74b0\u5883\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<br \/>\nUSB\u30e9\u30a4\u30bf\u3092\u57fa\u677f\u3068\u3064\u306a\u3052\u3066PC\u306b\u633f\u3057\u305f\u3089\u3001\u96fb\u6e90\u304c\u5165\u3063\u305f\u2026\u2026<br \/>\narduino\u5074\u306f\u96fb\u6e90\u3044\u3089\u306a\u304b\u3063\u305f\u304b\u306a?PC\u304b\u3089\u5207\u308a\u96e2\u3057\u305f\u5f8c\u8d77\u52d5\u3059\u308b\u306e\u306b\u306f\u5fc5\u8981\u3060\u3051\u3069\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a\u66f8\u7c4d\u306b\u5f93\u3063\u3066Blink\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u30d3\u30eb\u30c9\u3057\u3066\u66f8\u304d\u8fbc\u3082\u3046\u3068\u3057\u305f\u3051\u3069\u3001<\/p>\n<pre>\navrdude: stk500_recv(): programmer is not responding\navrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x8d\n<\/pre>\n<p>\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u66f8\u304d\u8fbc\u3081\u306a\u3044\u3002<br \/>\n\u3044\u308d\u3044\u308d\u8abf\u3079\u305f\u3068\u3053\u308d\u3001IDE\u306fCOM1\u306b\u66f8\u304d\u8fbc\u3082\u3046\u3068\u3057\u3066\u308b\u3051\u3069\u3001\u5b9f\u969b\u306b\u306fCOM3\u306b\u3059\u308b\u3079\u304d\u3060\u3063\u305f\u3068\u3044\u3046\u8a71\u3002<br \/>\n\u3067\u3001COM3\u3092\u898b\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u3068\u3053\u308d\u3001\u66f8\u304d\u8fbc\u307f\u306b\u306f\u6210\u529f\u3057\u305f\u3093\u3060\u3051\u3069\u3001\u57fa\u677f\u306b\u53cd\u5fdc\u304c\u306a\u3044\u3002<br \/>\n\u3068\u3044\u3046\u304b\u3001LED_BUILTIN\u81ea\u4f53\u3001\u306a\u3055\u305d\u3046\u2026\u2026<br \/>\n\u3068\u3044\u3046\u304b\u3053\u306e\u672c\u3001\u9023\u52d5\u4f01\u753b\u3068\u8a00\u3044\u3064\u3064\u57fa\u677f\u306b\u306f\u4e00\u5207\u89e6\u308c\u306a\u3044\u3093\u3060\u3088\u306a\u3041\u2026\u2026\u666e\u901a\u306earduino\u306f\u3088\u304f\u51fa\u3066\u304f\u308b\u3093\u3060\u3051\u3069\u3001\u5b9f\u9a13\u57fa\u76e4\u304c\u5168\u304f\u51fa\u3066\u3053\u306a\u3044\u2026\u2026<br \/>\n\u3057\u3087\u3046\u304c\u306a\u3044\u306e\u3067\u3001\u5b9f\u9a13\u57fa\u677f\u306eLED\u3092\u3064\u306a\u3052\u3066\u305d\u3063\u3061\u306b\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a<br \/>\n[c]<br \/>\n#define LED_PIN 2<br \/>\nvoid setup() {<br \/>\n  \/\/ initialize digital pin LED_BUILTIN as an output.<br \/>\n  \/\/pinMode(LED_BUILTIN, OUTPUT);<br \/>\n  pinMode(LED_PIN, OUTPUT);<br \/>\n}<br \/>\n\/\/ the loop function runs over and over again forever<br \/>\nvoid loop() {<br \/>\n  digitalWrite(LED_PIN, HIGH);   \/\/ turn the LED on (HIGH is the voltage level)<br \/>\n  delay(1000);                       \/\/ wait for a second<br \/>\n  digitalWrite(LED_PIN, LOW);    \/\/ turn the LED off by making the voltage LOW<br \/>\n  delay(1000);                       \/\/ wait for a second<br \/>\n}<br \/>\n[\/c]<br \/>\n\u30b3\u30fc\u30c9\u3092\u3044\u3058\u3063\u3066\u3001\u5149\u3089\u305b\u308b\u3053\u3068\u306b\u6210\u529f<\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"ja\">\n<p lang=\"ja\" dir=\"ltr\">LED\u5149\u3089\u305b\u308b\u307e\u3067\u3067\u304d\u305f\u3002 <a href=\"https:\/\/t.co\/5tHewteARH\">pic.twitter.com\/5tHewteARH<\/a><\/p>\n<p>&mdash; \u307e\u3063\u3061\u3083\u3093 (@mattyan_1117) <a href=\"https:\/\/twitter.com\/mattyan_1117\/status\/1030073586109702144?ref_src=twsrc%5Etfw\">2018\u5e748\u670816\u65e5<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><br \/>\n\u3064\u3044\u3067\u306a\u3093\u3067\u3001\u53ef\u5909\u62b5\u6297\u306e\u5024\u3092\u8aad\u3093\u3067\u9593\u9694\u3092\u8abf\u6574\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f<br \/>\n[c]<br \/>\n#define LED_PIN 2<br \/>\nvoid setup() {<br \/>\n  \/\/ initialize digital pin LED_BUILTIN as an output.<br \/>\n  \/\/pinMode(LED_BUILTIN, OUTPUT);<br \/>\n  pinMode(LED_PIN, OUTPUT);<br \/>\n  Serial.begin(9600);<br \/>\n}<br \/>\n\/\/ the loop function runs over and over again forever<br \/>\nvoid loop() {<br \/>\n  float value = analogRead(A1) \/ 100.0f; \/\/ \u53ef\u5909\u62b5\u6297\u8aad\u307f\u53d6\u308a<br \/>\n  Serial.println(value);<br \/>\n  if (value &lt; 1.0f) {<br \/>\n    digitalWrite(LED_PIN, LOW);<br \/>\n    delay(1);<br \/>\n    return;<br \/>\n  }<br \/>\n  digitalWrite(LED_PIN, HIGH);   \/\/ turn the LED on (HIGH is the voltage level)<br \/>\n  delay(1000.0f \/ value);                       \/\/ wait for a second<br \/>\n  digitalWrite(LED_PIN, LOW);    \/\/ turn the LED off by making the voltage LOW<br \/>\n  delay(1000.0f \/ value);                       \/\/ wait for a second<br \/>\n}<br \/>\n[\/c]<br \/>\n\u3053\u308c\u3067LED\u306e\u70b9\u6ec5\u9593\u9694\u306e\u8abf\u6574\u306b\u6210\u529f\u3002<br \/>\n\u3042\u3068\u306f\u3053\u308c\u3092LED\u3058\u3083\u306a\u304f\u3066\u30e2\u30fc\u30bf\u30fc\u30c9\u30e9\u30a4\u30d0\u306b\u51fa\u529b\u3059\u308c\u3070\u7c21\u6613\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u3067\u304d\u3042\u304c\u308a\u304b\u306a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u306barduino\u3067\u697d\u3057\u3080\u9244\u9053\u6a21\u578b\u306e\u672c\u3068\u5b9f\u9a13\u57fa\u677f\u3092\u8cb7\u3063\u3066\u305f\u3051\u3069\u3001\u6628\u65e5\u96fb\u6e90\u30b1\u30fc\u30d6\u30eb\u3092\u8cb7\u3063\u3066\u304d\u305f\u306e\u3067\u89e6\u3063\u3066\u307f\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2152","post","type-post","status-publish","format-standard","hentry","category-3"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2152"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2152\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}