{"id":697,"date":"2015-05-09T22:55:14","date_gmt":"2015-05-09T13:55:14","guid":{"rendered":"https:\/\/hack.gpl.jp\/?p=697"},"modified":"2015-05-09T22:55:14","modified_gmt":"2015-05-09T13:55:14","slug":"post-697","status":"publish","type":"post","link":"https:\/\/hack.gpl.jp\/2015\/05\/09\/post-697.html","title":{"rendered":"ESP12\u5358\u4f53\u3067\u5149\u30bb\u30f3\u30b5\u30fc\u30a2\u30ca\u30ed\u30b0\u8aad\u307f"},"content":{"rendered":"

Aliexpress\u7d4c\u7531\u3067\u8cfc\u5165\u3057\u305f\u7d20\u6750\u3067\u904a\u3073\u307e\u3057\u305f\u3002<\/p>\n

20\u500b\u3067\u300198\u5186\u306eGL5528<\/a>\u5149\u30bb\u30f3\u30b5\u30fc\u3092\u3064\u3051\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

\"IMG_0269\" <\/p>\n

20\u500b\u306798\u5186\u3068\u3044\u3046\u3053\u3068\u306f\u30011\u500b\u3042\u305f\u308a\u7d045\u5186\u3067\u3059\u306d\u3002<\/p>\n

\"esp12-cde_fzz_-_Fritzing_-__\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9_\u30d3\u30e5\u30fc_\" <\/p>\n

ADC \u306b\u3053\u3093\u306a\u611f\u3058\u3067\u3064\u3051\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

\u5f53\u521dADC Pin\u306b\u3064\u3051\u3066\u3082\u5024\u304c\u62fe\u3048\u305a\u3001\u62b5\u6297\u5024\u3092\u53ef\u5909\u3067\u8abf\u6574\u3057\u305f\u3089\u3046\u307e\u304f\u5024\u304c\u53d6\u308c\u307e\u3057\u305f\u3002\u3053\u306eADC-GND\u9593\u306e\u96fb\u5727\u306f\u3001\u5f37\u3044\u5149\u3092\u5f53\u3066\u305f\u72b6\u614b\u3067\u7d04\uff11\uff0e\uff11\uff13V\u304f\u3089\u3044\u3067\u3059\u3002\u591c\u3001\u96fb\u6c17\u3092\u3064\u3051\u305f\u72b6\u614b\u3067\uff10\uff0e\uff19\uff18V\u304f\u3089\u3044\u3002\u624b\u3067\u8986\u3046\u3068\uff10\uff0e\uff16V\u304f\u3089\u3044\u306b\u306a\u308b\u611f\u3058\u3067\u3059\u3002<\/p>\n

 <\/p>\n

\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u3067\u3059\u3002\u30a8\u30e9\u30fc\u51e6\u7406\u304c\u629c\u3051\u3066\u3044\u308b\u306e\u304b\u3001\u30d0\u30b0\u304c\u3042\u308b\u306e\u304b\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u3061\u3087\u3063\u3068\u4e0d\u5b89\u5b9a\u3067\u3059\u3002<\/p>\n

\/*\n ESP8266 HTTP get webclient.\n ADC Read test.\n https:\/\/thingspeak.com\/channels\/37124\n Arduino-compatible IDE with ESP8266\n arduino-1.6.1-macosx-java-latest-signed.zip\n https:\/\/github.com\/esp8266\/Arduino\n JunkHack 2015.05.09\n *\/\n \n#include <ESP8266WiFi.h>\n \nconst char* ssid     = "JunkHack";\nconst char* password = "testtest";\n \nconst char* host = "184.106.153.149";\n\nint WiFiConLed = 13;\nint WEBconLed = 12;\n\nvoid setup() {\n  pinMode(WiFiConLed, OUTPUT);\n  pinMode(WEBconLed, OUTPUT);\n  Serial.begin(115200);\n  delay(10);\n \n  \/\/ We start by connecting to a WiFi network\n \n  Serial.println();\n  Serial.println();\n  Serial.print("Connecting to ");\n  Serial.println(ssid);\n \n  WiFi.begin(ssid, password);\n \n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(".");\n    digitalWrite(WiFiConLed, HIGH);\n    delay(400);\n    digitalWrite(WiFiConLed, LOW);\n    delay(100);\n  }\n \n  Serial.println("");\n  Serial.println("WiFi connected");\n  Serial.println("IP address: ");\n  Serial.println(WiFi.localIP());\n}\n \nint value = 0;\nint count = 0;\nint adc = 0;\n\nvoid loop() {\n  delay(5000);\n  ++value;\n \n  Serial.print("connecting to ");\n  Serial.println(host);\n \n  \/\/ Use WiFiClient class to create TCP connections\n  WiFiClient client;\n  const int httpPort = 80;\n  if (!client.connect(host, httpPort)) {\n    Serial.println("connection failed");\n    return;\n  }\n  \n  digitalWrite(WEBconLed, HIGH);\n  delay(1000);\n  count += 1;\n\n  Serial.print("ADC: ");\n  adc = analogRead(A0);\n  Serial.println(adc);\n \n  \/\/ We now create a URI for the request\n  String url = "\/update?key=5GPL7J7EVNB5R8GE&field1=";\n  url += adc;\n  Serial.print("Requesting URL: ");\n  Serial.println(url);\n \n  \/\/ This will send the request to the server\n  client.print(String("GET ") + url + " HTTP\/1.1\\r\\n" +\n               "Host: " + host + "\\r\\n" +\n               "Connection: close\\r\\n\\r\\n");\n  delay(10);\n \n  \/\/ Read all the lines of the reply from server and print them to Serial\n  while(client.available()){\n    String line = client.readStringUntil('\\r');\n    Serial.print(line);\n  }\n \n  \/\/ Close connection\n  Serial.println();\n  Serial.println("closing connection");\n  digitalWrite(WEBconLed, LOW);\n}<\/pre>\n

 <\/p>\n

\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u30c7\u30fc\u30bf\u304c\u6295\u3052\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/p>\n

\"ESP12_-_ThingSpeak\"<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

Aliexpress\u7d4c\u7531\u3067\u8cfc\u5165\u3057\u305f\u7d20\u6750\u3067\u904a\u3073\u307e\u3057\u305f\u3002 20\u500b\u3067\u300198\u5186\u306eGL5528\u5149\u30bb\u30f3\u30b5\u30fc\u3092\u3064\u3051\u3066\u307f\u307e\u3057\u305f\u3002 20\u500b\u306798\u5186\u3068\u3044\u3046\u3053\u3068\u306f\u30011\u500b\u3042\u305f\u308a\u7d045\u5186\u3067\u3059\u306d\u3002 ADC \u306b\u3053\u3093\u306a\u611f\u3058\u3067\u3064\u3051\u3066\u307f\u307e\u3057\u305f\u3002 \u5f53\u521dADC […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","footnotes":""},"categories":[6,30,63],"tags":[],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"JunkHack","author_link":"https:\/\/hack.gpl.jp\/author\/junkhack\/"},"uagb_comment_info":1,"uagb_excerpt":"Aliexpress\u7d4c\u7531\u3067\u8cfc\u5165\u3057\u305f\u7d20\u6750\u3067\u904a\u3073\u307e\u3057\u305f\u3002 20\u500b\u3067\u300198\u5186\u306eGL5528\u5149\u30bb\u30f3\u30b5\u30fc\u3092\u3064\u3051\u3066\u307f\u307e\u3057\u305f…","_links":{"self":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/697"}],"collection":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":0,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/697\/revisions"}],"wp:attachment":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/media?parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/categories?post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/tags?post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}