{"id":1264,"date":"2020-02-11T23:20:29","date_gmt":"2020-02-11T14:20:29","guid":{"rendered":"http:\/\/goji2100.com\/blog\/?p=1264"},"modified":"2020-02-15T09:43:07","modified_gmt":"2020-02-15T00:43:07","slug":"arduino-uno%ef%bc%8besp-wroom-02at%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a2%e3%83%bc%e3%83%89%e3%81%a7ambient","status":"publish","type":"post","link":"http:\/\/goji2100.com\/blog\/?p=1264","title":{"rendered":"Arduino UNO\uff0bESP-WROOM-02(AT\u30b3\u30de\u30f3\u30c9\u30e2\u30fc\u30c9)\u3067Ambient"},"content":{"rendered":"\r\n<p><a href=\"https:\/\/ambidata.io\/\"><strong>Ambient<\/strong><\/a>\u306f\u3001\u7c21\u4fbf\u306a\u30b7\u30b9\u30c6\u30e0\u69cb\u6210\u3067\u74b0\u5883\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3001\u84c4\u7a4d\u3001\u53ef\u8996\u5316(\u30b0\u30e9\u30d5\u5316)\u3092\u53ef\u80fd\u306b\u3059\u308b<strong>\u30a2\u30f3\u30d3\u30a8\u30f3\u30c8\u30c7\u30fc\u30bf\u30fc\u682a\u5f0f\u4f1a\u793e<\/strong>\u304c\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<\/p>\r\n<p><strong>Ambient<\/strong>\u3078\u30c7\u30fc\u30bf\u9001\u4fe1\u3059\u308b\u305f\u3081\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u3001\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306f\u3001Obniz\u3001IchigoJam\u3001ESP-WROOM-02\u3001ESP-WROOM-32\u306a\u3069\u306e\u69d8\u3005\u306a\u69cb\u6210\u3067\u306e\u30b5\u30f3\u30d7\u30eb\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\r\n<p>\u3053\u3053\u3067\u306f\u3001Arduino UNO\uff0bESP-WROOM-02(AT\u30b3\u30de\u30f3\u30c9\u30e2\u30fc\u30c9)\u306e\uff08\u3042\u307e\u308a\u4e00\u822c\u7684\u306b\u9078\u629e\u3057\u306a\u3044\u3067\u3042\u308d\u3046\uff09\u69cb\u6210\u3067\u306e\u904b\u7528\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002 \u3053\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u69cb\u6210\u3067\u904b\u7528\u3059\u308b\u306e\u306b\u5fc5\u8981\u306a\u30b9\u30b1\u30c3\u30c1\u3092\u63a2\u3057\u305f\u3068\u3053\u308d\u3001<a href=\"https:\/\/thousandiy.wordpress.com\"><strong>1000\u5186\u3042\u3063\u305f\u3089\u96fb\u5b50\u5de5\u4f5c ThousanDIY<\/strong><\/a>\u306e<strong>@tomorrow56<\/strong>\u6c0f\u304c<a href=\"https:\/\/developer.sony.com\/ja\/develop\/spresense\/\"><strong>Spresense<\/strong><\/a>\u30dc\u30fc\u30c9\u5411\u3051\u306b\u958b\u767a\u3001\u8ca9\u58f2\u3055\u308c\u3066\u3044\u308b<a href=\"https:\/\/thousandiy.wordpress.com\/2018\/10\/07\/wi-fi-add-on-board-for-spresense\/\"><strong>Wi-Fi add-on board for SPRESENSE<\/strong><\/a>\u30dc\u30fc\u30c9\u304cESP-WROOM-02\u3092AT\u30b3\u30de\u30f3\u30c9\u30e2\u30fc\u30c9\u3067\u4f7f\u7528\u3057\u3066<strong>Ambient<\/strong>\u3078\u306e\u30c7\u30fc\u30bf\u9001\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u306e\u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002<\/p>\r\n<p>\u3053\u3061\u3089\u306e\u30b5\u30f3\u30d7\u30eb\u306f<strong>Spresense<\/strong>\uff0bESP-WROOM-02\u306e\u69cb\u6210\u7528\u3067\u3059\u304c\u3001Arduino UNO\u3067\u591a\u5c11\u306e\u4fee\u6b63\u306f\u5fc5\u8981\u306a\u304c\u3089\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\r\n<p>\u7136\u3057\u306a\u304c\u3089\u3001<strong>Spresense<\/strong>\u3068\u6bd4\u3079\u3066RAM\u5bb9\u91cf\u304c\u5727\u5012\u7684\u306b\u5c11\u306a\u3044\u305f\u3081\u306b\u8a08\u6e2c\u30c7\u30fc\u30bf\u3092<strong>Ambient<\/strong>\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u9001\u51fa\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b\u30c7\u30fc\u30bf\u9818\u57df\u304c\u4e0d\u8db3\u3067\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u3001\u5b9f\u969b\u306b\u52d5\u4f5c\u304c\u4e0d\u5b89\u5b9a\uff08\u6b63\u3057\u304f\u52d5\u4f5c\u3057\u306a\u3044\uff09\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<p><strong>@tomorrow56<\/strong>\u6c0f\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u3001<strong>Ambient<\/strong>\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u306e\u89aa\u548c\u6027\u3092\u4e3b\u773c\u306b<strong>Spresense<\/strong>\u5411\u3051\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\uff08\u308b\u3082\u306e\u3068\u601d\u3044\uff09\u307e\u3059\u306e\u3067\u3001Arduino UNO\u306e\u3088\u3046\u306a\u30dc\u30fc\u30c9\u3067\u306e\u904b\u7528\u306f\u96e3\u3057\u305d\u3046\u3067\u3059\u3002<\/p>\r\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u501f\u7528\u306f\u65ad\u5ff5\u3057\u3066\u3001ESP-8266(AT\u30b3\u30de\u30f3\u30c9\u30e2\u30fc\u30c9)\u7528\u306b\u4f5c\u3089\u308c\u305f\u300cHttpClient_ESP8266_AT\u30e9\u30a4\u30d6\u30e9\u30ea\u300d\u3092\u4f7f\u308f\u305b\u3066\u3044\u305f\u3060\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\r\n<p><strong>qoosky \/ Arduino_HttpClient_ESP8266_AT<\/strong><br \/><a href=\"https:\/\/github.com\/qoosky\/Arduino_HttpClient_ESP8266_AT\">https:\/\/github.com\/qoosky\/Arduino_HttpClient_ESP8266_AT<\/a><\/p>\r\n<p><a href=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097.png\"> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1311\" src=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097-300x283.png\" alt=\"\" width=\"204\" height=\"192\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097-300x283.png 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097-1144x1080.png 1144w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097-768x725.png 768w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097-1536x1450.png 1536w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/d88cfac1bbde2fd22855ead09955f097.png 1570w\" sizes=\"(max-width: 204px) 100vw, 204px\" \/><\/a> <a href=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708.jpeg\"> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1321\" src=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-300x269.jpeg\" alt=\"\" width=\"214\" height=\"192\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-300x269.jpeg 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-1203x1080.jpeg 1203w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-768x689.jpeg 768w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-1536x1379.jpeg 1536w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/IMG_3708-2048x1838.jpeg 2048w\" sizes=\"(max-width: 214px) 100vw, 214px\" \/><\/a><\/p>\r\n<p>&nbsp;<\/p>\r\n<p><a href=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1323\" src=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-300x165.jpg\" alt=\"\" width=\"358\" height=\"197\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-300x165.jpg 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-1920x1057.jpg 1920w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-768x423.jpg 768w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-1536x845.jpg 1536w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2020\/02\/1e1180da73d607b19233c1905c3a1e46-2048x1127.jpg 2048w\" sizes=\"(max-width: 358px) 100vw, 358px\" \/><\/a><\/p>\r\n<p>&nbsp;<\/p>\r\n<h4><!--more \u3010\u7d9a\u304d\u3092\u8aad\u3080\u3011--> <\/h4>\r\n<p><strong>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9(update:2020\/ 2\/13 14:50)<\/strong><\/p>\r\n<pre class=\"lang:arduino decode:true \" title=\"Ambient_AT_HTTPPOST\">#include &lt;HttpClient_ESP8266_AT.h&gt;\r\n\r\n#define WSSID             \"SSID\"\r\n#define WPASSWORD         \"PASSWORD\"\r\n\r\n#define AMBIENT_HOST      \"54.65.206.59\"\r\n#define AMBIENT_CHANNELID \"12345\"\r\n#define AMBIENT_WRITEKEY  \"WriteKey\"\r\n\r\nconst byte rxPin = 2; \/\/ Wire this to Tx Pin of ESP8266\r\nconst byte txPin = 4; \/\/ Wire this to Rx Pin of ESP8266\r\nHttpClient_ESP8266_AT httpClient(rxPin, txPin);\r\n\r\n#include &lt;DHT12.h&gt;\r\nDHT12 dht12;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  dht12.begin();\r\n\r\n  while (true) {\r\n    if (httpClient.statusAT()) break;\r\n    Serial.println(\"AT status NOT OK\");\r\n    delay(1000);\r\n  }\r\n  Serial.println(\"AT status OK\");\r\n\r\n  while (true) {\r\n    if (httpClient.connectAP(WSSID, WPASSWORD)) break;\r\n    Serial.println(\"Failed to connected to an AP. retrying...\");\r\n    delay(1000);\r\n  }\r\n  Serial.println(\"Successfully connected to an AP\");\r\n\r\n  while (true) {\r\n    if (httpClient.statusWiFi()) break;\r\n    Serial.println(\"WiFi status NOT OK\");\r\n    delay(1000);\r\n  }\r\n  Serial.println(\"WiFi status OK\");\r\n}\r\n\r\nvoid loop() {\r\n  float t12 = dht12.readTemperature();\r\n  float h12 = dht12.readHumidity();\r\n\r\n  if (isnan(t12) || isnan(h12)) {\r\n    Serial.println(\"Failed to read from DHT12 sensor!\");\r\n  } else {\r\n    String bodys = \"{\\\"writeKey\\\":\\\"\" AMBIENT_WRITEKEY \"\\\",\"\r\n                   \"\\\"d1\\\":\\\"\" + String(t12) + \"\\\",\"\r\n                   \"\\\"d2\\\":\\\"\" + String(h12) + \"\\\"}\";\r\n    Serial.println(bodys);\r\n\r\n    httpClient.post(AMBIENT_HOST,\r\n                    \"\/api\/v2\/channels\/\" AMBIENT_CHANNELID \"\/data\",\r\n                    bodys,\r\n                    \"application\/json\");\r\n\r\n    if (httpClient.responseStatusCode() &gt;= 0) {\r\n      Serial.println(\"SUCCESS\");\r\n    } else {\r\n      Serial.println(\"FAILURE, retrying...\");\r\n    }\r\n  }\r\n  delay(60000);\r\n}<\/pre>\r\n<p><br \/><strong>\u300cAmbient\u306e\u8af8\u5143\u3001\u5236\u9650\u300d<\/strong>\u304b\u3089\u306e\u5f15\u7528<\/p>\r\n<div style=\"margin-left: 1em; text-indent: -1em;\">\u30fb1\u30c1\u30e3\u30cd\u30eb\u3042\u305f\u308a1\u65e53,000\u4ef6\u307e\u3067\u30c7\u30fc\u30bf\u30fc\u3092\u767b\u9332\u3067\u304d\u307e\u3059\u3002<br \/>\u5e73\u5747\u3059\u308b\u306828.8\u79d2\u306b1\u56de\u306e\u30da\u30fc\u30b9\u3067\u3059\u3002<\/div>","protected":false},"excerpt":{"rendered":"<p>Ambient\u306f\u3001\u7c21\u4fbf\u306a\u30b7\u30b9\u30c6\u30e0\u69cb\u6210\u3067\u74b0\u5883\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3001\u84c4\u7a4d\u3001\u53ef\u8996\u5316(\u30b0\u30e9\u30d5\u5316)\u3092\u53ef\u80fd\u306b\u3059\u308b\u30a2\u30f3\u30d3\u30a8\u30f3\u30c8\u30c7\u30fc\u30bf\u30fc\u682a\u5f0f\u4f1a\u793e\u304c\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002 Ambient\u3078\u30c7\u30fc\u30bf\u9001\u4fe1\u3059\u308b\u305f\u3081\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u3001\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306f\u3001Obni [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,7,26],"tags":[49,50,27],"_links":{"self":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1264"}],"collection":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1264"}],"version-history":[{"count":56,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1264\/revisions"}],"predecessor-version":[{"id":1324,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1264\/revisions\/1324"}],"wp:attachment":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1264"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}