{"id":904,"date":"2020-02-26T20:10:16","date_gmt":"2020-02-26T11:10:16","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=904"},"modified":"2020-02-26T20:13:09","modified_gmt":"2020-02-26T11:13:09","slug":"%e3%82%b8%e3%83%a7%e3%82%a4%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e3%83%9e%e3%82%a6%e3%82%b9%e3%82%92%e4%bd%9c%e3%82%8a%e3%81%9f%e3%81%84","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2020\/02\/26\/904\/","title":{"rendered":"\u30b8\u30e7\u30a4\u30b9\u30c6\u30a3\u30c3\u30af\u30de\u30a6\u30b9\u3092\u4f5c\u308a\u305f\u3044"},"content":{"rendered":"<h1>\u30b8\u30e7\u30a4\u30b9\u30c6\u30a3\u30c3\u30af\u30de\u30a6\u30b9<\/h1>\n<p>Arduino\u3068\u30b8\u30e7\u30a4\u30b9\u30c6\u30a3\u30c3\u30af\u3067\u3001\u30de\u30a6\u30b9\u304c\u4f5c\u308c\u308b\u3089\u3057\u3044\u306e\u3067\u4f5c\u3063\u3066\u307f\u308b\u3002\u30b9\u30b1\u30c3\u30c1\u4f8b\u3060\u3051\u3060\u3068\u81ea\u5206\u306e\u74b0\u5883\u3067\u306f\u52d5\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4e00\u500b\u305a\u3064\u3084\u3063\u3066\u307f\u308b\u3002<\/p>\n<h2>\u304a\u8cb7\u3044\u7269<\/h2>\n<p><a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gM-08763\/\">http:\/\/akizukidenshi.com\/catalog\/g\/gM-08763\/<\/a><\/p>\n<p>\u30bb\u30f3\u30bf\u30fc\u30d7\u30c3\u30b7\u30e5\u304c\u4ed8\u3044\u3066\u308b\u3084\u3064\u306b\u3057\u305f\u3002<\/p>\n<h2>\u63a5\u7d9a<\/h2>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-910\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy03-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy03-300x225.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy03-768x576.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy03.png 1000w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3064\u306a\u3044\u3060\u3002<\/p>\n<h2>\u3068\u308a\u3042\u3048\u305aanalogRead()\u3067\u53d6\u5f97<\/h2>\n<pre><code class=\"cpp\">int axisX = 0;\r\nint axisY = 0;\r\n\r\nvoid setup() {\r\n  pinMode(18,INPUT);\r\n  pinMode(19,INPUT);\r\n\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n  axisX = analogRead(18);\r\n  axisY = analogRead(19);\r\n  Serial.print(\"X: \");\r\n  Serial.print(axisX);\r\n  Serial.print(\"   Y: \");\r\n  Serial.print(axisY);\r\n  Serial.println();\r\n}<\/code><\/pre>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-905\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01-300x170.png\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01-300x170.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/joy01.png 648w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>analogRead()\u306f\u57fa\u6e96\u96fb\u5727\u9593\u309210bit(0-1023)\u306e\u30c7\u30b8\u30bf\u30eb\u30c7\u30fc\u30bf\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u308b\u3002\u9759\u6b62\u72b6\u614b\u3060\u3068\u3001\u4e2d\u592e\u5024\u306e511-512\u306b\u306a\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u3053\u306e\u7d50\u679c\u306f\u3061\u3087\u3063\u3068\u305a\u308c\u3066\u308b\u3002\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u5fc5\u8981\u3060\u3051\u3069\u3001\u307e\u3041\u7121\u8996\u3059\u308b\u3002<\/p>\n<h2>Mouse.h\u3092\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n<pre><code class=\"cpp\">#include &lt;Mouse.h&gt;\r\n\r\nboolean finished = false;\r\n\r\nvoid setup() {\r\n  Mouse.begin();\r\n\r\n}\r\n\r\nvoid loop() {\r\n  if (!finished) {\r\n    for (int i = 1 ; i &lt;= 10; i++) {\r\n      Mouse.move(-10, 10, 0);\r\n      delay(1000);\r\n      finished = true;\r\n    }\r\n  }\r\n}<\/code><\/pre>\n<p>\u6b62\u307e\u3089\u306a\u304f\u306a\u308b\u306e\u304c\u6016\u3044\u306e\u3067\u3001\u4e00\u65e6\u4f55\u56de\u304b\u3084\u3063\u305f\u3089\u6b62\u307e\u308b\u3088\u3046\u306b\u3059\u308b\u3002Mouse.move()\u306e\u610f\u5473\u304c\u3088\u304f\u5206\u304b\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3060\u3051\u3069\u3001\u73fe\u5728\u306e\u4f4d\u7f6e\u304b\u3089\u3001\u5f15\u6570\u306e\u5206\u3060\u3051\u30de\u30a6\u30b9\u304c\u98db\u3076\u611f\u3058\u306e\u52d5\u304d\u307f\u305f\u3044\u3002\u5f15\u6570\u3092\u5927\u304d\u304f\u3059\u308c\u3070\u98db\u3076\u91cf\u304c\u5927\u304d\u304f\u306a\u308b\u3002\u30b9\u30a4\u30fc\u3063\u3068\u52d5\u304f\u3093\u3058\u3083\u306a\u304f\u3066\u3001\u98db\u3076\u3002<\/p>\n<h2>2\u3064\u3092\u5408\u308f\u305b\u3066\u307f\u308b<\/h2>\n<pre><code class=\"cpp\">#include &lt;Mouse.h&gt;\r\n\r\nboolean finished = false;\r\nint axisX = 0;\r\nint axisY = 0;\r\nsigned char X;\r\nsigned char Y;\r\n\r\nvoid setup() {\r\n  pinMode(18, INPUT);\r\n  pinMode(19, INPUT);\r\n\r\n  Mouse.begin();\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (!finished) {\r\n    for (int i = 1 ; i &lt;= 10000; i++) {\r\n      axisX = analogRead(18);\r\n      axisY = analogRead(19);\r\n      X = map(axisX, 0, 1023, -3, 3);\r\n      Y = map(axisY, 0, 1023, -3, 3);\r\n\r\n      Mouse.move(X, Y, 0);\r\n      delay(2);\r\n      finished = true;\r\n    }\r\n  }\r\n}<\/code><\/pre>\n<p>\u53d6\u308a\u3042\u3048\u305a\u52d5\u304f\u3082\u306e\u3092\u66f8\u3044\u3066\u307f\u305f\u3002\u3053\u308c\u3060\u3051\u3067\u3082\u65e2\u306b\u30ab\u30fc\u30bd\u30eb\u304c\u52d5\u3044\u3066\u304f\u308c\u308b\u3002\u3059\u3052\u30fc\u306a\u3002\u305f\u3060\u9759\u6b62\u72b6\u614b\u3067\u3082\u30ab\u30fc\u30bd\u30eb\u304c\u52d5\u3044\u3066\u3057\u307e\u3046\u3057\u3001\u52d5\u304d\u306f\u30ab\u30af\u30ab\u30af\u3057\u3066\u3044\u3066\u306a\u3081\u3089\u304b\uff5e\u306a\u611f\u3058\u3058\u3083\u306a\u3044\u3002XY\u8ef8\u6cbf\u3044\u306e\u52d5\u304d\u306f\u3059\u308b\u3093\u3060\u3051\u3069\u3001\u659c\u3081\u306b\u306a\u308b\u3068\u3068\u305f\u3093\u306b\u53cd\u5fdc\u304c\u60aa\u304f\u306a\u308b\u3002\u306a\u3093\u3060\u308d\u306a\u30fc\u3002<\/p>\n<h3>map()<\/h3>\n<p><a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/math\/map\/\">https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/math\/map\/<\/a><\/p>\n<p><a href=\"https:\/\/qiita.com\/QUANON\/items\/188baf469fd493a2f1e6\">https:\/\/qiita.com\/QUANON\/items\/188baf469fd493a2f1e6<\/a><\/p>\n<p>\u3053\u308c\u4fbf\u5229\u306d\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/usb\/mouse\/\">https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/usb\/mouse\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b8\u30e7\u30a4\u30b9\u30c6\u30a3\u30c3\u30af\u30de\u30a6\u30b9 Arduino\u3068\u30b8\u30e7\u30a4\u30b9\u30c6\u30a3\u30c3\u30af\u3067\u3001\u30de\u30a6\u30b9\u304c\u4f5c\u308c\u308b\u3089\u3057\u3044\u306e\u3067\u4f5c\u3063\u3066\u307f\u308b\u3002\u30b9\u30b1\u30c3\u30c1\u4f8b\u3060\u3051\u3060\u3068\u81ea\u5206\u306e\u74b0\u5883\u3067\u306f\u52d5\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4e00\u500b\u305a\u3064\u3084\u3063\u3066\u307f\u308b\u3002 \u304a\u8cb7\u3044\u7269 http:\/\/akizukidenshi. &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2020\/02\/26\/904\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":910,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[69,90,54],"class_list":["post-904","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-8","tag-arduino","tag-90","tag-54"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=904"}],"version-history":[{"count":4,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/904\/revisions"}],"predecessor-version":[{"id":911,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/904\/revisions\/911"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/910"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}