{"id":894,"date":"2020-02-24T14:23:16","date_gmt":"2020-02-24T05:23:16","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=894"},"modified":"2020-02-24T14:23:16","modified_gmt":"2020-02-24T05:23:16","slug":"%e3%83%a2%e3%83%bc%e3%83%ab%e3%82%b9%e4%bf%a1%e5%8f%b7%e3%82%92%e5%be%a9%e5%8f%b7%e3%81%97%e3%81%9f%e3%81%84","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2020\/02\/24\/894\/","title":{"rendered":"\u30e2\u30fc\u30eb\u30b9\u4fe1\u53f7\u3092\u5fa9\u53f7\u3057\u305f\u3044"},"content":{"rendered":"<h1>\u30e2\u30fc\u30eb\u30b9\u4fe1\u53f7<\/h1>\n<p>\u30e2\u30fc\u30eb\u30b9\u4fe1\u53f7\u3092\u5fa9\u53f7\u3057\u305f\u3044\u3002\u8ab0\u304b\u304b\u3089\u9001\u3089\u308c\u3066\u304d\u305f\u3084\u3064\u3058\u3083\u306a\u304f\u3066\u3001\u81ea\u5206\u304c\u5165\u529b\u3057\u305f\u3084\u3064\u3092\u5fa9\u53f7\u3057\u305f\u3044\u3002<\/p>\n<h2>\u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u4e0b\u30fb\u96e2\u4e0a\u9593\u306e\u6642\u9593\u3092\u53d6\u5f97<\/h2>\n<pre><code class=\"cpp\">unsigned long starttime = 0;\r\nunsigned long endtime = 0;\r\nunsigned long diff = 0;\r\n\r\nvoid setup() {\r\n  pinMode(9, INPUT_PULLUP);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (digitalRead(9) == LOW) {\r\n    starttime = millis();\r\n    \r\n    while (digitalRead(9) == LOW) {}\r\n    \r\n    endtime = millis();\r\n    diff = endtime - starttime;\r\n    \r\n    Serial.print(diff);\r\n    Serial.println();\r\n    delay(10);\r\n  }\r\n}<\/code><\/pre>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-895\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02-300x170.png\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02-300x170.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw02.png 648w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u6642\u9593\u304c\u53d6\u308c\u305f\u3002<\/p>\n<h2>\u95be\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u77ed\u70b9\u3068\u9577\u70b9\u3092\u5224\u65ad<\/h2>\n<pre><code class=\"cpp\">#define threshold 200\r\n\r\nunsigned long starttime = 0;\r\nunsigned long endtime = 0;\r\nunsigned long diff = 0;\r\n\r\nvoid setup() {\r\n  pinMode(9, INPUT_PULLUP);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (digitalRead(9) == LOW) {\r\n    starttime = millis();\r\n    while (digitalRead(9) == LOW) {}\r\n    endtime = millis();\r\n    diff = endtime - starttime;\r\n\r\n    if (diff &lt; threshold) {\r\n      Serial.print(\"\u30fb\");\r\n      Serial.println();\r\n    } else {\r\n      Serial.print(\"\uff0d\");\r\n      Serial.println();\r\n    }\r\n\r\n    delay(10);\r\n  }\r\n}<\/code><\/pre>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-896\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03-300x170.png\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03-300x170.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw03.png 648w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u5224\u65ad\u3082\u3067\u304d\u305f\u3002\u3053\u3063\u304b\u3089\u3060\u306a\u3041\u3002<\/p>\n<h2>\u95be\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u6587\u5b57\u306e\u533a\u5207\u308a\u3092\u53d6\u5f97<\/h2>\n<pre><code class=\"cpp\">#define thresholdsl 200\r\n#define thresholdchr 400\r\n\r\nunsigned long starttime = 0;\r\nunsigned long endtime = 0;\r\nunsigned long diff = 0;\r\nboolean duringinput = false;\r\nboolean decrypted = true;\r\n\r\nvoid setup() {\r\n  pinMode(9, INPUT_PULLUP);\r\n  Serial.begin(9600);\r\n}\r\n\r\nString decisl(unsigned long t) {\r\n  if (t &lt; thresholdsl) {\r\n    return \"\u30fb\";\r\n  }\r\n  return \"\uff0d\";\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (digitalRead(9) == LOW) {\r\n    starttime = millis();\r\n    \r\n    if (!duringinput) {\r\n      duringinput = true;\r\n      decrypted = false;\r\n    }\r\n\r\n    while (digitalRead(9) == LOW) {}\r\n    endtime = millis();\r\n    diff = endtime - starttime;\r\n\r\n    Serial.print(decisl(diff));\r\n    Serial.println();\r\n    delay(10);\r\n  }\r\n\r\n  if ( (millis() - endtime) &gt; thresholdchr &amp;&amp; !decrypted) {\r\n    Serial.print(\"result\");\r\n    Serial.println();\r\n    duringinput = false;\r\n    decrypted = true;\r\n  }\r\n  \r\n}<\/code><\/pre>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-897\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04-300x170.png\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04-300x170.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw04.png 648w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u884c\u304d\u5f53\u305f\u308a\u3070\u3063\u305f\u308a\u3067\u66f8\u3044\u3066\u3044\u3063\u305f\u3089\u3053\u3046\u306a\u3063\u305f\u3002\u3082\u3046\u4e00\u56de\u4f5c\u308c\u3068\u8a00\u308f\u308c\u308b\u3068\u4f5c\u308c\u306a\u3055\u305d\u3046\u3002\u3067\u304d\u308b\u3060\u3051\u6b8b\u305d\u3002<\/p>\n<p>\u77ed\u70b92\u3064\u306e\u5834\u5408\u3001<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-898\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw05-300x73.png\" alt=\"\" width=\"300\" height=\"73\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw05-300x73.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw05-768x187.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw05.png 787w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<table width=\"628\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\" width=\"124\"><\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2460<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2461<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2462<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2463<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2464<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2465<\/td>\n<td style=\"text-align: center;\" width=\"72\">\u2466<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">millis()<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<td style=\"text-align: center;\">200<\/td>\n<td style=\"text-align: center;\">300<\/td>\n<td style=\"text-align: center;\">400<\/td>\n<td style=\"text-align: center;\">500<\/td>\n<td style=\"text-align: center;\">750<\/td>\n<td style=\"text-align: center;\">1000<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">starttime<\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">200<\/td>\n<td style=\"text-align: center;\">200<\/td>\n<td style=\"text-align: center;\">400<\/td>\n<td style=\"text-align: center;\">400<\/td>\n<td style=\"text-align: center;\">400<\/td>\n<td style=\"text-align: center;\">400<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">endtime<\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">300<\/td>\n<td style=\"text-align: center;\">300<\/td>\n<td style=\"text-align: center;\">500<\/td>\n<td style=\"text-align: center;\">500<\/td>\n<td style=\"text-align: center;\">500<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">diff<\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<td style=\"text-align: center;\">100<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">decisl()<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\">&#8220;\u30fb&#8221;<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\">&#8220;\u30fb&#8221;<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">millis() &#8211; endtime<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\">250<\/td>\n<td style=\"text-align: center;\">500<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">print(&#8220;result&#8221;)<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\">&#8220;result&#8221;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">duringinput<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">decrypted<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">FALSE<\/td>\n<td style=\"text-align: center;\">TRUE<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3046\u30fc\u3093\u3001\u4e0a\u624b\u304f\u66f8\u3051\u306a\u3044\u3002\u3053\u3093\u306a\u611f\u3058\u3067\u9077\u79fb\u3057\u3066\u308b\u306f\u305a\u3002\u3042\u3068\u306fresult\u3092\u3001\u5165\u529b\u304b\u3089\u5bfe\u5fdc\u3059\u308b\u6587\u5b57\u306b\u5fa9\u53f7\u3057\u305f\u7d50\u679c\u3092\u8868\u793a\u3055\u305b\u308b\u3088\u3046\u306b\u3059\u308c\u3070\u3044\u3044\u306f\u305a\u3002<\/p>\n<h2>\u5165\u529b\u5024\u304b\u3089\u5fa9\u53f7<\/h2>\n<p>Arduino\u306b\u306f\u3001key-value\u5f62\u5f0f\u3067\u6271\u3048\u308b\u3088\u3046\u306a\u3001Dictionary\u3068\u304bHashMap\u307f\u305f\u3044\u306a\u3082\u306e\u304c\u306a\u3044\u3001\u3089\u3057\u3044\u3002\u63a2\u3057\u305f\u3051\u3069\u898b\u3064\u304b\u3093\u306a\u304b\u3063\u305f\u3002\u300c\u30fb\uff0d\u300d\u2192\u300cA\u300d\u307f\u305f\u3044\u306a\u30c7\u30fc\u30bf\u306e\u5f15\u3063\u5f35\u308a\u65b9\u306f\u3067\u304d\u306a\u3044\u3063\u3066\u3053\u3068\u306a\u306e\u3067\u306a\u306b\u304b\u8003\u3048\u306a\u3044\u3068\u3044\u304b\u3093\u3002\u6700\u60aaswitch\u3067\u611a\u76f4\u306b\u5168\u90e8\u66f8\u304f\u65b9\u6cd5\u304c\u3042\u308b\u3051\u3069\u3001\u305d\u308c\u306f\u3084\u3060\u306a\u3063\u3066\u601d\u3063\u305f\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u300c\u30fb\u300d\u2192\u300c0\u300d\u3001\u300c\u30fc\u300d\u2192\u300c1\u300d\u3068\u3057\u3066\u3001\u305d\u308c\u3092key\u306b\u3057\u3066\u30c7\u30fc\u30bf\u5f15\u3063\u5f35\u308c\u306a\u3044\u304b\u3092\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3059\u308b\u3002<\/p>\n<table width=\"509\">\n<tbody>\n<tr>\n<td width=\"42\">\u6587\u5b57<\/td>\n<td width=\"89\">\u7b26\u53f7<\/td>\n<td width=\"75\">\u300c\u30fb\u300d\u2192\u300c0\u300d<br \/>\n\u300c-\u300d\u2192\u300c1\u300d<\/td>\n<td width=\"72\">BIN2DEC<\/td>\n<td width=\"42\">\u6841\u6570<\/td>\n<td width=\"147\">16bit<\/td>\n<td width=\"42\">\u6dfb\u5b57<\/td>\n<\/tr>\n<tr>\n<td>A<\/td>\n<td>\u30fb\uff0d<\/td>\n<td>01<\/td>\n<td>1<\/td>\n<td>2<\/td>\n<td>0100000000000010<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>B<\/td>\n<td>\uff0d\u30fb\u30fb\u30fb<\/td>\n<td>1000<\/td>\n<td>8<\/td>\n<td>4<\/td>\n<td>1000000000000100<\/td>\n<td>23<\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td>\uff0d\u30fb\uff0d\u30fb<\/td>\n<td>1010<\/td>\n<td>10<\/td>\n<td>4<\/td>\n<td>1010000000000100<\/td>\n<td>25<\/td>\n<\/tr>\n<tr>\n<td>D<\/td>\n<td>\uff0d\u30fb\u30fb<\/td>\n<td>100<\/td>\n<td>4<\/td>\n<td>3<\/td>\n<td>1000000000000011<\/td>\n<td>11<\/td>\n<\/tr>\n<tr>\n<td>E<\/td>\n<td>\u30fb<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0000000000000001<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>F<\/td>\n<td>\u30fb\u30fb\uff0d\u30fb<\/td>\n<td>0010<\/td>\n<td>2<\/td>\n<td>4<\/td>\n<td>0010000000000100<\/td>\n<td>17<\/td>\n<\/tr>\n<tr>\n<td>G<\/td>\n<td>\uff0d\uff0d\u30fb<\/td>\n<td>110<\/td>\n<td>6<\/td>\n<td>3<\/td>\n<td>1100000000000011<\/td>\n<td>13<\/td>\n<\/tr>\n<tr>\n<td>H<\/td>\n<td>\u30fb\u30fb\u30fb\u30fb<\/td>\n<td>0000<\/td>\n<td>0<\/td>\n<td>4<\/td>\n<td>0000000000000100<\/td>\n<td>15<\/td>\n<\/tr>\n<tr>\n<td>I<\/td>\n<td>\u30fb\u30fb<\/td>\n<td>00<\/td>\n<td>0<\/td>\n<td>2<\/td>\n<td>0000000000000010<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>J<\/td>\n<td>\u30fb\uff0d\uff0d\uff0d<\/td>\n<td>0111<\/td>\n<td>7<\/td>\n<td>4<\/td>\n<td>0111000000000100<\/td>\n<td>22<\/td>\n<\/tr>\n<tr>\n<td>K<\/td>\n<td>\uff0d\u30fb\uff0d<\/td>\n<td>101<\/td>\n<td>5<\/td>\n<td>3<\/td>\n<td>1010000000000011<\/td>\n<td>12<\/td>\n<\/tr>\n<tr>\n<td>L<\/td>\n<td>\u30fb\uff0d\u30fb\u30fb<\/td>\n<td>0100<\/td>\n<td>4<\/td>\n<td>4<\/td>\n<td>0100000000000100<\/td>\n<td>19<\/td>\n<\/tr>\n<tr>\n<td>M<\/td>\n<td>\uff0d\uff0d<\/td>\n<td>11<\/td>\n<td>3<\/td>\n<td>2<\/td>\n<td>1100000000000010<\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\uff0d\u30fb<\/td>\n<td>10<\/td>\n<td>2<\/td>\n<td>2<\/td>\n<td>1000000000000010<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>O<\/td>\n<td>\uff0d\uff0d\uff0d<\/td>\n<td>111<\/td>\n<td>7<\/td>\n<td>3<\/td>\n<td>1110000000000011<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td>P<\/td>\n<td>\u30fb\uff0d\uff0d\u30fb<\/td>\n<td>0110<\/td>\n<td>6<\/td>\n<td>4<\/td>\n<td>0110000000000100<\/td>\n<td>21<\/td>\n<\/tr>\n<tr>\n<td>Q<\/td>\n<td>\uff0d\uff0d\u30fb\uff0d<\/td>\n<td>1101<\/td>\n<td>13<\/td>\n<td>4<\/td>\n<td>1101000000000100<\/td>\n<td>28<\/td>\n<\/tr>\n<tr>\n<td>R<\/td>\n<td>\u30fb\uff0d\u30fb<\/td>\n<td>010<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td>0100000000000011<\/td>\n<td>9<\/td>\n<\/tr>\n<tr>\n<td>S<\/td>\n<td>\u30fb\u30fb\u30fb<\/td>\n<td>000<\/td>\n<td>0<\/td>\n<td>3<\/td>\n<td>0000000000000011<\/td>\n<td>7<\/td>\n<\/tr>\n<tr>\n<td>T<\/td>\n<td>\uff0d<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<td>1000000000000001<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>U<\/td>\n<td>\u30fb\u30fb\uff0d<\/td>\n<td>001<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>0010000000000011<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>V<\/td>\n<td>\u30fb\u30fb\u30fb\uff0d<\/td>\n<td>0001<\/td>\n<td>1<\/td>\n<td>4<\/td>\n<td>0001000000000100<\/td>\n<td>16<\/td>\n<\/tr>\n<tr>\n<td>W<\/td>\n<td>\u30fb\uff0d\uff0d<\/td>\n<td>011<\/td>\n<td>3<\/td>\n<td>3<\/td>\n<td>0110000000000011<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>X<\/td>\n<td>\uff0d\u30fb\u30fb\uff0d<\/td>\n<td>1001<\/td>\n<td>9<\/td>\n<td>4<\/td>\n<td>1001000000000100<\/td>\n<td>24<\/td>\n<\/tr>\n<tr>\n<td>Y<\/td>\n<td>\uff0d\u30fb\uff0d\uff0d<\/td>\n<td>1011<\/td>\n<td>11<\/td>\n<td>4<\/td>\n<td>1011000000000100<\/td>\n<td>26<\/td>\n<\/tr>\n<tr>\n<td>Z<\/td>\n<td>\uff0d\uff0d\u30fb\u30fb<\/td>\n<td>1100<\/td>\n<td>12<\/td>\n<td>4<\/td>\n<td>1100000000000100<\/td>\n<td>27<\/td>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>\uff0d\uff0d\uff0d\uff0d\uff0d<\/td>\n<td>11111<\/td>\n<td>31<\/td>\n<td>5<\/td>\n<td>1111100000000101<\/td>\n<td>62<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>\u30fb\uff0d\uff0d\uff0d\uff0d<\/td>\n<td>01111<\/td>\n<td>15<\/td>\n<td>5<\/td>\n<td>0111100000000101<\/td>\n<td>46<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u30fb\u30fb\uff0d\uff0d\uff0d<\/td>\n<td>00111<\/td>\n<td>7<\/td>\n<td>5<\/td>\n<td>0011100000000101<\/td>\n<td>38<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u30fb\u30fb\u30fb\uff0d\uff0d<\/td>\n<td>00011<\/td>\n<td>3<\/td>\n<td>5<\/td>\n<td>0001100000000101<\/td>\n<td>34<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u30fb\u30fb\u30fb\u30fb\uff0d<\/td>\n<td>00001<\/td>\n<td>1<\/td>\n<td>5<\/td>\n<td>0000100000000101<\/td>\n<td>32<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u30fb\u30fb\u30fb\u30fb\u30fb<\/td>\n<td>00000<\/td>\n<td>0<\/td>\n<td>5<\/td>\n<td>0000000000000101<\/td>\n<td>31<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\uff0d\u30fb\u30fb\u30fb\u30fb<\/td>\n<td>10000<\/td>\n<td>16<\/td>\n<td>5<\/td>\n<td>1000000000000101<\/td>\n<td>47<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\uff0d\uff0d\u30fb\u30fb\u30fb<\/td>\n<td>11000<\/td>\n<td>24<\/td>\n<td>5<\/td>\n<td>1100000000000101<\/td>\n<td>55<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\uff0d\uff0d\uff0d\u30fb\u30fb<\/td>\n<td>11100<\/td>\n<td>28<\/td>\n<td>5<\/td>\n<td>1110000000000101<\/td>\n<td>59<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\uff0d\uff0d\uff0d\uff0d\u30fb<\/td>\n<td>11110<\/td>\n<td>30<\/td>\n<td>5<\/td>\n<td>1111000000000101<\/td>\n<td>61<\/td>\n<\/tr>\n<tr>\n<td>&#8216;<\/td>\n<td>\u30fb\uff0d\uff0d\uff0d\uff0d\u30fb<\/td>\n<td>011110<\/td>\n<td>30<\/td>\n<td>6<\/td>\n<td>0111100000000110<\/td>\n<td>93<\/td>\n<\/tr>\n<tr>\n<td>&#8211;<\/td>\n<td>\uff0d\u30fb\u30fb\u30fb\u30fb\uff0d<\/td>\n<td>100001<\/td>\n<td>33<\/td>\n<td>6<\/td>\n<td>1000010000000110<\/td>\n<td>96<\/td>\n<\/tr>\n<tr>\n<td>&#8220;<\/td>\n<td>\u30fb\uff0d\u30fb\u30fb\uff0d\u30fb<\/td>\n<td>010010<\/td>\n<td>18<\/td>\n<td>6<\/td>\n<td>0100100000000110<\/td>\n<td>81<\/td>\n<\/tr>\n<tr>\n<td>(<\/td>\n<td>\uff0d\u30fb\uff0d\uff0d\u30fb<\/td>\n<td>10110<\/td>\n<td>22<\/td>\n<td>5<\/td>\n<td>1011000000000101<\/td>\n<td>53<\/td>\n<\/tr>\n<tr>\n<td>)<\/td>\n<td>\uff0d\u30fb\uff0d\uff0d\u30fb\uff0d<\/td>\n<td>101101<\/td>\n<td>45<\/td>\n<td>6<\/td>\n<td>1011010000000110<\/td>\n<td>108<\/td>\n<\/tr>\n<tr>\n<td>*<\/td>\n<td>\uff0d\u30fb\u30fb\uff0d<\/td>\n<td>1001<\/td>\n<td>9<\/td>\n<td>4<\/td>\n<td>1001000000000100<\/td>\n<td>24<\/td>\n<\/tr>\n<tr>\n<td>,<\/td>\n<td>\uff0d\uff0d\u30fb\u30fb\uff0d\uff0d<\/td>\n<td>110011<\/td>\n<td>51<\/td>\n<td>6<\/td>\n<td>1100110000000110<\/td>\n<td>114<\/td>\n<\/tr>\n<tr>\n<td>.<\/td>\n<td>\u30fb\uff0d\u30fb\uff0d\u30fb\uff0d<\/td>\n<td>010101<\/td>\n<td>21<\/td>\n<td>6<\/td>\n<td>0101010000000110<\/td>\n<td>84<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>\uff0d\u30fb\u30fb\uff0d\u30fb<\/td>\n<td>10010<\/td>\n<td>18<\/td>\n<td>5<\/td>\n<td>1001000000000101<\/td>\n<td>49<\/td>\n<\/tr>\n<tr>\n<td>:<\/td>\n<td>\uff0d\uff0d\uff0d\u30fb\u30fb\u30fb<\/td>\n<td>111000<\/td>\n<td>56<\/td>\n<td>6<\/td>\n<td>1110000000000110<\/td>\n<td>119<\/td>\n<\/tr>\n<tr>\n<td>?<\/td>\n<td>\u30fb\u30fb\uff0d\uff0d\u30fb\u30fb<\/td>\n<td>001100<\/td>\n<td>12<\/td>\n<td>6<\/td>\n<td>0011000000000110<\/td>\n<td>75<\/td>\n<\/tr>\n<tr>\n<td>@<\/td>\n<td>\u30fb\uff0d\uff0d\u30fb\uff0d\u30fb<\/td>\n<td>011010<\/td>\n<td>26<\/td>\n<td>6<\/td>\n<td>0110100000000110<\/td>\n<td>89<\/td>\n<\/tr>\n<tr>\n<td>^<\/td>\n<td>\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/td>\n<td>000000<\/td>\n<td>0<\/td>\n<td>6<\/td>\n<td>0000000000000110<\/td>\n<td>63<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td>\u30fb\uff0d\u30fb\uff0d\u30fb<\/td>\n<td>01010<\/td>\n<td>10<\/td>\n<td>5<\/td>\n<td>0101000000000101<\/td>\n<td>41<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u521d\u8003\u3048\u305f\u306e\u306f\u30d0\u30a4\u30ca\u30ea\u5316\u3057\u305f\u7b26\u53f7\u309210\u9032\u306b\u3057\u3066\u3001\u305d\u308c\u3092\u914d\u5217\u306e\u6dfb\u5b57\u306b\u3057\u3066\u3042\u3052\u308c\u3070\u30c7\u30fc\u30bf\u3092\u5f15\u3063\u5f35\u308c\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3063\u305f\u3002\u3067\u3082\u300110\u9032\u6570\u306b\u3059\u308b\u3068\u91cd\u8907\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u3001\u3088\u308d\u3057\u304f\u306a\u304b\u3063\u305f\u3002\u306a\u3093\u304b\u306a\u3044\u304b\u306a\u30fc\u3068\u30cd\u30c3\u30c8\u306e\u6d77\u3092\u5f77\u5fa8\u3063\u3066\u3044\u305f\u3089\u300116bit\u306e\u30c7\u30fc\u30bf\u9577\u3067\u4e0a\u4f4d12bit(\u5b9f\u969b\u306b\u4f7f\u308f\u308c\u308b\u306e\u306f6bit)\u3092\u77ed\u9577\u70b9\u3001\u4e0b\u4f4d4bit(\u5b9f\u969b\u306b\u4f7f\u308f\u308c\u308b\u306e\u306f3bit)\u3092\u7b26\u53f7\u9577\u3068\u3057\u3066\u8868\u3059\u3084\u308a\u65b9\u3092\u307f\u3064\u3051\u305f\u3002\u3053\u308c\u3067\u3044\u3051\u305d\u3046\u306a\u6c17\u304c\u3059\u308b\u3002\u3067\u30012\u5206\u6728\u3068\u3057\u3066\u6271\u3048\u3070\u3088\u3055\u3052\u3060\u306a\u30fc\u3068\u601d\u3063\u305f\u306e\u3067\u3001\u6dfb\u5b57\u3092\u8a08\u7b97\u3057\u305f\u3002\u3067\u3082\u3001\u306a\u3093\u304b\u8a18\u53f7\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e0a\u3067\u306e\u6271\u3044\u65b9\u304c\u308f\u304b\u3093\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4e0a\u8868\u306e9\u307e\u3067\u306b\u3057\u304b\u5bfe\u5fdc\u306a\u3044\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<h3>morsetable.h<\/h3>\n<pre><code class=\"cpp\">const String mtable[] = {\r\n  \"\", \"E\", \"T\", \"I\", \"A\", \"N\", \"M\", \"S\", \"U\", \"R\", \"W\", \"D\", \"K\", \"G\", \"O\", \"H\", \"V\", \"F\", \"\", \"L\", \"\", \"P\", \"J\", \"B\", \"X\", \"C\", \"Y\", \"Z\", \"Q\", \"\", \"\", \"5\", \"4\", \"\", \"3\", \"\", \"\", \"\", \"2\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"1\", \"6\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"7\", \"\", \"\", \"\", \"8\", \"\", \"9\", \"0\"\r\n};<\/code><\/pre>\n<h3>morse<\/h3>\n<pre><code class=\"cpp\">#include \"morsetable.h\"\r\n\r\n#define pin 9\r\n#define tlsl 200\r\n#define tlchr 400\r\n\r\nunsigned long starttime = 0;\r\nunsigned long endtime = 0;\r\nunsigned long diff = 0;\r\nboolean duringinput = false;\r\nboolean decrypted = true;\r\nbyte mrsbin [] = {0b0, 0b0};\r\n\r\nvoid setup() {\r\n  pinMode(pin, INPUT_PULLUP);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid decisl(unsigned long t) {\r\n  mrsbin[0] = mrsbin[0] &lt;&lt; 1;\r\n\r\n  if (t &gt; tlsl) {\r\n    mrsbin[0] = mrsbin[0] + 1;\r\n  } else {\r\n    mrsbin[0] = mrsbin[0] + 0;\r\n  }\r\n\r\n  mrsbin[1] = mrsbin[1] + 1;\r\n}\r\n\r\nint mrstblidx (byte b[]) {\r\n  byte msb = 0b0;\r\n  int idx = 0;\r\n\r\n  for (int i = 1; i &lt;= (int)b[1]; i++) {\r\n    msb = ((b[0] &lt;&lt; (8 - (int)b[1]) + i - 1) &amp; 0b10000000) &gt;&gt; (8 - i);\r\n\r\n    if (msb == 0) {\r\n      idx = 2 * idx + 1;\r\n    } else {\r\n      idx = 2 * idx + 2;\r\n    }\r\n  }\r\n  return idx;\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (digitalRead(pin) == LOW) {\r\n    starttime = millis();\r\n\r\n    if (!duringinput) {\r\n      duringinput = true;\r\n      decrypted = false;\r\n    }\r\n\r\n    while (digitalRead(pin) == LOW) {}\r\n    endtime = millis();\r\n    diff = endtime - starttime;\r\n    decisl(diff);\r\n\r\n    \/\/    Serial.print(mrsbin[0]);\r\n    \/\/    Serial.print(mrsbin[1]);\r\n    \/\/    Serial.println();\r\n    delay(10);\r\n  }\r\n\r\n  if ( (millis() - endtime) &gt; tlchr &amp;&amp; !decrypted) {\r\n    Serial.print(mtable[mrstblidx(mrsbin)]);\r\n    Serial.println();\r\n    duringinput = false;\r\n    decrypted = true;\r\n    mrsbin [0] = 0;\r\n    mrsbin [1] = 0;\r\n  }\r\n\r\n}<\/code><\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u3063\u305f\u3002MSB\u53d6\u308a\u51fa\u3059\u3068\u3053\u308d\u304c\u3061\u3087\u3063\u3068\u6c17\u6301\u3061\u60aa\u3044\u306a\u30fc\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-901\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06-300x170.png\" alt=\"\" width=\"300\" height=\"170\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06-300x170.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06-120x68.png 120w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06-160x90.png 160w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06-320x180.png 320w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2020\/02\/sw06.png 648w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/P7XJ9unuE5Q\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u3044\u30fc\u611f\u3058\u3060!\u305f\u3060\u307e\u3041\u3001\u77ed\u9577\u70b9\u306e\u624b\u7656\u306b\u306f\u5bfe\u5fdc\u3067\u304d\u3066\u306a\u3044\u306e\u3067\u6a5f\u68b0\u306b\u4eba\u9593\u304c\u5408\u308f\u305b\u308b\u611f\u3058\u306b\u306a\u308b\u304b\u306a\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/ja.wikipedia.org\/wiki\/%E3%83%A2%E3%83%BC%E3%83%AB%E3%82%B9%E7%AC%A6%E5%8F%B7\">https:\/\/ja.wikipedia.org\/wiki\/%E3%83%A2%E3%83%BC%E3%83%AB%E3%82%B9%E7%AC%A6%E5%8F%B7<\/a><\/p>\n<p><a href=\"http:\/\/www.kyohritsu.jp\/eclib\/DIGIT\/KIT\/morsejamp.pdf\">http:\/\/www.kyohritsu.jp\/eclib\/DIGIT\/KIT\/morsejamp.pdf<\/a><\/p>\n<p><a href=\"http:\/\/machoto2.g2.xrea.com\/page\/P14K50\/P14_B17.htm\">http:\/\/machoto2.g2.xrea.com\/page\/P14K50\/P14_B17.htm<\/a><\/p>\n<p><a href=\"https:\/\/ja.wikipedia.org\/wiki\/%E4%BA%8C%E5%88%86%E6%9C%A8\">https:\/\/ja.wikipedia.org\/wiki\/%E4%BA%8C%E5%88%86%E6%9C%A8<\/a><\/p>\n<p><a href=\"https:\/\/cpprefjp.github.io\/lang\/cpp14\/binary_literals.html\">https:\/\/cpprefjp.github.io\/lang\/cpp14\/binary_literals.html<\/a><\/p>\n<p><a href=\"http:\/\/www.musashinodenpa.com\/arduino\/ref\/index.php?f=0&amp;pos=665\">http:\/\/www.musashinodenpa.com\/arduino\/ref\/index.php?f=0&amp;pos=665<\/a><\/p>\n<p><a href=\"http:\/\/www.musashinodenpa.com\/arduino\/ref\/index.php?f=0&amp;pos=784\">http:\/\/www.musashinodenpa.com\/arduino\/ref\/index.php?f=0&amp;pos=784<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e2\u30fc\u30eb\u30b9\u4fe1\u53f7 \u30e2\u30fc\u30eb\u30b9\u4fe1\u53f7\u3092\u5fa9\u53f7\u3057\u305f\u3044\u3002\u8ab0\u304b\u304b\u3089\u9001\u3089\u308c\u3066\u304d\u305f\u3084\u3064\u3058\u3083\u306a\u304f\u3066\u3001\u81ea\u5206\u304c\u5165\u529b\u3057\u305f\u3084\u3064\u3092\u5fa9\u53f7\u3057\u305f\u3044\u3002 \u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u4e0b\u30fb\u96e2\u4e0a\u9593\u306e\u6642\u9593\u3092\u53d6\u5f97 unsigned long starttime = 0; unsigned &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2020\/02\/24\/894\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":895,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[69,88,54],"class_list":["post-894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-8","tag-arduino","tag-88","tag-54"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/894","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=894"}],"version-history":[{"count":3,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/894\/revisions"}],"predecessor-version":[{"id":902,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/894\/revisions\/902"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/895"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}