{"id":1280,"date":"2019-07-09T14:22:06","date_gmt":"2019-07-09T05:22:06","guid":{"rendered":"https:\/\/eguchi.jp\/blog\/?p=1280"},"modified":"2019-07-09T14:22:07","modified_gmt":"2019-07-09T05:22:07","slug":"soracom-m5stack-3g%e6%8b%a1%e5%bc%b5%e3%83%9c%e3%83%bc%e3%83%89%e3%81%a7ussd%e9%80%81%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/eguchi.jp\/blog\/?p=1280","title":{"rendered":"SORACOM M5STACK 3G\u62e1\u5f35\u30dc\u30fc\u30c9\u3067USSD\u9001\u4fe1"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u7d4c\u7def<\/h2>\n\n\n\n<p>\u524d\u56de\u306e\u6295\u7a3f\u300e<a href=\"https:\/\/eguchi.jp\/blog\/?p=1276\">M5STACK \uff13G\u62e1\u5f35\u30dc\u30fc\u30c9\u304cIP\u3092\u53d6\u5f97\u3059\u308b\u307e\u3067<\/a>\u300f\u3001\u3067\u30b5\u30fc\u30d0\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308c\u308b\u307e\u3067\u3001\uff11\u5206\u8fd1\u304f\u304b\u304b\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3069\u3046\u304b\u306a\uff1f\u3068\u601d\u3063\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001\u300e<a href=\"https:\/\/soracom.jp\/services\/air\/cellular\/price_iot_sim\/\">SORACOM IoT SIM<\/a>\u300f\u306f\u3001\u65e5\u672c\u3092\u542b\u3080\u4e16\u754c\u4e2d\u3067\u5229\u7528\u3067\u304d\u308bSIM\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u56fd\u5185\u5411\u3051\u306eSIM\u306b\u306f\u306a\u3044\u7279\u5fb4\u3092\u6301\u3063\u3066\u3044\u3066\u3001USSD(Unstructured Supplementary Service Data\u00a0)\u7d4c\u7531\u3067\u30b5\u30fc\u30d0\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <\/p>\n\n\n\n<p>\u8a73\u3057\u304f\u306f\u3001<a href=\"https:\/\/dev.soracom.io\/jp\/docs\/ussd\/\">https:\/\/dev.soracom.io\/jp\/docs\/ussd\/<\/a>\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u65e9\u901f\u30b3\u30fc\u30c9<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#include &amp;lt;M5Stack.h&gt;\n\n#define CONSOLE Serial\n#define MODEM Serial2\n\n#define TINY_GSM_DEBUG Serial\n#define TINY_GSM_MODEM_UBLOX\n\n#include &amp;lt;TinyGsmClient.h&gt;\n\nTinyGsm modem(Serial2);\nTinyGsmClient ctx(modem);\n\nvoid setup() {\n  M5.begin();\n  M5.Lcd.clear(BLACK);\n  M5.Lcd.setTextColor(WHITE);\n  M5.Lcd.println(F(&quot;M5Stack + 3G Module&quot;));\n\n  MODEM.begin(115200, SERIAL_8N1, 16, 17);    \/\/ 3G MODULE\n\n  uint64_t t1 = millis();\n\n  CONSOLE.println(F(&quot;waitForNetwork()&quot;));\n  M5.Lcd.print(F(&quot;waitForNetwork()&quot;));\n  while (!modem.waitForNetwork()) M5.Lcd.print(&quot;.&quot;);\n  M5.Lcd.println(F(&quot;Ok&quot;));\n\n  CONSOLE.printf(&quot;Time = %d &#x5B;ms]\\r\\n&quot;,millis() - t1);\n\n  CONSOLE.println(&quot;Send USSD!!!&quot;);\n  MODEM.write(&quot;AT+CUSD=1,\\&quot;*901011*123#\\&quot;,15\\r&quot;);\n}\n\nvoid loop() {\n  if (MODEM.available() &gt; 0) {\n    CONSOLE.write(MODEM.read());\n  }\n\n  if (CONSOLE.available()) {\n    MODEM.write(CONSOLE.read());\n  }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u52d5\u4f5c\u30ed\u30b0<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n14:04:24.058 -&gt; waitForNetwork()\n14:04:24.058 -&gt; &#x5B;766] ### AT: +CGREG?\n14:04:25.070 -&gt; &#x5B;1767] ### AT: +CGATT?\n14:04:26.298 -&gt; &#x5B;3017] ### AT: +CGREG?\n14:04:27.299 -&gt; &#x5B;4017] ### AT: +CGATT?\n14:04:27.557 -&gt; &#x5B;4276] ### AT: +CGREG?\n14:04:27.845 -&gt; &#x5B;4533] ### AT: +CGREG?\n14:04:28.066 -&gt; &#x5B;4789] ### AT: +CGREG?\n14:04:28.346 -&gt; &#x5B;5044] ### AT: +CGREG?\n14:04:28.600 -&gt; &#x5B;5299] ### AT: +CGREG?\n14:04:28.847 -&gt; &#x5B;5554] ### AT: +CGREG?\n14:04:29.105 -&gt; &#x5B;5809] ### AT: +CGREG?\n14:04:29.364 -&gt; &#x5B;6064] ### AT: +CGREG?\n14:04:29.612 -&gt; &#x5B;6319] ### AT: +CGREG?\n14:04:29.865 -&gt; &#x5B;6575] ### AT: +CGREG?\n14:04:30.107 -&gt; &#x5B;6830] ### AT: +CGREG?\n14:04:30.394 -&gt; &#x5B;7086] ### AT: +CGREG?\n14:04:30.644 -&gt; &#x5B;7342] ### AT: +CGREG?\n14:04:30.894 -&gt; &#x5B;7597] ### AT: +CGREG?\n14:04:31.157 -&gt; &#x5B;7853] ### AT: +CGREG?\n14:04:31.398 -&gt; &#x5B;8108] ### AT: +CGREG?\n14:04:31.646 -&gt; &#x5B;8364] ### AT: +CGREG?\n14:04:31.902 -&gt; &#x5B;8619] ### AT: +CGREG?\n14:04:32.152 -&gt; &#x5B;8875] ### AT: +CGREG?\n14:04:32.434 -&gt; &#x5B;9130] ### AT: +CGREG?\n14:04:32.682 -&gt; &#x5B;9385] ### AT: +CGREG?\n14:04:32.942 -&gt; &#x5B;9640] ### AT: +CGREG?\n14:04:33.186 -&gt; &#x5B;9895] ### AT: +CGREG?\n14:04:33.443 -&gt; &#x5B;10151] ### AT: +CGREG?\n14:04:33.692 -&gt; &#x5B;10406] ### AT: +CGREG?\n14:04:33.943 -&gt; &#x5B;10662] ### AT: +CGREG?\n14:04:34.202 -&gt; &#x5B;10918] ### AT: +CGREG?\n14:04:34.482 -&gt; &#x5B;11173] ### AT: +CGREG?\n14:04:34.729 -&gt; &#x5B;11428] ### AT: +CGREG?\n14:04:34.979 -&gt; &#x5B;11683] ### AT: +CGREG?\n14:04:35.232 -&gt; &#x5B;11938] ### AT: +CGREG?\n14:04:35.479 -&gt; &#x5B;12193] ### AT: +CGREG?\n14:04:35.729 -&gt; &#x5B;12449] ### AT: +CGREG?\n14:04:35.985 -&gt; &#x5B;12705] ### AT: +CGREG?\n14:04:36.270 -&gt; &#x5B;12960] ### AT: +CGREG?\n14:04:36.270 -&gt; Time = 12201 &#x5B;ms]\n14:04:36.270 -&gt; Send USSD!!!\n14:04:36.270 -&gt; AT+CUSD=1,&quot;*901011*123#&quot;,15\n\n14:04:39.793 -&gt; +CUSD: 0,&quot;sent to Beam&quot;,15\n14:04:39.793 -&gt; \n14:04:39.793 -&gt; OK\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u8aac<\/h2>\n\n\n\n<p>USSD\u306f\u3001\uff13G\u306e\u56de\u7dda\u304c\u3064\u306a\u304c\u308c\u3070\u3001\u9001\u4fe1\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001waitForNetwork()\u3067\uff13G\u56de\u7dda\u63a5\u7d9a\u304c\uff11\uff12\u79d2\u3067\u3001\u5b8c\u4e86\u3057\u305f\u3089\u3001USSD\u3092\u9001\u4fe1\u3059\u308b\uff08\u30c7\u30fc\u30bf\u306f123)\u3068\u3044\u3046\u3060\u3051\u306e\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002SORACOM Beam\u7d4c\u7531\u3067\u4efb\u610f\u306e\u30b5\u30fc\u30d0\u306b\u30c7\u30fc\u30bf\u3092\u5c4a\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u306e\u30dc\u30bf\u30f3\u3088\u308a\u306f\u9045\u3044\u3051\u3069\u3001\u307e\u3042\u3001IP\u63a5\u7d9a\u306e\uff11\u5206\u306b\u6bd4\u3079\u308c\u3070\u3001\uff11\uff12\u79d2\u306a\u3089\u6211\u6162\u3067\u304d\u308b\u304b\uff1f<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u3001\u3054\u53c2\u8003\u307e\u3067\u306b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d4c\u7def \u524d\u56de\u306e\u6295\u7a3f\u300eM5STACK \uff13G\u62e1\u5f35\u30dc\u30fc\u30c9\u304cIP\u3092\u53d6\u5f97\u3059\u308b\u307e\u3067\u300f\u3001\u3067\u30b5\u30fc\u30d0\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308c\u308b\u307e\u3067\u3001\uff11\u5206\u8fd1\u304f\u304b\u304b\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3069\u3046\u304b\u306a\uff1f\u3068\u601d\u3063\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001\u300eSORACOM IoT SIM\u300f\u306f\u3001\u65e5\u672c\u3092\u542b\u3080\u4e16\u754c\u4e2d\u3067\u5229 &hellip; <a href=\"https:\/\/eguchi.jp\/blog\/?p=1280\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">SORACOM M5STACK 3G\u62e1\u5f35\u30dc\u30fc\u30c9\u3067USSD\u9001\u4fe1<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1280","post","type-post","status-publish","format-standard","hentry","category-2"],"_links":{"self":[{"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1280"}],"version-history":[{"count":1,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1280\/revisions"}],"predecessor-version":[{"id":1281,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1280\/revisions\/1281"}],"wp:attachment":[{"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eguchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}