
{"id":5390,"date":"2016-12-14T18:03:32","date_gmt":"2016-12-14T09:03:32","guid":{"rendered":"https:\/\/okiraku-camera.tokyo\/blog\/?p=5390"},"modified":"2017-07-28T10:38:20","modified_gmt":"2017-07-28T01:38:20","slug":"gy-2561%e3%81%a8esp-wroom-02%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e7%85%a7%e5%ba%a6%e3%82%92%e6%b8%ac%e3%82%8b","status":"publish","type":"post","link":"https:\/\/okiraku-camera.tokyo\/blog\/?p=5390","title":{"rendered":"GY-2561\u3068ESP-WROOM-02\u3092\u4f7f\u3063\u3066\u7167\u5ea6\u3092\u6e2c\u308b"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>\u30c7\u30b8\u30bf\u30eb\u5149\u30bb\u30f3\u30b5\u30fc\u306eTSL2561\u3092\u8f09\u305b\u305f\u3001GY-2561\u3068\u3044\u3046\u30d6\u30ec\u30a4\u30af\u30a2\u30a6\u30c8\u30dc\u30fc\u30c9\u3068ESP-WROOM-02\u3092\u4f7f\u3063\u3066\u3001\u7167\u5ea6\u8a08\u3092\u4f5c\u3063\u3066\u307f\u308b\u3002WROOM-02\u3067web\u30b5\u30fc\u30d0\u30fc\u3092\u52d5\u304b\u3057\u3001PC\u3084\u30b9\u30de\u30db\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u7167\u5ea6\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<p>TSL2561\u306f\u3001TAOS\u793e(\u73fe\u5728\u306fams\u793e)\u304c\u958b\u767a\u3057\u305f &#8220;luminosity sensor&#8221; \u3067\u3001\u76f4\u8a33\u3059\u308c\u3070\u5149\u5ea6\u30bb\u30f3\u30b5\u30fc\u3068\u3044\u3046\u3053\u3068\u3060\u308d\u3046\u304b\u3002\u5149\u5ea6\u3068\u7167\u5ea6\u306e\u9055\u3044\u306f\u3088\u304f\u5206\u304b\u3089\u306a\u3044\u304c\u3001\u5149\u306b\u7167\u3089\u3055\u308c\u3066\u3044\u308b\u30bb\u30f3\u30b5\u30fc\u9762\u306e\u660e\u308b\u3055\u3092\u6570\u5024\u5316\u3057\u3066\u304f\u308c\u308b\u30c7\u30d0\u30a4\u30b9\u3068\u3044\u3046\u3053\u3068\u3060\u308d\u3046\u3002<\/p>\n<p>\u30c6\u30fc\u30bf\u30b7\u30fc\u30c8\u3092\u8aad\u3093\u3067\u3044\u3066\u304a\u3082\u3057\u308d\u3044\u3068\u601d\u3063\u305f\u306e\u306f\u30012\u3064\u306e\u30d5\u30a9\u30c8\u30c0\u30a4\u30aa\u30fc\u30c9\u30682\u3064\u306e\u7a4d\u5206\u578bA\/D\u30b3\u30f3\u30d0\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u3066\u3001\u4e00\u65b9\u306f\u5e83\u5e2f\u57df\u7528\u3001\u4e00\u65b9\u306f\u8d64\u5916\u5149\u7528\u3068\u306e\u3053\u3068\u30022\u3064\u306e\u30c1\u30e3\u30cd\u30eb\u3067\u540c\u6642\u306b\u6570\u5024\u5316\u3092\u884c\u3044\u3001\u5e83\u5e2f\u57df\u5074\u306e\u5024\u304b\u3089\u8d64\u5916\u5149\u306e\u5bc4\u4e0e\u5206\u3092\u9664\u53bb\u3059\u308b\u3053\u3068\u3067\u3001\u4eba\u9593\u306e\u611f\u899a\u306b\u8fd1\u3044\u7167\u5ea6\u304c\u5f97\u3089\u308c\u308b\u3068\u306e\u3053\u3068\u3002<a href=\"http:\/\/ams.com\/eng\/content\/download\/250094\/975485\/file\/TSL2560-61_DS000110_2-00.pdf\">\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306f\u3053\u3061\u3089<\/a>\u306e\u30e1\u30fc\u30ab\u30fc\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3002I2C\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u5099\u3048\u3066\u3044\u308b\u306e\u3067\u3001Arduino\u3084ESP-WROOM-02\u3068\u306e\u63a5\u7d9a\u306f\u7c21\u5358\u3067\u3042\u308b\u3002<\/p>\n<h2>GY-2561<\/h2>\n<p>TSL2561\u3092\u8f09\u305b\u305f\u30d6\u30ec\u30a4\u30af\u30a2\u30a6\u30c8\u30dc\u30fc\u30c9\u3092\u53d6\u308a\u5bc4\u305b\u305f\u3068\u3053\u308d\u3001GY-2561\u3068\u3044\u3046\u88fd\u54c1\u304c\u5c4a\u3044\u305f\u3002\u30a2\u30de\u30be\u30f3\u30672\u500b\u5165\u308a\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c295\u5186\u3001\u4f8b\u306b\u3088\u3063\u3066\u5e83\u6771\u7701\u304b\u3089\u306e\u9001\u6599\u8fbc\u3060\u3063\u305f\u3002\u4eca\u56de\u306f\u30dd\u30c1\u3063\u3068\u3057\u3066\u304b\u3089\u5c4a\u304f\u307e\u3067\u306b25\u65e5\u9593\u307b\u3069\u304b\u304b\u3063\u305f\u304c\u3001\u307e\u3042\u4ed5\u65b9\u306a\u3044\u3060\u308d\u3046\u3002<br \/>\n\u5148\u65e5\u4f7f\u3063\u3066\u307f\u305f<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=5291\">\u6e29\u5ea6\u30fb\u6c17\u5727\u30bb\u30f3\u30b5\u30fc\u306eGY-BMP280<\/a>\u3068\u3088\u304f\u4f3c\u3066\u3044\u308b\u3002\u305d\u308c\u306b\u3057\u3066\u3082\u3001\u88fd\u9020\u3057\u3066\u3044\u308b\u30e1\u30fc\u30ab\u30fc\u3082\u5206\u304b\u3089\u306a\u3051\u308c\u3070\u3001\u5c4a\u304f\u307e\u3067\u88fd\u54c1\u540d\u3082\u5206\u304b\u3089\u306a\u3044\u3002\u798f\u888b\u7684\u306a\u8981\u7d20\u3082\u3042\u3063\u3066\u9762\u767d\u307f\u3082\u3042\u308b\u306e\u3060\u304c\u3002<\/p>\n<h3>\u5916\u89b3<\/h3>\n<figure id=\"attachment_5392\" aria-describedby=\"caption-attachment-5392\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/8d9c1d8d5c5b11644ac2c3718dd889cb.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5392\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/8d9c1d8d5c5b11644ac2c3718dd889cb-552x414.jpg\" alt=\"GY-2561 \u8868\u5074\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-5392\" class=\"wp-caption-text\">GY-2561 \u8868\u5074<\/figcaption><\/figure>\n<figure id=\"attachment_5391\" aria-describedby=\"caption-attachment-5391\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/4510888fd45c227f72e89bfd657639c5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5391\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/4510888fd45c227f72e89bfd657639c5-552x414.jpg\" alt=\"GY-2561 \u88cf\u5074\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-5391\" class=\"wp-caption-text\">GY-2561 \u88cf\u5074<\/figcaption><\/figure>\n<p>\u30dc\u30fc\u30c9\u3068\u4e00\u7dd2\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3055\u308c\u3066\u3044\u308b5\u672c\u8db3\u306e\u30d4\u30f3\u30d8\u30c3\u30c0\u3092\u30cf\u30f3\u30c0\u4ed8\u3051\u3057\u305f\u5f8c\u3067\u64ae\u5f71\u3002<br \/>\n\u30dc\u30fc\u30c9\u81ea\u4f53\u306e\u5927\u304d\u3055\u306f20mm \u00d7 14mm\u7a0b\u5ea6\u3002\u8868\u5074\u306e\u4e2d\u592e\u5de6\u5bc4\u308a\u306bTSL2561FN\u304c\u8f09\u3063\u3066\u3044\u3066\u3001\u53f3\u5074\u306b\u306f3.3V\u51fa\u529b\u306eLDO\u3068\u30b3\u30f3\u30c7\u30f3\u30b5\u3001\u30d7\u30eb\u30a2\u30c3\u30d7\u62b5\u6297\u306a\u3069\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u3002\u8868\u5074\u306b\u306f\u3001L H \u3068\u66f8\u304b\u308c\u305f\u30b8\u30e3\u30f3\u30d1\u30a8\u30ea\u30a2\u304c\u3042\u308b\u304c\u3001I2C\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u5909\u66f4\u3059\u308b\u3068\u304d\u306b\u4f7f\u3046\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n<h3>\u56de\u8def\u56f3<\/h3>\n<p>\u4f8b\u306b\u3088\u3063\u3066\u983c\u308a\u306b\u306a\u308b\u8cc7\u6599\u304c\u5c11\u306a\u3044\u306e\u3067\u3001\u914d\u7dda\u30d1\u30bf\u30fc\u30f3\u306b\u57fa\u3065\u3044\u3066\u53c2\u8003\u7528\u306e\u56de\u8def\u56f3\u3092\u8d77\u3053\u3057\u3066\u307f\u305f\uff08\u5b9f\u969b\u3068\u7570\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff09\u3002<\/p>\n<figure id=\"attachment_5395\" aria-describedby=\"caption-attachment-5395\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/GY-2561-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5395\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/GY-2561-1-552x345.png\" alt=\"GY-2561\u7b49\u4fa1\u56de\u8def\" width=\"552\" height=\"345\" \/><\/a><figcaption id=\"caption-attachment-5395\" class=\"wp-caption-text\">GY-2561\u7b49\u4fa1\u56de\u8def<\/figcaption><\/figure>\n<p>TSL2561\u306e\u96fb\u6e90\u96fb\u5727\u306f2.7\uff5e3.6V\u3067\u3001\u52d5\u4f5c\u6642\u306e\u6d88\u8cbb\u96fb\u6d41\u304c0.6mA max\u3067\u3042\u308b\u3002\u5c0f\u3055\u306aLDO\u306f+3.3V 200mA\u51fa\u529b\u306eXC6206P332\u3060\u308d\u3046\u3002\u308f\u3056\u308f\u3056LDO\u304c\u8f09\u3063\u3066\u3044\u308b\u306e\u306f\u3001+5V\u52d5\u4f5c\u306e\u30de\u30a4\u30b3\u30f3\u3068\u4e00\u7dd2\u306b\u4f7f\u3046\u3053\u3068\u3092\u610f\u56f3\u3057\u305f\u3082\u306e\u3060\u3068\u601d\u3046\u304c\u3001+5V\u7cfb\u306e\u30b7\u30ea\u30a2\u30eb\u7dda(SCL, SDA) \u3092\u76f4\u7d50\u3059\u308b\u3068\u7d76\u5bfe\u6700\u5927\u5b9a\u683c\u3092\u8d85\u3048\u3066\u3057\u307e\u3046\u3002I2C\u306e\u30ec\u30d9\u30eb\u30b3\u30f3\u30d0\u30fc\u30bf\u3092\u631f\u3080\u304b\u3001\u76f4\u7d50\u3059\u308b\u306a\u3089\u3070+3.3V\u306e\u30de\u30a4\u30b3\u30f3\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\u3060\u308d\u3046\u3002\u4eca\u56de\u306f+3.3V\u96fb\u6e90\u306eWROOM-02\u3068\u4f7f\u3046\u306e\u3067\u76f4\u7d50\u53ef\u80fd\u3002\u305d\u3046\u306a\u308b\u3068\u3001LDO\u306f\u4f59\u8a08\u306a\u3060\u3051\u3067\u3042\u308b\u30021\u679a\u3042\u305f\u308a150\u5186\u3082\u3057\u306a\u3044\u3082\u306e\u306a\u306e\u3067\u3001\u305d\u306e\u3046\u3061LDO\u3092\u5916\u3057\u3066VIN\u3068VOUT\u3092\u76f4\u7d50\u3057\u3066\u3057\u307e\u304a\u3046\u304b\u3068\u601d\u3063\u3066\u3044\u308b\u3002\u4eca\u56de\u306f\u3001XCP6206P332\u306e\u4f4e\u8ca0\u8377\u6642\u306e\u30c9\u30ed\u30c3\u30d7\u30a2\u30a6\u30c8\u304c0.35V\u4ee5\u4e0b\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u305d\u306e\u307e\u307e\u4f7f\u3063\u3066\u3082\u554f\u984c\u306a\u3044\u3068\u5224\u65ad\u3057\u305f\u3002<\/p>\n<p>\u30b3\u30f3\u30c7\u30f3\u30b5\u304c4\u3064\u8f09\u3063\u3066\u3044\u308b\u304c\u3001LDO\u306e\u524d\u5f8c\u304c0.1\u03bcF\u3067\u3001LDO\u8fd1\u508d\u306e\u3082\u3046\u4e00\u3064\u304c1\uff5e10\u03bcF\u3068\u3044\u3063\u305f\u3068\u3053\u308d\u3060\u308d\u3046\u304b\u3002TSL2561\u306eVDD-GND\u9593\u306e\u30b3\u30f3\u30c7\u30f3\u30b5( C4 )\u306f\u3001\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u3088\u308c\u30700.1\u03bcF\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u307e\u305f\u3001\u4eca\u56de\u5165\u624b\u3057\u305f\u30dc\u30fc\u30c9\u3067\u306f\u3001\u30b8\u30e3\u30f3\u30d1\u30a8\u30ea\u30a2\u304c\u30aa\u30fc\u30d7\u30f3\u3060\u3063\u305f\u306e\u3067\u3001I2C\u30a2\u30c9\u30ec\u30b9\u306f0x39\u3068\u601d\u308f\u308c\u308b\u3002\u56f3\u306b\u8a18\u3057\u305f\u3088\u3046\u306b\u3001H\u5074\u307e\u305f\u306fL\u5074\u306b\u30b8\u30e3\u30f3\u30d1\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u30a2\u30c9\u30ec\u30b9\u306e\u5909\u66f4\u3082\u53ef\u80fd\u3002<\/p>\n<p>INT\u7aef\u5b50\u306f\u30de\u30a4\u30b3\u30f3\u306e\u5272\u8fbc\u307f\u8981\u56e0\uff08\u30ec\u30d9\u30eb\u5909\u5316\uff09\u3068\u3057\u3066\u4f7f\u3046\u3053\u3068\u304c\u610f\u56f3\u3055\u308c\u3066\u3044\u308b\u3002\u5185\u90e8A\/D\u30b3\u30f3\u30d0\u30fc\u30bf\u306b\u3088\u308b\u7a4d\u5206\u304c\u5b8c\u4e86\u3057\u305f\u6642\u70b9\u3067\u30a2\u30b5\u30fc\u30c8\u3057\u305f\u308a\u3001\u691c\u51fa\u3057\u305f\u7167\u5ea6\u304c\u3042\u308b\u7bc4\u56f2\u3092\u9038\u8131\u3057\u305f\u5834\u5408\u306b\u30a2\u30b5\u30fc\u30c8\u3059\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u304c\u8a2d\u5b9a\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u308b\u3002INT\u7aef\u5b50\u306f\u30aa\u30fc\u30d7\u30f3\u30c9\u30ec\u30a4\u30f3\u51fa\u529b\u306a\u306e\u3067\u3001\u4f7f\u3046\u3068\u304d\u306f\u30d7\u30eb\u30a2\u30c3\u30d7\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<h2>\u5168\u4f53\u306e\u56de\u8def<\/h2>\n<p>ESP-WROOM-02\u5074\u306f\u3044\u3064\u3082\u901a\u308a\u306b\u79cb\u6708\u96fb\u5b50\u306eAE-ESP-WROOM02\u3092\u7528\u3044\u305f\u3002GY-2561\u3068\u3082\u306b\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u4e0a\u306e\u4e09\u7aef\u5b50\u30ec\u30ae\u30e5\u30ec\u30fc\u30bf (TA48033S)\u3000\u304b\u3089+3.3V\u3092\u4f9b\u7d66\u3059\u308b\u3002\u30b9\u30b1\u30c3\u30c1\u3084html\u30d5\u30a1\u30a4\u30eb\u3092\u6295\u5165\u3059\u308b\u3068\u304d\u306b\u306f\u3001TXD\u3068RXD\u306bUSB-\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30d0\u30fc\u30bf\u306eAE-FT231X\u3092\u63a5\u7d9a\u3057\u305f\u3002<\/p>\n<p>I2C\u63a5\u7d9a\u306a\u306e\u3067\u3001GY-2561\u306eSCL\u3092GPIO5\u306b\u3001SDA\u3092GPIO4\u306b\u63a5\u7d9a\u3057\u3066\u3044\u308b\u3002INT\u7aef\u5b50\u306fGPIO13\u306b\u63a5\u7d9a\u3057\u300110k\u03a9\u3067\u30d7\u30eb\u30a2\u30c3\u30d7\u3057\u305f\u3002esp8266\u306e\u5834\u5408\u3001GPIO1\uff5e15\u3092\u5916\u90e8\u5272\u8fbc\u307f\u8981\u56e0\u3068\u3057\u3066\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<figure id=\"attachment_5422\" aria-describedby=\"caption-attachment-5422\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/WROOM02-GY2561-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5422\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/WROOM02-GY2561-1-552x345.png\" alt=\"wroom02-gy2561-1\" width=\"552\" height=\"345\" \/><\/a><figcaption id=\"caption-attachment-5422\" class=\"wp-caption-text\">wroom02-gy2561-1<\/figcaption><\/figure>\n<figure id=\"attachment_5438\" aria-describedby=\"caption-attachment-5438\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/0f5bbb3f35b25f9e623104351d7b422f.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5438\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/0f5bbb3f35b25f9e623104351d7b422f-552x414.jpg\" alt=\"WROOM-02 + GY-2561\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-5438\" class=\"wp-caption-text\">WROOM-02 + GY-2561<\/figcaption><\/figure>\n<p>\u3075\u3064\u3046\u306e\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u306b\u8f09\u305b\u308b\u3068\u3053\u3093\u306a\u5177\u5408\u306b\u306a\u3063\u305f\u3002\u30bb\u30f3\u30b5\u30fc\u306b\u3042\u305f\u308b\u5149\u3092\u906e\u3089\u306a\u3044\u3088\u3046\u306b\u3001\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u7528\u306e\u30ef\u30a4\u30e4\u3092\u4f7f\u3063\u3066\u914d\u7dda\u3057\u305f\u3002\u96fb\u6e90\u7aef\u5b50\u306f\u79cb\u6708\u306eDC\u30b8\u30e3\u30c3\u30afDIP\u5316\u30ad\u30c3\u30c8\u3092\u7528\u3044\u3066\u3044\u3066\u3001\u305d\u306e\u5148\u306b\u306fDC\u30d7\u30e9\u30b0\uff0dUSB\u30b1\u30fc\u30d6\u30eb\u3092\u4ecb\u3057\u3066\u30b9\u30de\u30db\u5145\u96fb\u7528\u306e\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u3092\u63a5\u7d9a\u3057\u3066\u3044\u308b\u3002<\/p>\n<h2>\u30b9\u30b1\u30c3\u30c1\u306a\u3069<\/h2>\n<p>\u5168\u4f53\u3068\u3057\u3066\u306f\u3001<a href=\"https:\/\/github.com\/esp8266\"><em>ESP8266 Core for Arduino<\/em><\/a> \u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3042\u308b\u3001ESP8266WebServer \u30af\u30e9\u30b9\u3092\u7528\u3044\u3066\u304a\u308a\u3001TSL2561\u304b\u3089\u6700\u65b0\u306e\u7167\u5ea6\u3092\u5f97\u308b\u6a5f\u80fd\u3001\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5fdc\u3058\u3066\u305d\u306e\u6642\u70b9\u3067\u306e\u7167\u5ea6\u3092\u5fdc\u7b54\u3059\u308b\u6a5f\u80fd\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u7167\u5ea6\u8868\u793a\u3092\u884c\u3046html\u30d5\u30a1\u30a4\u30eb (ESP8266\u306eSPIFFS\u5185\u306b\u683c\u7d0d) \u304b\u3089\u69cb\u6210\u3057\u3066\u3044\u308b\u3002\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u4ed8\u5c5e\u306eFSBrowser\u3068\u3044\u3046\u30b5\u30f3\u30d7\u30eb\u3092\u53c2\u8003\u306b\u3057\u305f\u3002<\/p>\n<h3>TSL2561\u3068\u306e\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9<\/h3>\n<p>TSL2561\u3068\u306e\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u3068\u308b\u90e8\u5206\u306b\u3064\u3044\u3066\u306fC++\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066\u72ec\u7acb\u3055\u305b\u305f\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb (i2c_tsl2561.h) \u3092\u30e1\u30a4\u30f3\u306e\u30b9\u30b1\u30c3\u30c1\u3068\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u306b\u304a\u3044\u3066\u304a\u3051\u3070\u3001Arduino IDE\u306b\u30bf\u30d6\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<pre class=\"lang:c++ decode:true\" title=\"i2c_tsl2561.h\">#include &lt;stdint.h&gt;\r\n#include \"Wire.h\"\r\n\r\n\/\/ i2c_tsl2561.h\r\n\/\/ \u6e2c\u5b9a\u6642\u306e\u7a4d\u5206\u6642\u9593\u306f\u5e38\u306b402msec\u3068\u3059\u308b(INTEG = 10B, scale = 1)\r\nclass tsl2561\r\n{\r\n  byte i2c_address;\r\n  byte i2c_status = 0;\r\n  \r\n  byte device_id = 0;\r\n  uint16_t data_ch0, data_ch1;\r\n  double lux_value;\r\n  bool gain16 = false; \/\/ false \u306e\u3068\u304dx1 , true\u306e\u3068\u304dx16\r\n  enum {reg_control = 0, reg_timing = 1, reg_thr_L = 2, reg_thr_H = 4, reg_int = 6, reg_id = 0x0a, reg_data0 = 0x0c, reg_data1 = 0x0e };\r\n  enum {cmd_clear_int = 0xc0 };\r\n\r\npublic:\r\n  tsl2561(byte addr = 0x39) {\r\n    i2c_address = addr;\r\n    Wire.begin();\r\n    data_ch0 = 0;\r\n    data_ch1 = 0;\r\n    device_id = 0;\r\n    lux_value = 0.0;\r\n  }\r\n\r\n  const byte get_device_id() { return device_id; }\r\n  const double get_lux_value() { return lux_value; }\r\n  bool init() {\r\n    device_id = i2c_read8(reg_id | 0x80);\r\n    if ((device_id &amp; 0xf0) != 0x50)  \/\/ TSL2561FN\u304c\u8f09\u3063\u3066\u3044\u308b\u3002\r\n      return false;\r\n    return true;    \r\n  }\r\n\r\n  void start(bool use_interrupt = true, bool high_gain = false) {\r\n    gain16 = high_gain;\r\n    i2c_write_reg(reg_timing | 0x80, gain16 ? 0x12 : 0x2);  \/\/ timing . GAIN=x1, integrate time = 402msec. (scale = 1).\r\n    i2c_write_reg(reg_int | 0x80, use_interrupt ? 0x10 : 0);  \/\/ level interrupt. on every conversion completion. OR disable.\r\n    i2c_write_reg(reg_control | 0x80, 3);  \/\/ power on.\r\n    lux_value = 0;\r\n  }\r\n\r\n  void stop() {\r\n    i2c_write_reg(reg_control | 0x80, 0);\r\n  }\r\n\r\n  double get_data() {\r\n    data_ch0 =  i2c_read16_swab(reg_data0 | 0x80);\r\n    data_ch1 =  i2c_read16_swab(reg_data1 | 0x80);\r\n    calc_lux();\r\n    return lux_value;\r\n  }\r\n\r\n\/\/ \u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u66f8\u3044\u3066\u3042\u308blux\u5024\u306e\u7b97\u51fa\u65b9\u6cd5\u3092\u30b3\u30fc\u30c9\u5316\u3002\r\n\/\/ INTEG = 402msec\r\n\/\/ \u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3088\u3063\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306e\u5b9a\u6570\u304c\u5909\u308f\u308b\u3053\u3068\u306b\u6ce8\u610f\u3002FN\u30d1\u30c3\u30b1\u30fc\u30b8\u7528\u3092\u8a18\u8ff0\u3057\u305f\u3002\r\n\/\/ \r\n  void calc_lux() {\r\n    if (!data_ch0 || !data_ch1) {\r\n      lux_value = 0.0;\r\n      return;\r\n    }\r\n    double ch0 = (double)data_ch0 * (gain16 ? 1.0 : 16.0);\r\n    double ch1 = (double)data_ch1 * (gain16 ? 1.0 : 16.0);\r\n    double ratio = ch1 \/ ch0;\r\n    if (ratio &lt;= 0.125)\r\n      lux_value = 0.0304 - 0.0272 * ratio;\r\n    else if (ratio &gt; 0.125 and ratio &lt;= 0.250)\r\n      lux_value = 0.0325 - 0.0440 * ratio;          \r\n    else if (ratio &gt; 0.250 and ratio &lt;= 0.375)\r\n      lux_value = 0.0351 - 0.0544 * ratio;          \r\n    else if (ratio &gt; 0.375 and ratio &lt;= 0.5)\r\n      lux_value = 0.0381 - 0.0624 * ratio;          \r\n    else if (ratio &gt; 0.50 &amp;&amp; ratio &lt;= 0.61)\r\n      lux_value = 0.0224 - 0.031 * ratio;\r\n    else if (ratio &gt; 0.61 &amp;&amp; ratio &lt;= 0.80)\r\n      lux_value = 0.0128 - 0.0153 * ratio;\r\n    else if (ratio &gt; 0.80 &amp;&amp; ratio &lt;= 1.30)\r\n      lux_value = 0.00146 - 0.00112 * ratio;\r\n    else\r\n      lux_value = 0.0;\r\n    lux_value *= ch0;      \r\n  }\r\n\r\n  byte clear_interrupt() {\r\n    Wire.beginTransmission(i2c_address);\r\n    Wire.write(cmd_clear_int);\r\n    i2c_status =  Wire.endTransmission();\r\n    return i2c_status;\r\n  }\r\n\r\n  byte i2c_write_reg(byte reg, byte data) {\r\n    Wire.beginTransmission(i2c_address);\r\n    Wire.write(reg);\r\n    Wire.write(data);\r\n    i2c_status =  Wire.endTransmission();\r\n    return i2c_status;\r\n  }\r\n\r\n\/\/ read 16bit data from addr\/pointer. 1st LSB, 2ns MSB.\r\n  uint16_t i2c_read16_swab(byte pointer) {\r\n    Wire.beginTransmission(i2c_address);\r\n    Wire.write(pointer);\r\n    i2c_status = Wire.endTransmission();\r\n    Wire.requestFrom(i2c_address,  (byte)2);\r\n    uint16_t lsb = (uint16_t)Wire.read();\r\n    uint16_t msb = (uint16_t)(Wire.read() &lt;&lt; 8);\r\n    return msb | lsb;\r\n  }\r\n\r\n\/\/ read 8bit data from pointer.\r\n  uint8_t i2c_read8(byte pointer) {\r\n    Wire.beginTransmission(i2c_address);\r\n    Wire.write(pointer);\r\n    i2c_status = Wire.endTransmission();\r\n    Wire.requestFrom(i2c_address,  (byte)1);\r\n    return (uint8_t)Wire.read();\r\n  }\r\n};\r\n<\/pre>\n<p>\u304a\u3082\u306a\u30e1\u30bd\u30c3\u30c9\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n<h6>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf tsl2561(byte addr = 0x39)<\/h6>\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210\u6642\u306bI2C\u306e\u30b9\u30ec\u30fc\u30d6\u5074\u30a2\u30c9\u30ec\u30b9\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3002\u7701\u7565\u6642\u306f0x39\u3068\u306a\u308b\u3002\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067Wire\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u521d\u671f\u5316\u3092\u884c\u3063\u3066\u3044\u308b\u3002<\/p>\n<h6>bool init()<\/h6>\n<p>TSL2561\u306e\u30c7\u30d0\u30a4\u30b9ID\u3092\u554f\u5408\u305b\u3001\u610f\u56f3\u3057\u305f\u30c7\u30d0\u30a4\u30b9\u304c\u8f09\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u3002\u30d1\u30c3\u30b1\u30fc\u30b8\u3084\u30ea\u30d3\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u5f97\u3089\u308c\u308b\u5024\u304c\u5909\u308f\u308b\u3002\u4eca\u56de\u306f\u3001FN\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5bfe\u8c61\u3068\u3057\u305f\u3002<\/p>\n<h6>void start(bool use_interrupt = true, bool high_gain = false)<\/h6>\n<p>\u52d5\u4f5c\u306e\u8a2d\u5b9a\u3068\u3001\u5909\u63db\u306e\u958b\u59cb\u3092\u6307\u793a\u3059\u308b\u3002<br \/>\n\u5909\u63db\u6642\u9593\u306f402msec\u3068\u3057\u305f\u3002use_interrupt\u304ctrue\u306e\u5834\u5408\u3001\u5909\u63db\u304c\u7d42\u4e86\u3059\u308b\u3054\u3068\u306bINT\u7aef\u5b50\u304cL\u30ec\u30d9\u30eb\u3068\u306a\u308b (\u660e\u793a\u7684\u306b\u30af\u30ea\u30a2\u3059\u308b\u307e\u3067L\u30ec\u30d9\u30eb\u3092\u7dad\u6301\u3059\u308b)\u3002\u307e\u305f\u3001high_gain\u304ctrue\u306e\u5834\u5408\u3001\u7167\u5ea6\u3092\u691c\u51fa\u3059\u308b\u30b2\u30a4\u30f3\u304c16\u500d\u3068\u306a\u308b\u3002\u4f7f\u3063\u305f\u611f\u3058\u3001\u5f37\u3044\u5149\u3092\u6271\u3046\u306a\u3089\u3070\u30b2\u30a4\u30f3\u306fx1\u306e\u65b9\u304c\u3088\u3044\u3088\u3046\u3060\u3002<\/p>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30ec\u30b8\u30b9\u30bf (<em>reg_control<\/em>) \u306b\u5bfe\u3057\u3066 3\u3092\u4e0e\u3048\u308b\u3068\u5909\u63db\u52d5\u4f5c\u304c\u958b\u59cb\u3059\u308b\u3002\u30c7\u30d0\u30a4\u30b9\u306f\u3001\u5909\u63db\u304c\u7d42\u4e86\u3059\u308b\u30682\u3064\u5909\u63db\u7d50\u679c(\u5e83\u5e2f\u57df\u5074\u3068\u8d64\u5916\u5149\u5074)\u3092\u30c7\u30fc\u30bf\u30ec\u30b8\u30b9\u30bf (reg_data0\u304a\u3088\u3073reg_data1) \u306b\u683c\u7d0d\u3057\u3001\u6b21\u306e\u5909\u63db\u52d5\u4f5c\u3092\u958b\u59cb\u3059\u308b\u3002\u3053\u306e\u305f\u3081\u3001\u5909\u63db\u52d5\u4f5c\u4e2d\u3067\u3042\u3063\u3066\u3082\u76f4\u524d\u306e\u5909\u63db\u7d50\u679c\u3092\u30c7\u30fc\u30bf\u30ec\u30b8\u30b9\u30bf\u304b\u3089\u8aad\u307f\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<h6>void calc_lux()<\/h6>\n<p>\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8\u306b\u66f8\u3044\u3066\u3042\u308b\u5185\u5bb9\u306b\u3057\u305f\u304c\u3063\u3066\u30012\u3064\u306e\u30c7\u30fc\u30bf\u30ec\u30b8\u30b9\u30bf\u304b\u3089\u5f97\u305f\u5185\u5bb9\u304b\u3089\u7167\u5ea6 (\u30eb\u30af\u30b9\u5024) \u3092\u5f97\u308b\u3002\u9060\u616e\u306a\u304f\u6d6e\u52d5\u5c0f\u6570\u70b9\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<h6>byte clear_interrupt()<\/h6>\n<p>start()\u6642\u306b\u5272\u8fbc\u307f\u3042\u308a\u306b\u3057\u3001\u5b9f\u969b\u306b\u30de\u30a4\u30b3\u30f3\u5074\u3067\u5272\u8fbc\u307f\u3092\u4f7f\u3046\u5834\u5408\u3001\u5272\u8fbc\u307f\u30cf\u30f3\u30c9\u30e9\u5185\u3067\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3001INT\u7aef\u5b50\u3092\u975eL\uff08\u30cf\u30a4\u30a4\u30f3\u30d4\u30fc\u30c0\u30f3\u30b9)\u306b\u623b\u3059\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>\u3053\u306e\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u5074\u306f\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u3063\u305f\u5f8c\u3001init()\u3067\u30c7\u30d0\u30a4\u30b9\u3092\u78ba\u8a8d\u3057\u3001start() \u3067\u5909\u63db\u3092\u958b\u59cb\u3059\u308b\u3002\u305d\u306e\u5f8c\u306f\u3001<\/p>\n<ul>\n<li>402msec\u4ee5\u4e0a\u306e\u30a4\u30f3\u30bf\u30fc\u30d0\u30eb\u3067\u5024\u3092\u8aad\u307f\u51fa\u3059\u3002<\/li>\n<li>\u5272\u8fbc\u307f\u304c\u767a\u751f\u3059\u308b\u3054\u3068\u306b\u5024\u3092\u8aad\u307f\u51fa\u3059\u3002<\/li>\n<\/ul>\n<p>\u306e\u3044\u305a\u308c\u304b\u3092\u884c\u3046\u3053\u3068\u3092\u610f\u56f3\u3057\u3066\u66f8\u3044\u305f\u3002<\/p>\n<h3>\u30e1\u30a4\u30f3\u306e\u30b9\u30b1\u30c3\u30c1 (esp_tsl2561_Server1.ino)<\/h3>\n<p>100\u884c\u307b\u3069\u306a\u306e\u3067\u3001\u3053\u3061\u3089\u3082\u8f09\u305b\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<pre class=\"lang:c++ decode:true\" title=\"esp_tsl2561_server1.ino\">#include &lt;ESP8266WiFi.h&gt;\r\n#include &lt;ESP8266WebServer.h&gt;\r\n#include &lt;FS.h&gt;\r\n#include \"Ticker.h\"\r\n#include \"i2c_tsl2561.h\"\r\n\r\n#define START_MSG \"\\n\" + String(__FILE__) + \" start.\"\r\n#define RED_LED 15\r\n\r\nconst char* ssid = \"ssid\";\r\nconst char* password = \"password\";\r\nESP8266WebServer server(80);\r\n\r\nvoid die(int msec, const char* cp) {\r\n  if (cp)\r\n    Serial.println(cp);\r\n  for(;;) {\r\n    digitalWrite(RED_LED, 1);\r\n    delay(msec);\r\n    digitalWrite(RED_LED, 0);\r\n    delay(msec);\r\n  }\r\n}\r\n\r\nString getContentType(String filename){\r\n  if (filename.endsWith(\".html\")) \r\n    return \"text\/html\";\r\n  return \"text\/plain\";\r\n}\r\n\r\nbool handleFileRead(String path) {\r\n  Serial.println(\"handleFileRead: \" + path);\r\n  if(path.endsWith(\"\/\")) path += \"index.html\";\r\n  String contentType = getContentType(path);\r\n  if (SPIFFS.exists(path)){\r\n    File file = SPIFFS.open(path, \"r\");\r\n    size_t sent = server.streamFile(file, contentType);\r\n    file.close();\r\n    return true;\r\n  }\r\n  return false;\r\n}\r\n\r\ntsl2561 tsl;\r\nfloat current_lx = 0.0;\r\nbyte led_state = 0;\r\n\r\nvoid ICACHE_RAM_ATTR tsl_func() {\r\n  tsl.clear_interrupt();\r\n  led_state ^= 1;\r\n  digitalWrite(RED_LED, led_state);\r\n  current_lx = (float)tsl.get_data();\r\n}\r\n\r\nTicker ticker;\r\nvoid ticker_func() {\r\n  led_state ^= 1;\r\n  digitalWrite(RED_LED, led_state);\r\n\r\n  current_lx = (float)tsl.get_data();\r\n}\r\n\r\nvoid handleGetData() {\r\n  int v = current_lx * 10.0;\r\n  String data = String(v);\r\n  server.send(200, \"text\/plain\", data);\r\n}\r\n\r\nvoid setup(void){\r\n  delay(20);\r\n  Serial.begin(115200);\r\n  Serial.println(START_MSG);\r\n\r\n  bool f = tsl.init();\r\n  Serial.print(\"TSL2561 device id = \");    \r\n  Serial.println(tsl.get_device_id(), HEX);\r\n  if (!f)  \r\n    die(200, \"tsl init() failed\");\r\n\r\n  SPIFFS.begin();\r\n  \r\n  pinMode(RED_LED, OUTPUT);\r\n  digitalWrite(RED_LED, 0);\r\n  WiFi.softAP(ssid, password);\r\n  WiFi.mode(WIFI_AP);\r\n  IPAddress ip = WiFi.softAPIP();\r\n  Serial.println(\"\");\r\n  Serial.println(ssid + String(\" starts...(\") + ip.toString() + \")\"); \r\n  server.on(\"\/getlux\", handleGetData);\r\n  server.onNotFound([](){\r\n    if(!handleFileRead(server.uri()))\r\n      server.send(404, \"text\/plain\", \"FileNotFound\");\r\n  });\r\n\r\n  WiFi.printDiag(Serial);\r\n  server.begin();\r\n  Serial.println(\"HTTP server started\");\r\n  delay(50);\r\n\r\n#if 0  \r\n  attachInterrupt(13, tsl_func, ONLOW);\r\n  tsl.start(true);\r\n#else\r\n  ticker.attach_ms(500, ticker_func );\r\n  tsl.start(false);\r\n#endif\r\n}\r\n\r\nvoid loop(void){\r\n  server.handleClient();\r\n}\r\n<\/pre>\n<p>ESP8266WebServer\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u305f\u5178\u578b\u7684\u306aWEB\u30b5\u30fc\u30d0\u30fc\u306e\u30b3\u30fc\u30c9\u306b\u3001tsl2561\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\u3057\u3001\u521d\u671f\u5316\u3084\u5909\u63db\u52d5\u4f5c\u3001\u691c\u51fa\u3057\u305f\u30eb\u30af\u30b9\u5024\u3092\u5f97\u308b\u305f\u3081\u306euri\u306e\u8ffd\u52a0\u306a\u3069\u3092\u884c\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>setup()\u306e\u6700\u5f8c\u306e\u65b9\u3067\u3001<em>#if 0\uff5e#else\uff5e#endif<\/em>\u306e\u30d6\u30ed\u30c3\u30af\u304c\u3042\u308b\u304c\u3001tsl2561\u306e\u5909\u63db\u5b8c\u4e86\u5272\u8fbc\u307f\u3092\u4f7f\u3046\u5834\u5408\u3068\u3001Ticker\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3088\u308b\u30dd\u30fc\u30ea\u30f3\u30b0\u3067\u30c7\u30fc\u30bf\u3092\u5f97\u308b\u5834\u5408\u306e\u4e21\u65b9\u3092\u8a66\u3057\u3066\u307f\u305f\u3002\u304a\u306e\u304a\u306e\u306b\u5bfe\u5fdc\u3059\u308b\u30cf\u30f3\u30c9\u30e9\u304c\u3001<em>tsl_func()\u3000<\/em>\u3068 <em>ticker_func()\u00a0<\/em>\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u3044\u305a\u308c\u306e\u30cf\u30f3\u30c9\u30e9\u3082tsl2561\u304b\u3089\u5f97\u3089\u308c\u308b\u6700\u65b0\u5024\u3092\u5909\u6570current_lx\u306b\u4ee3\u5165\u3057\u3066\u3044\u308b\u3002\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30c7\u30fc\u30bf\u8981\u6c42 \/getlux \u30ea\u30af\u30a8\u30b9\u30c8\u304c\u304f\u308b\u3068\u3001current_lx \u306e\u5185\u5bb9\u3092\u30ec\u30b9\u30dd\u30f3\u30b9BODY\u3068\u3057\u3066\u5fdc\u7b54\u3059\u308b\u3002<\/p>\n<h3>index.html<\/h3>\n<p>WROOM-02\u306eSPIFFS\u5185\u306b\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u6570\u5024\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306ehtml\u30d5\u30a1\u30a4\u30eb\u3092\uff11\u3064\u3060\u3051\u5165\u308c\u305f\u3002<\/p>\n<pre class=\"lang:js decode:true\" title=\"index.html\">&lt;HTML&gt;\r\n&lt;head&gt;\r\n&lt;meta chartset=\"utf-8\"\/&gt;\r\n&lt;script&gt;\r\n\r\nwindow.onload = function(){  start_polling(); }\r\n\r\nvar cur_max = 0.0;\r\nfunction clear_options() {\r\n\tupdate_options(0.0);\r\n\treturn false;\r\n}\r\n\r\nfunction update_options(value) {\r\n\tif (value == 0.0 || value &gt; cur_max){\r\n\t\tcur_max = value;\r\n\t\tdisp_value('text_max', value);\r\n\t}\r\n}\r\n\r\nfunction start_polling() {\r\n\tsetTimeout( function(){ http_request('\/getlux'); }, 500);\r\n}\r\n\r\nfunction http_request(uri) {\r\n\tvar request = new XMLHttpRequest();\r\n\trequest.onload = function(){\r\n\t\tif (request.readyState == 4) {\r\n\t\t\tif (request.status != 200) {\r\n\t\t\t\talert('http_request() error http status = ' + request.status);\r\n\t\t\t} else {\r\n\t\t\t\tvalue = 0.0;\r\n\t\t\t\tv = request.responseText\r\n\t\t\t\tif (v != null)\r\n\t\t\t\t\tvalue = parseFloat(v) \/ 10.0;\r\n\t\t\t\tdisp_value('text', value);\r\n\t\t\t\tupdate_options(value);\r\n\t\t\t\tstart_polling();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\trequest.onerror = function() {\r\n\t\talert('http_request failed. ' + request.statusText); \r\n\t};\r\n\trequest.open('GET', uri, true);\r\n\trequest.timeout = 5000;\r\n\trequest.send(null);\r\n}\r\n\r\nfunction disp_value(id, value) {\r\n\tvar text = document.getElementById(id);\r\n\ttext.innerHTML = value;\r\n\treturn;\r\n}\r\n\r\n&lt;\/script&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;TSL2561 LUX value&lt;\/h1&gt;\r\n&lt;div style='text-align: right; padding: 0 2em 0 0; font-size:60px;'&gt;\r\n&lt;span id='text' style='font-size: 192px;'&gt;0.0&lt;\/span&gt;&lt;br\/&gt;\r\n&lt;div&gt;max: &lt;span id='text_max'&gt;0.0&lt;\/span&gt;\r\n&lt;button onclick=\"return clear_options();\" style=\"font-size: 24px;\"&gt;clear&lt;\/button&gt;\r\n&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>javaScript\u306e<em>setTimeout()<\/em>\u3092\u4f7f\u3063\u3066\u3001500msec\u3054\u3068\u306b \/getlux \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308a\u3001\u5f97\u3089\u308c\u305f\u5185\u5bb9\u3092&lt;span id=&#8217;text&#8217;&gt; \u5185\u306b\u8868\u793a\u3059\u308b\u3060\u3051\u3002http\u30ea\u30af\u30a8\u30b9\u30c8\u306f <em>XMLHttpRequest()<\/em> \u3092\u975e\u540c\u671f\u3067\u4f7f\u3063\u3066\u6295\u3052\u3066\u3044\u308b\u304c\u3001\u540c\u671f\u30e2\u30fc\u30c9\u3067\u306fESP8266\u3092\u30ea\u30bb\u30c3\u30c8\u3057\u305f\u3068\u304d\u306a\u3069\u3001WiFi\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u304c\u6d88\u6ec5\u3057\u3066\u3057\u307e\u3046\u304b\u3089\u5177\u5408\u304c\u60aa\u3044\u3002<\/p>\n<h2>\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n<figure id=\"attachment_5442\" aria-describedby=\"caption-attachment-5442\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/b0024a96e307ae629e6651f08710f1d4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5442\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2016\/12\/b0024a96e307ae629e6651f08710f1d4-552x414.jpg\" alt=\"WROOM-02 + GY-2561\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-5442\" class=\"wp-caption-text\">WROOM-02 + GY-2561<\/figcaption><\/figure>\n<p>\u30d6\u30e9\u30a6\u30b6\u306b\u30eb\u30af\u30b9\u5024\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3002\u30b9\u30de\u30db\u3092WROOM02\u306esoftAP\u306b\u63a5\u7d9a\u3057\u3001IP\u30a2\u30c9\u30ec\u30b9 192.168.4.1 \u306b\u5bfe\u3057\u3066&#8221;\/&#8221;\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u3068\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306a\u753b\u9762\u306b\u306a\u308b\u3002\u9759\u6b62\u753b\u3067\u306f\u3064\u307e\u3089\u306a\u3044\u306e\u3067\u52d5\u753b\u3092Youtube\u306b\u304a\u3044\u305f\u3002<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/CJdxXsgay44\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u6700\u521d\u306f\u3075\u3060\u3093\u306e\u660e\u308b\u3055\u3067\u3001\u304a\u3088\u305d170\u30eb\u30af\u30b9\u524d\u5f8c\u3002<a href=\"http:\/\/www.akaricenter.com\/mame\/pdf\/jis-shoudo.pdf\">JIS\u306e\u7167\u5ea6\u57fa\u6e96<\/a>\u304b\u3089\u3059\u308b\u3068\u3001\u4f5c\u696d\u306b\u306f\u6697\u3081\u3060\u304c\u5c45\u9593\u3068\u3057\u3066\u306f\u307e\u305a\u307e\u305a\u3001\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3092\u898b\u308b\u306a\u3089\u3053\u308c\u304f\u3089\u3044\u3001\u3068\u3044\u3063\u305f\u660e\u308b\u3055\u3060\u308d\u3046\u3002<br \/>\n\u6b21\u306b\u3001\u5c0f\u7269\u306e\u64ae\u5f71\u6642\u306b\u4ed8\u3051\u308bLED\u306e\u30c6\u30fc\u30d6\u30eb\u30e9\u30a4\u30c8\u3092\u30aa\u30f3\u306b\u3059\u308b\u3068900\u30eb\u30af\u30b9\u524d\u5f8c\u3068\u306a\u3063\u305f\u3002\u624b\u82b8\u3084\u88c1\u7e2b\u3068\u3044\u3063\u305f\u7d30\u304b\u3044\u4f5c\u696d\u6642\u306b\u306f\u3001\u3053\u308c\u304f\u3089\u3044\u306e\u660e\u308b\u3055\u304c\u5fc5\u8981\u3089\u3057\u3044\u3002<br \/>\n\u6700\u5f8c\u306b\u3001\u30ab\u30e1\u30e9\u306eLED\u7167\u660e\u306e\u5b9f\u9a13\u7528\u306b\u7528\u610f\u3057\u305f\u9ad8\u8f1d\u5ea6\u767d\u8272LED(15\u00b0\u3001\u4e26\u52174\u672c\u3001\u540425mA\u7a0b\u5ea6)\u3092\u30bb\u30f3\u30b5\u30fc\u306b\u8fd1\u3065\u3051\u3066\u3044\u308b\u3002\u6700\u9ad8\u306722,000\u30eb\u30af\u30b9\u3092\u8d85\u3048\u3066\u3044\u308b\u304c\u3001\u3060\u3044\u305f\u3044\u8584\u66c7\u308a\u306e\u663c\u9593\u304f\u3089\u3044\u306e\u611f\u3058\u304b\u3002<\/p>\n<h2>\u304d\u3087\u3046\u306e\u307e\u3068\u3081<\/h2>\n<p>GY-2561\u306f150\u5186\u3082\u3057\u306a\u3044\u306e\u306b\u7acb\u6d3e\u306b\u306f\u305f\u3089\u3044\u3066\u304f\u308b\u3002\u5927\u3057\u305f\u3082\u306e\u3067\u3042\u308b\u3002\u305f\u3060\u3001LDO\u3092\u8f09\u305b\u305f\u306e\u306a\u3089\u3001\u305b\u3081\u3066I2C\u306e2\u672c\u306e\u30b7\u30ea\u30a2\u30eb\u7dda\u306b\u30ec\u30d9\u30eb\u30b3\u30f3\u30d0\u30fc\u30bf\u3092\u5165\u308c\u3066\u6b32\u3057\u304b\u3063\u305f\u3002<\/p>\n<p>\u30bb\u30f3\u30b5\u30fc\u95a2\u4fc2\u306e\u5de5\u4f5c\u3092\u3057\u3066\u3044\u3066\u3044\u3064\u3082\u601d\u3046\u306e\u306f\u3001\u679c\u305f\u3057\u3066\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u6570\u5024\u306f\u672c\u5f53\u306b\u6b63\u3057\u3044\u306e\u3060\u308d\u3046\u304b\u3001\u3068\u3044\u3046\u70b9\u3002\u6e29\u5ea6\u3084\u6e7f\u5ea6\u306f\u3001\u4f8b\u3048\u3070\u6642\u8a08\u306b\u3082\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u3057\u3001\u6c17\u5727\u306f\u30a2\u30e1\u30c0\u30b9\u3092\u898b\u308c\u3070\u5206\u304b\u308b\u3002\u305d\u308c\u306b\u5bfe\u3057\u3066\u7167\u5ea6\u306e\u57fa\u6e96\u3068\u306a\u308b\u3082\u306e\u304c\u306a\u3044\u3002<\/p>\n<p>\u4eca\u56de\u306e\u5de5\u4f5c\u306f\u3001\u30de\u30af\u30ed\u30ec\u30f3\u30ba\u7528\u306eLED\u7167\u660e\u3092\u4f5c\u308b\u306b\u3042\u305f\u3063\u3066\u3001LED\u306e\u914d\u7f6e\u69cb\u6210\u3084\u99c6\u52d5\u56de\u8def\u3092\u6bd4\u8f03\u691c\u8a0e\u3059\u308b\u969b\u306e\u3001\u500b\u4eba\u7684\u306a\uff1f \u3046\u3061\u3046\u3061\u306e\uff1f \u57fa\u6e96\u3068\u3057\u3066\u4f5c\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\u3082\u306e\u306a\u306e\u3067\u3001\u5225\u306bJIS\u898f\u683c\u306b\u5247\u3063\u305f\u3082\u306e\u3068\u6bd4\u3079\u308b\u5fc5\u8981\u306f\u306a\u3044\u306e\u3060\u304c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 \u30c7\u30b8\u30bf\u30eb\u5149\u30bb\u30f3\u30b5\u30fc\u306eTSL2561\u3092\u8f09\u305b\u305f\u3001GY-2561\u3068\u3044\u3046\u30d6\u30ec\u30a4\u30af\u30a2\u30a6\u30c8\u30dc\u30fc\u30c9\u3068ESP-WROOM-02\u3092\u4f7f\u3063\u3066\u3001\u7167\u5ea6\u8a08\u3092\u4f5c\u3063\u3066\u307f\u308b\u3002WROOM-02\u3067web\u30b5\u30fc\u30d0\u30fc\u3092\u52d5\u304b\u3057\u3001PC\u3084\u30b9\u30de\u30db\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb &hellip; <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=5390\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">GY-2561\u3068ESP-WROOM-02\u3092\u4f7f\u3063\u3066\u7167\u5ea6\u3092\u6e2c\u308b<\/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":[69],"tags":[65,70],"class_list":["post-5390","post","type-post","status-publish","format-standard","hentry","category-programming","tag-arduino","tag-esp8266"],"_links":{"self":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5390"}],"version-history":[{"count":0,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5390\/revisions"}],"wp:attachment":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}