Skip to content

Instantly share code, notes, and snippets.

@HDR
Last active January 29, 2020 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HDR/83074da81d21b60b6a17c5cac229884e to your computer and use it in GitHub Desktop.
Save HDR/83074da81d21b60b6a17c5cac229884e to your computer and use it in GitHub Desktop.
The M5StickC Datasheet, hosted on the M5StickC itself (Requires https://github.com/tzapu/WiFiManager/tree/development)
#include <M5StickC.h>
#include <WiFi.h>
#include <DNSServer.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <WiFiManager.h>
#include <ESPmDNS.h>
#include <WiFiClient.h>
WebServer webServer(80);
void handleIndex(){
String html ="<html lang=\"en\"><head> <meta charset=\"utf-8\"> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no\"> <meta name=\"description\" content=\"M5Stack Documentations - Modular Rapid Product Development Toolkit, based on ESP32. ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth.\"> <meta name=\"google-site-verification\" content=\"sYDlVf68aDW21U32H46j1P4YDSimljEGHBEMi4JRxQ8\"> <title>M5Stack - A series of modular stackable development devices</title> <link rel=\"icon\" href=\"https://docs.m5stack.com/assets/img/favicon.ico\"> <!-- Stylesheets --> <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/docsify-themeable@0.7.2/dist/css/theme-simple.css\" title=\"Simple\"> <link rel=\"stylesheet\" href=\"https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css\"> <link rel=\"stylesheet\" href=\"https://docs.m5stack.com/assets/css/main.css\"> <script> var _LoadingHtml = '<div id=\"loading\"><div class=\"loading-flex\"><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div></div></div>'; document.write(_LoadingHtml); document.onreadystatechange = completeLoading; function completeLoading() { if (document.readyState == \"complete\") { var loadingMask = document.getElementById('loading');&nbsp;&nbsp; loadingMask.style.display = 'none'; } } window.addEventListener('hashchange', function(event) { var loadingMask = document.getElementById('loading'); let url = window.location.href.split('#')[1]; if (url.length < 2 || url == '/zh_CN/' || url == '/en/') { }else if(url.indexOf(\"?id=\") < 0 ){ loadingMask.style.display = 'block'; } }) </script><style type=\"text/css\">.docsify-copy-code-button,.docsify-copy-code-button span{cursor:pointer;transition:all .25s ease}.docsify-copy-code-button{position:absolute;z-index:1;top:0;right:0;overflow:visible;padding:.65em .8em;border:0;border-radius:0;outline:0;font-size:1em;background:grey;background:var(--theme-color,grey);color:#fff;opacity:0}.docsify-copy-code-button span{border-radius:3px;background:inherit;pointer-events:none}.docsify-copy-code-button .error,.docsify-copy-code-button .success{position:absolute;z-index:-100;top:50%;left:0;padding:.5em .65em;font-size:.825em;opacity:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.docsify-copy-code-button.error .error,.docsify-copy-code-button.success .success{opacity:1;-webkit-transform:translate(-115%,-50%);transform:translate(-115%,-50%)}.docsify-copy-code-button:focus,pre:hover .docsify-copy-code-button{opacity:1}</style><style type=\"text/css\">.medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}</style></head><body data-page=\"en/core/m5stickc.md\" class=\"ready sticky\"><div id=\"loading\" style=\"display: none;\"><div class=\"loading-flex\"><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div><div class=\"demo3\"></div></div></div> <script src=\"https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js\"></script> <script src=\"https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js\"></script> <script src=\"https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js\"></script> <div class=\"btn-toggle\"></div> <div class=\"search\"> <form action=\"\" method=\"get\" accept-charset=\"utf-8\"> <input type=\"text\" placeholder=\"Search\" oninput=\"onEnter(event)\"> <a id=\"search_button\" class=\"search-btn\" style=\"width: 20px;height: 20px;color: #007bff\" onclick=\"mode_search()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" role=\"img\" viewBox=\"0 0 24 24\" focusable=\"false\"><title>Search</title><circle cx=\"10.5\" cy=\"10.5\" r=\"7.5\"></circle><path d=\"M21 21l-5.2-5.2\"></path></svg></a> </form> </div> <div class=\"d-flex a flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom shadow-sm\"> <h5 class=\"my-0 mr-md-auto font-weight-normal\"> <a href=\"https://m5stack.com/\"><img src=\"//cdn.shopify.com/s/files/1/0056/7689/2250/files/LOGO_70x.jpg?v=1563273356\" style=\"margin-right:30px;margin-top:-5px\" width=\"52\"></a><span style=\"position: relative; top: 5px;\">M5Stack Docs</span></h5> <nav class=\"my-2 my-md-0 mr-md-3 app-nav no-badge\"> <a id=\"product\" class=\"p-2 dropdown\" href=\"#\">Product</a> <div id=\"platform\" class=\"p-2 dropdown\"><span>Platform</span> <div> <a id=\"uiflow\" class=\"dropdown-item\" href=\"#/en/uiflow/uiflow_home_page\">UIFlow</a> <a id=\"arduino\" class=\"dropdown-item\" href=\"#/en/arduino/arduino_home_page\">Arduino</a> <a class=\"dropdown-item\" href=\"https://github.com/m5stack/UIFlow-Code\">MicroPython</a> </div> </div> <a id=\"cases\" class=\"p-2 dropdown\" href=\"#/en/case\">Cases</a> <a id=\"faq\" class=\"p-2 dropdown\" href=\"#/en/faq\">FAQ</a> <div id=\"language\" class=\"p-2 dropdown\" style=\"margin-right: 40px;\"> <span>Language</span> <div style=\"left: -45px;\"> <a class=\"dropdown-item\" onclick=\"language('en')\">English</a> <a class=\"dropdown-item\" onclick=\"language('zh_CN')\">中文</a> </div> </div> </nav> </div> <div class=\"related_links\"> <a href=\"https://twitter.com/M5Stack\" target=\"view_window\"><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/twitter.jpg\"></a> <a href=\"https://www.facebook.com/M5Stack\" target=\"view_window\"><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/facebook.jpg\"></a> <a href=\"https://www.youtube.com/m5stack\" target=\"view_window\"><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/youtube.jpg\"></a> <a href=\"https://github.com/m5stack\" target=\"view_window\"><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/github.jpg\"></a> <div href=\"https://github.com/m5stack\" target=\"view_window\" onclick=\"(function(){$('html, body').animate({scrollTop: 0}, 500);})()\"><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/to-top.jpg\"></div> </div> <main><section class=\"content\"><article class=\"markdown-section\" id=\"main\"><h1 id=\"m5stickc\"><a href=\"#/en/core/m5stickc?id=m5stickc\" data-id=\"m5stickc\" class=\"anchor\"><span>M5StickC </span></a></h1><img src=\"https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_01.webp\" width=\"30%\" class=\"medium-zoom-image\"> <hr> <p><img class=\"emoji\" src=\"https://github.githubassets.com/images/icons/emoji/memo.png\" alt=\"memo\"><strong><a href=\"#/en/core/m5stickc?id=description\">Description</a></strong>&nbsp;&nbsp;&nbsp;<img class=\"emoji\" src=\"https://github.githubassets.com/images/icons/emoji/bulb.png\" alt=\"bulb\"><strong><a href=\"#/en/quick_start/m5stickc/m5stickc_quick_start\">Quick Start</a></strong>&nbsp;&nbsp;&nbsp;<img class=\"emoji\" src=\"https://github.githubassets.com/images/icons/emoji/octocat.png\" alt=\"octocat\"><strong><a href=\"#/en/core/m5stickc?id=example\">Example</a></strong>&nbsp;&nbsp;&nbsp;🛒<strong><a href=\"https://m5stack.com/collections/m5-core/products/stick-c\" target=\"_blank\">Purchase</a></strong>&nbsp;&nbsp;&nbsp;<img class=\"emoji\" src=\"https://github.githubassets.com/images/icons/emoji/clapper.png\" alt=\"clapper\"><strong><a href=\"#/en/core/m5stickc?id=related-video\">Related Video</a></strong>&nbsp;&nbsp;&nbsp;<img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo-min.jpg\" class=\"medium-zoom-image\"><strong><a href=\"#/en/core/m5stickc?id=easyloader\">EasyLoader</a></strong></p><h2 id=\"description\"><a href=\"#/en/core/m5stickc?id=description\" data-id=\"description\" class=\"anchor\"><span>Description</span></a></h2><p><strong>M5StickC</strong> is a mini M5Stack, powered by ESP32. It is a portable, easy-to-use, open source, IoT development board.</p><p><em>What it can do?</em> This tiny block is able to realize your idea, enlighten your creativity, and help with your IoT prototying in a very short time. It will takes away a lot of the pains form the development process.</p><p>M5stickC is one of the core devices in M5Stack product series which is built in a continues growing hardware &amp; software ecosystem. It has a lot of compatible modules &amp; units, as well as the open source code &amp; engineering community that will help you maximum your benefit in every step of the developing process.</p><p><strong>Power switch operation:</strong></p><ul><li><p>Power on :Long press power button for 2 seconds</p></li><li><p>Power off :Short press power button for 6 seconds</p></li></ul><p><strong>Notice:</strong></p><ul><li><p>Baudrate supported by M5StickC: 1200 ~115200, 250K, 500K, 750K, 1500K</p></li><li><p>Only Orange type is available for now</p></li></ul><img src=\"https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_02.png\" width=\"50%\" height=\"50%\" class=\"medium-zoom-image\"> <p><strong>Notice:</strong></p><p>M5StickC only supports WIN10 &amp; Linux &amp; MAC free drive, the rest of the operating system requires users to install the driver.</p><p>Installation steps: 1. Click the link below to download the driver installation package. 2. Connect the device and open the Computer Device Manager port option. 3. Right click on the unrecognized device and perform a manual update.</p><p><a href=\"https://www.ftdichip.com/Drivers/VCP.htm\">Driver download Link</a></p><h2 id=\"product-features\"><a href=\"#/en/core/m5stickc?id=product-features\" data-id=\"product-features\" class=\"anchor\"><span>Product Features</span></a></h2><ul><li>5V DC power supply</li><li>USB Type-C</li><li>ESP32-based</li><li>Case Material: PC + ABS</li><li>4 MByte Flash</li><li>6-Axis IMU: MPU6886</li><li>Red LED</li><li>IR transmitter</li><li>Microphone</li><li>2 Buttons, LCD(0.96 inch), 1 Reset</li><li>2.4G Antenna: Proant 440</li><li>80 mAh Lipo Battery</li><li>Extendable Socket</li><li>Grove Port</li><li>Wearable &amp; Wall mounted</li><li>Development Platform <a href=\"http://flow.m5stack.com\" target=\"_blank\">UIFlow</a>, <a href=\"http://micropython.org/\" target=\"_blank\">MicroPython</a>, <a href=\"http://www.arduino.cc\" target=\"_blank\">Arduino</a></li><li>Product Size:48.2mm x 25.5mm x 13.7mm</li><li>Product weight:15.1g</li></ul><img src=\"https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_03.jpg\" width=\"50%\" height=\"50%\" class=\"medium-zoom-image\"> <h2 id=\"esp32-features\"><a href=\"#/en/core/m5stickc?id=esp32-features\" data-id=\"esp32-features\" class=\"anchor\"><span>ESP32 Features</span></a></h2><ul><li>240 MHz dual core Tensilica LX6 microcontroller with 600 DMIPS</li><li>Integrated 520 KB SRAM</li><li>Integrated 802.11b/g/n HT40 Wi-Fi transceiver, baseband, stack and LWIP</li><li>Integrated dual mode Bluetooth (classic and BLE)</li><li>Hall sensor</li><li>32 kHz crystal oscillator</li><li>PWM/timer input/output available on every GPIO pin</li><li>SD-card interface support</li></ul><h2 id=\"easyloader\"><a href=\"#/en/core/m5stickc?id=easyloader\" data-id=\"easyloader\" class=\"anchor\"><span>EasyLoader</span></a></h2><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo.png\" width=\"100px\" style=\"margin-top:20px\" class=\"medium-zoom-image\"> <p><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/M5Core/M5StickC/EasyLoader_M5StickC_FactoryTest.exe\"><button type=\"button\" class=\"btn btn-primary\">click to download EasyLoader</button></a></p><blockquote> <p>1.EasyLoader is a simple and fast program burner. Every product page in EasyLoader provides a product-related case program. It can be burned to the master through simple steps, and a series of function verification can be performed.(<strong>Currently EasyLoader is only available for Windows OS</strong>)</p></blockquote> <blockquote> <ol start=\"2\"><li>After downloading the software, double-click to run the application, connect the M5 device to the computer through the data cable, select the port parameters, click <strong>\"Burn\"</strong> to start burning. (<strong>For M5StickC burning, please Set the baud rate to 750000 or 115200</strong>)</li></ol></blockquote> <h2 id=\"schematic\"><a href=\"#/en/core/m5stickc?id=schematic\" data-id=\"schematic\" class=\"anchor\"><span>Schematic</span></a></h2><img src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/M5StickC/m5stickC.jpg\" class=\"medium-zoom-image\"> <ul><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/M5StickC/20191118__StickC_A04_3110_Schematic_Rebuild_PinMap.pdf\" target=\"_blank\">PDF Download</a></li></ul><h2 id=\"pinmap\"><a href=\"#/en/core/m5stickc?id=pinmap\" data-id=\"pinmap\" class=\"anchor\"><span>PinMap</span></a></h2><img src=\"https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_04.png\" width=\"300px\" class=\"medium-zoom-image\"> <p>Power structure block diagram</p><img src=\"https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_05.webp\" width=\"300px\" class=\"medium-zoom-image\"> <p><strong>RED LED &amp; IR Transmitter &amp; BUTTON A &amp; BUTTON B</strong></p><table> <tbody><tr><td>ESP32 </td><td>GPIO10</td><td>GPIO9</td><td>GPIO37</td><td>GPIO39</td></tr> <tr><td>RED LED</td><td>LED Pin</td><td> </td><td> </td><td> </td></tr> <tr><td>IR Transmitter</td><td> </td><td>Transmitter Pin</td><td> </td><td> </td></tr> <tr><td>BUTTON A</td><td> </td><td> </td><td>Button Pin</td><td> </td></tr> <tr><td>BUTTON B</td><td> </td><td> </td><td> </td><td>Button Pin</td></tr> </tbody></table> <p><strong>TFT LCD</strong></p><p><em>Driver IC:ST7735S</em></p><p><em>Resolution:80 * 160</em></p><table> <tbody><tr><td>ESP32 </td><td>GPIO15</td><td>GPIO13</td><td>GPIO23</td><td>GPIO18</td><td>GPIO5</td></tr> <tr><td>TFT LCD</td><td>TFT_MOSI</td><td>TFT_CLK</td><td>TFT_DC</td><td>TFT_RST</td><td>TFT_CS</td></tr> </tbody></table> <p><strong>GROVE PORT</strong></p><table> <tbody><tr><td>ESP32 </td><td>GPIO33</td><td>GPIO32</td><td>5V</td><td>GND</td></tr> <tr><td>GROVE port</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr> </tbody></table> <p><strong>MIC (SPM1423)</strong></p><table> <tbody><tr><td>ESP32 </td><td>GPIO0</td><td>GPIO34</td></tr> <tr><td>MICPHONE</td><td>SCL</td><td>SDA</td></tr> </tbody></table> <p><strong>6-Axis posture sensor (SH200Q/MPU6886) &amp; power management IC (AXP192)</strong></p><table> <tbody><tr><td>ESP32 </td><td>GPIO22</td><td>GPIO21</td> </tr><tr><td>6-Axis posture sensor</td><td>SCL</td><td>SDA</td> </tr><tr><td>power management IC</td><td>SCL</td><td>SDA</td> </tr></tbody></table> <p><strong>AXP192</strong></p><table> <tbody><tr style=\"font-weight:bold;text-align:center\"><td>Microphone</td><td>RTC</td><td>TFT backlight</td><td>TFT IC</td><td>ESP32/3.3V MPU6886/SH200Q</td><td>5V GROVE</td> </tr><tr style=\"font-weight:bold;text-align:center\"><td>LDOio0</td><td>LDO1</td><td>LDO2</td><td>LDO3</td><td>DC-DC1</td><td>IPSOUT</td> </tr></tbody></table> <h2 id=\"include\"><a href=\"#/en/core/m5stickc?id=include\" data-id=\"include\" class=\"anchor\"><span>Include</span></a></h2><ul><li>1x M5StickC</li><li>1x USB Type-C(20cm)</li></ul><h2 id=\"related-link\"><a href=\"#/en/core/m5stickc?id=related-link\" data-id=\"related-link\" class=\"anchor\"><span>Related Link</span></a></h2><ul><li><p><strong>datasheet</strong></p><ul><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/esp32-pico-d4_datasheet_en.pdf\" target=\"_blank\">ESP32-PICO</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/ST7735S_v1.1_en.pdf\" target=\"_blank\">ST7735S</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/BM8563_V1.1_cn.pdf\" target=\"_blank\">BM8563</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/MPU-6886-000193%2Bv1.1_GHIC_en.pdf\" target=\"_blank\">MPU6886</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/SH200Q_en.pdf\" target=\"_blank\">SH200Q</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/AXP192_datasheet_en.pdf\" target=\"_blank\">AXP192</a></li><li><a href=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/SPM1423HM4H-B_datasheet_en.pdf\" target=\"_blank\">SPM1423</a></li></ul></li></ul><h2 id=\"version-change\"><a href=\"#/en/core/m5stickc?id=version-change\" data-id=\"version-change\" class=\"anchor\"><span>Version Change</span></a></h2><div class=\"table-wrapper\"> <table class=\"fl-table\"> <thead> <tr> <th>Release Date</th> <th>Product Change</th> </tr> </thead> <tbody> <tr> <td>2019.3</td> <td>Initial public release</td> </tr> <tr> <td>2019.8</td> <td>SH200Q changed to MPU6886</td> </tr> <tr> <td>2019.10</td> <td>Upgrade the bottom and add copper nuts</td> </tr> </tbody><tbody> </tbody></table> </div> <h2 id=\"example\"><a href=\"#/en/core/m5stickc?id=example\" data-id=\"example\" class=\"anchor\"><span>Example</span></a></h2><ul><li><p><strong>Arduino</strong></p><ul><li><p><a href=\"https://github.com/m5stack/M5StickC/tree/master/examples/Basics/FactoryTest\" target=\"_blank\">M5StickC facory test code</a></p></li><li><p><a href=\"https://github.com/m5stack/M5-ProductExampleCodes/tree/master/App/M5StickC_Slot\" target=\"_blank\">M5StickC Vending Machine</a></p><video width=\"500\" height=\"315\" controls=\"\"> <source src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201904/M5StickC%20Slot%20machine%20demo.mp4\" type=\"video/mp4\"> </video> </li></ul></li></ul><h2 id=\"related-video\"><a href=\"#/en/core/m5stickc?id=related-video\" data-id=\"related-video\" class=\"anchor\"><span>Related Video</span></a></h2><ul><li><strong>M5StickC Case - counter</strong></li></ul><video class=\"video_size\" controls=\"\"> <source src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201903/StickC%20Watch.mp4\" type=\"video/mp4\"> </video> <ul><li><strong>M5StickC Case - Safe system</strong></li></ul><video class=\"video_size\" controls=\"\"> <source src=\"https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201904/Simple_Watch_Device.mp4\" type=\"video/mp4\"> </video></article></section></main> <script> window.$docsify = { // GENERAL // ----------------------------------------------------------------- name: 'M5Stack docs', // repo: 'https://github.com/m5stack/m5-docs', homepage: 'index.md', // loadNavbar: 'navbar.md', // loadSidebar: 'sidebar.md', autoHeader: true, mergeNavbar: true, // for mobile device nameLink: { '/en/': '#/en/', '/zh_CN/': '#/zh_CN/', '/ja/': '#/ja/', '/': '/' }, // NAVIGATION // ----------------------------------------------------------------- alias: { //重定向 '/en/sidebar.md': '/sidebar.md', '/en/.*/sidebar.md': '/sidebar.md', '/zh_CN/.*/sidebar.md': '/zh_CN/sidebar.md', '/ja/.*/sidebar.md': '/ja/sidebar.md', '/.*/navbar.md': '/navbar.md', '/en/': '/', }, auto2top: true, mergeNavbar: true, maxLevel: 4, subMaxLevel: 3, basePath: '/', formatUpdated: '{MM}/{DD} {HH}:{mm}', executeScript: true, ga: 'UA-131246469-2' }; </script> <!-- <script> if (typeof navigator.serviceWorker !== 'undefined') { navigator.serviceWorker.register('sw.js') } </script> --> <script> window.onload = function() { // setInterval(function(){ // $('.nav-link[data-bind=\"event\"]').on('mouseenter', Enter); // $('.dropdown-menu div[data-bind=\"leave1\"]').on('mouseleave', Leave); // }, 600); }; function product_search(onEnter_content){ $(\"#search_note\").css(\"display\",\"block\"); var p = $(\".item p\"); for (var i=0; i<p.length; i++ ) { if(p[i].textContent.toLocaleLowerCase().indexOf(onEnter_content) != -1){ $(\".item\").eq(i).css(\"display\",\"inline-block\"); $(\".item\").eq(i).parent().children(\"p\").css(\"display\",\"block\"); $(\".item\").eq(i).parent().next(\"hr\").css(\"display\",\"block\"); $(\"#search_note\").css(\"display\",\"none\"); } else{ $(\".item\").eq(i).css(\"display\",\"none\"); $(\".item\").parent().children(\"p\").css(\"display\",\"none\"); $(\".item\").eq(i).parent().next(\"hr\").css(\"display\",\"none\"); } } } function faq_search(onEnter_content){ $(\".search-tips\").css(\"display\",\"block\"); $(\".faq-class\").css(\"display\",\"none\"); var faq_title = $(\".faq-item h5\"); for (var i=0; i<faq_title.length; i++ ) { if(faq_title[i].textContent.toLocaleLowerCase().indexOf(onEnter_content) != -1){ $(\".faq-item\").eq(i).css(\"display\",\"block\"); $(\".search-tips\").css(\"display\",\"none\"); $(\".faq-item\").eq(i).prev(\".faq-class\").css(\"display\",\"block\"); } else{ $(\".faq-item\").eq(i).css(\"display\",\"none\"); } } } function onEnter(event){ timer = setTimeout(function () { var onEnter_content = event.target.value.toLowerCase(); select_search_page(onEnter_content); clearTimeout(timer); timer = null; }, 250); } function select_search_page(onEnter_content){ link = window.location.href; if(((link.slice(-4) == \"/en/\")||(link.slice(-7)== \"/zh_CN/\"))||((link.indexOf(/en/) == -1) && (link.indexOf(/zh_CN/) == -1))){ product_search(onEnter_content); } if(link.slice(-4) == \"/faq\"){ faq_search(onEnter_content); } } // function keyup_submit(e){ // var evt = window.event || e; // if (evt.keyCode == 13){ // mode_search(); // } // } var Input = $('form input'); Input.focusin(function (){ Input.animate({width:300}); }); Input.focusout(function (){ Input.animate({width:240}); // onEnter_content = event.target.value.toLowerCase(); }) function select(event){ var s = event.textContent.toLowerCase(); $(\"#thetarget\").removeClass(\"show\"); $(\".btn-group-vertical button\").addClass(\"btn-light\"); $(event).removeClass(\"btn-light\"); $(event).addClass(\"btn-primary\"); page_move(s); } $(document).ready(function() { $(\".btn-toggle\").on('click', function() { $(\".btn-toggle\").toggleClass('open'); $(\".d-flex\").toggleClass('open'); }); }); function change_title(language) { if (language == \"en\") { $(\"#product\").text(\"Product\"); $(\"#product\").attr(\"href\", \"#\"); $(\"#arduino\").text(\"Arduino\"); $(\"#arduino\").attr(\"href\", \"#/en/arduino/arduino_home_page\"); $(\"#cases\").text(\"Cases\"); $(\"#cases\").attr(\"href\", \"#/en/case\"); $(\"#faq\").text(\"FAQ\"); $(\"#faq\").attr(\"href\", \"#/en/faq\"); $(\"#uiflow\").attr(\"href\", \"#/en/uiflow/uiflow_home_page\"); $(\"#platform span\").text(\"Platform\"); $(\"#language span\").text(\"Language\"); } if(language == \"zh_CN\"){ $(\"#product\").text(\"产品列表\"); $(\"#product\").attr(\"href\", \"#/zh_CN/\"); $(\"#arduino\").text(\"Arduino\"); $(\"#arduino\").attr(\"href\", \"#/zh_CN/arduino/arduino_home_page\"); $(\"#cases\").text(\"案例\"); $(\"#cases\").attr(\"href\", \"#/zh_CN/case\"); $(\"#faq\").text(\"常见问题\"); $(\"#faq\").attr(\"href\", \"#/zh_CN/faq\"); $(\"#uiflow\").attr(\"href\", \"#/zh_CN/uiflow/uiflow_home_page\"); $(\"#platform span\").text(\"开发平台\"); $(\"#language span\").text(\"切换语言\"); } if(language == \"ja\"){ $(\"#product\").text(\"製品リスト\"); $(\"#product\").attr(\"href\", \"#/ja/\"); $(\"#arduino\").text(\"Arduino\"); $(\"#arduino\").attr(\"href\", \"#/ja/arduino/arduino_home_page\"); $(\"#cases\").text(\"事例\"); $(\"#cases\").attr(\"href\", \"#/ja/case\"); $(\"#faq\").text(\"問題\"); $(\"#faq\").attr(\"href\", \"#/ja/faq\"); $(\"#uiflow\").attr(\"href\", \"#/ja/uiflow/uiflow_home_page\"); $(\"#platform span\").text(\"開発\"); $(\"#language span\").text(\"言語選択\"); } } function language(language) { var test = window.location.href; if ((test.indexOf(/en/) == -1) && (test.indexOf(/zh_CN/) == -1) && (test.indexOf(/ja/) == -1)) { var test2 = test.concat(\"\", language+\"/\"); window.location.href = test2; change_title(language); } if (test.indexOf(/en/) != -1) { var test2 = test.replace(/en/, language); window.location.href = test2; change_title(language); }else if(test.indexOf(/zh_CN/) != -1){ var test2 = test.replace(/zh_CN/, language); window.location.href = test2; change_title(language); }else if(test.indexOf(/ja/) != -1){ var test2 = test.replace(/ja/, language); window.location.href = test2; change_title(language); } } function page_loading() { var test = window.location.href; if ((test.indexOf(/en/) == -1) && (test.indexOf(/zh_CN/) == -1)&& (test.indexOf(/ja/) == -1)) { change_title('en'); } if(test.indexOf(/en/) != -1){ change_title('en'); } if(test.indexOf(/zh_CN/) != -1){ change_title('zh_CN'); } if(test.indexOf(/ja/) != -1){ change_title('ja'); } } function page_move(divId) { var t = $(\"#\" + divId).offset().top; $('html, body').animate({ scrollTop: (t - 100) }, 500); } window.onhashchange = page_loading page_loading(); </script> <script> </script> <script src=\"https://cdn.jsdelivr.net/npm/docsify-copy-code@2.1.0/dist/docsify-copy-code.min.js\"></script> <script src=\"https://cdn.jsdelivr.net/npm/docsify@4.10.2/lib/plugins/external-script.min.js\"></script> <script src=\"https://cdn.jsdelivr.net/npm/docsify@4.10.2/lib/plugins/zoom-image.min.js\"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async=\"\" src=\"https://www.googletagmanager.com/gtag/js?id=UA-138139529-2\"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-138139529-2'); </script> <!-- Hotjar Tracking Code for https://docs.m5stack.com/#/ --> <!-- <script> (function(h,o,t,j,a,r){ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; h._hjSettings={hjid:1546100,hjsv:6}; a=o.getElementsByTagName('head')[0]; r=o.createElement('script');r.async=1; r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv; a.appendChild(r); })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv='); </script> --> <div class=\"progress\" style=\"opacity: 0; width: 0%;\"></div></body></html>";
webServer.send(200, "text/html", html);
}
void handleNotFound() {
webServer.send(404, "text/plain", "Not found.");
}
void setup() {
M5.begin();
M5.Lcd.fillScreen(BLACK);
M5.Axp.ScreenBreath(9);
pinMode(M5_BUTTON_HOME, INPUT);
pinMode(M5_BUTTON_RST, INPUT);
WiFiManager wifiManager;
M5.Lcd.setTextSize(1);
M5.Lcd.setCursor(8,0);
M5.Lcd.println("M5StickC \nDatasheet");
M5.Lcd.println("\nIf you want to setup WiFi, \nPower off, \nPress Button RST \nand Power On!!!");
if(digitalRead(M5_BUTTON_RST) == LOW){
M5.Lcd.fillScreen(BLACK); //clear
M5.Lcd.setTextSize(1);
M5.Lcd.setCursor(5,0);
M5.Lcd.println("AP mode: \nOnDemandAP");
M5.Lcd.println("\nconnect to WiFi, \nM5StickC-AP");
M5.Lcd.println("\nOpen \n192.168.4.1");
digitalWrite(M5_LED, LOW); //LED ON
while(digitalRead(M5_BUTTON_RST) == LOW);
digitalWrite(M5_LED, HIGH);
for (int i=0; i <= 3; i++){
delay(200);
digitalWrite(M5_LED, LOW);
delay(200);
digitalWrite(M5_LED, HIGH);
}
if (!wifiManager.startConfigPortal("M5StickC-AP")) {
delay(3000);
}
ESP.restart();
delay(2000);
} else {
WiFi.begin();
M5.Lcd.setCursor(5,120);
int i = 0;
while (WiFi.status() != WL_CONNECTED) {
if(i > 20){break;}
delay(500);
i++;
M5.Lcd.print(".");
}
M5.Lcd.println("! ");
}
IPAddress ipadr = WiFi.localIP();
if(WiFi.status() == WL_CONNECTED){
M5.Lcd.println("connected..");
} else {
M5.Lcd.println("not connected!!!");
}
delay(1000);
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(0,0);
M5.Lcd.println("M5StickC \nDatasheet");
M5.Lcd.setCursor(0,60);
M5.Lcd.println("IP address: ");
M5.Lcd.print((String)ipadr[0] + "." + (String)ipadr[1] + "." + (String)ipadr[2] + "." + (String)ipadr[3]);
webServer.on("/", handleIndex);
webServer.on("/favicon.ico", handleNotFound); //faviconなし
webServer.onNotFound(handleNotFound);
webServer.begin();
}
void loop() {
webServer.handleClient();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment