From 4d694b265152f15fbe7c133e52b435a2e4244180 Mon Sep 17 00:00:00 2001 From: LiHuashen <854410664@qq.com> Date: Tue, 8 Jan 2019 19:27:21 +0800 Subject: [PATCH] add doc for NEOPIXEL(japanese version) --- docs/ja/README.md | 13 ++++--- docs/ja/unit/neopixel.md | 78 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/docs/ja/README.md b/docs/ja/README.md index 22be1cd1..0f6035ec 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -68,12 +68,17 @@ -[![unit_rgb.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_rgb_01.png)](ja/unit/rgb)         [![unit_relay.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_relay_01.png)](ja/unit/relay) - - -[![unit_hub.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_hub_01.png)](ja/unit/hub)         [![unit_3.96.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_396port_01.png)](ja/unit/396port)         [![unit_proto.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_proto_01.png)](ja/unit/proto) +[![unit_rgb.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_rgb_01.png)](ja/unit/rgb)         [![unit_relay.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_relay_01.png)](ja/unit/relay)         [![unit_hub.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_hub_01.png)](ja/unit/hub)         [![unit_396port.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_396port_01.png)](ja/unit/396port) + + + +[![unit_gps.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_gps_01.png)](ja/unit/gps)         [![unit_proto.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_proto_01.png)](ja/unit/proto)         [![unit_neopixel.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_neopixel_01.png)](ja/unit/neopixel) + + *** diff --git a/docs/ja/unit/neopixel.md b/docs/ja/unit/neopixel.md index 051a6bab..75f751ff 100644 --- a/docs/ja/unit/neopixel.md +++ b/docs/ja/unit/neopixel.md @@ -10,6 +10,10 @@ **NeoPixel**ユニットは帯状にフルカラーLEDが連なったケーブルです。プログラマブルに色や点灯・点滅などをコントロールする事が可能です。Grove インターフェースで接続します。 +?> NeoPixel Unit入力ポートと出力ポートがあります。 + + + ## 特徴 - 測定可能距離: 10cm/20cm/0.5m/1m/2m @@ -20,22 +24,88 @@ ### 1. Arduino IDE +*特定のルーチンが必要な場合はここをクリックしてください[ルーチン](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/NEOPIXEL/Arduino)。* + +```arduino +/* + Install FastLED library first. +*/ +#include +#include "FastLED.h" + +#define Neopixel_PIN 21 +#define NUM_LEDS 30 + +CRGB leds[NUM_LEDS]; +uint8_t gHue = 0; +static TaskHandle_t FastLEDshowTaskHandle = 0; +static TaskHandle_t userTaskHandle = 0; + +void setup(){ + Serial.begin(115200); + M5.begin(); + M5.Lcd.clear(BLACK); + M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(40, 0); + M5.Lcd.println("Neopixel example"); + M5.Lcd.setTextColor(WHITE); + M5.Lcd.setCursor(0, 25); + M5.Lcd.println("Display rainbow effect"); + + // Neopixel initialization + FastLED.addLeds\ + (leds, NUM_LEDS).setCorrection(TypicalLEDStrip); + FastLED.setBrightness(10); + xTaskCreatePinnedToCore(FastLEDshowTask, \ + "FastLEDshowTask", 2048, NULL, 2, NULL, 1); +} + +void loop(){ +} + +void FastLEDshowESP32(){ + if (userTaskHandle == 0){ + userTaskHandle = xTaskGetCurrentTaskHandle(); + xTaskNotifyGive(FastLEDshowTaskHandle); + const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 ); + ulTaskNotifyTake(pdTRUE, xMaxBlockTime); + userTaskHandle = 0; + } +} + +void FastLEDshowTask(void *pvParameters){ + for(;;){ + fill_rainbow(leds, NUM_LEDS, gHue, 7);// rainbow effect + FastLED.show();// must be executed for neopixel becoming effective + EVERY_N_MILLISECONDS( 20 ) { gHue++; } + } +} +``` + + ### 2. UIFlow -## 回路図 +*特定のルーチンが必要な場合はここをクリックしてください[ルーチン](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/NEOPIXEL/UIFlow)。* - + + + ### ピンマップ - +
M5Core(GROVEインターフェースA)GPIO22GPIO215VGND
NCIR UnitSCLSDA5VGND
NEOPIXEL Unit デジタルピン5VGND
## 関連リンク - **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)** -- **[フォーラム](http://forum.m5stack.com/)** \ No newline at end of file +- **[フォーラム](http://forum.m5stack.com/)** + +- **[FastLED図書館](https://github.com/FastLED/FastLED/wiki/Overview)** + +- **[FastLED参照(中国語)](http://www.taichi-maker.com/homepage/reference-index/arduino-library-index/fastled-library/)** \ No newline at end of file