arduino:m5stickc:06.neopixel

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
arduino:m5stickc:06.neopixel [2020/08/15 14:41] – 作成 babaarduino:m5stickc:06.neopixel [2020/09/07 09:29] (現在) baba
行 5: 行 5:
 <div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/545fd801393640789297412ed4379d52" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div> <div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/545fd801393640789297412ed4379d52" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
 </html> </html>
 +
 +====== 個別に光らせてみる ======
 +なんかExampleのコード難しくなかったですか?
 +動きはしたんですが,コードが良くないんで,このページでは個別に制御するための方法を紹介します.一緒にやってみましょう.
 +
 +<html>
 +<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/9c1bab7a75344636b409dde51f775623" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
 +</html>
 +
 +<code>
 +/*
 +    Please install FastLED library first.
 +    In arduino library manage search FastLED
 +*/
 +#include <M5StickC.h>
 +#include "FastLED.h"
 +
 +#define Neopixel_PIN    32
 +#define NUM_LEDS    15
 +
 +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.setRotation(3);
 +  M5.Lcd.setTextColor(YELLOW); 
 +  //M5.Lcd.setTextSize(2);
 +  M5.Lcd.setCursor(10, 2);
 +  M5.Lcd.println("Neopixel Example");
 +  M5.Lcd.setTextColor(WHITE);
 +  M5.Lcd.setCursor(0, 15);
 +  M5.Lcd.println("Display rainbow effect");
 +
 +  // Neopixel initialization
 +  FastLED.addLeds<WS2811,Neopixel_PIN,GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
 +  FastLED.setBrightness(10);
 +  
 +}
 +
 +void loop()
 +{
 +  leds[0] = CRGB::Red;
 +  FastLED.show();
 +  delay(1000);
 +  leds[0] = CRGB::Black;
 +  FastLED.show();
 +  delay(1000);
 +}
 +</code>
 +
 +ちなみにRGBの色を数値で指定したい場合は,
 +  leds[0] = CRGB(255,0,0); // 赤色指定
 +とすればOKです.
 +
 +====== Reference ======
 +FastLED Library: http://fastled.io
 +
 +----
 +
 +{{indexmenu>:arduino:m5stickc#1|js#indextheme navbar}}
  
  • /home/users/2/lolipop.jp-4404d470cd64c603/web/ws/data/attic/arduino/m5stickc/06.neopixel.1597470089.txt.gz
  • 最終更新: 2020/08/15 14:41
  • by baba