Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: neopixel.h
- Revision:
- 15:693ce8e6d7f7
- Parent:
- 8:82727add54ce
- Child:
- 16:c3bbd6944a47
--- a/neopixel.h Wed Oct 13 09:12:48 2021 +0000 +++ b/neopixel.h Thu Nov 04 09:20:23 2021 +0000 @@ -12,7 +12,7 @@ wait(0.2); // wait for HSE to stabilize npx.global_scale = 1.0f; // Adjust brightness 明るさを変えるとき以外書かなくていいよ。 - npx.normalize = true; // Equalize brightness to make r + g + b = 255 falseでいい気がする。 + npx.normalize = false; // Equalize brightness to make r + g + b = 255 npx.setPixelColor(0,0xff0000); npx.setPixelColor(1,0xffff00); @@ -51,8 +51,9 @@ class NeoPixelOut : DigitalOut { private: - void byte(uint32_t b); + inline void byte(uint32_t b); int num_pixels_; + Pixel buf_; vector<Pixel> strip_; public: @@ -61,14 +62,15 @@ NeoPixelOut(PinName pin, int num = 0); - void send(Pixel *colors, uint32_t count, bool flipwait=true); + void send(Pixel *colors, uint32_t count, bool flipwait=true);//使用非推奨 void changeNum(uint32_t num); void setBrightness(float brightness);//0~1 - void setPixelColor(uint32_t i,uint32_t color); - void show(); - void off(bool flag = true);//送信するかしないか。デフォルトでする。 + void setPixelColor(uint32_t i,uint8_t b,uint8_t g,uint8_t r); + void setPixelColor(uint32_t i,uint32_t color);//この関数でそれぞれのLEDの明るさを指定し + void show();//この関数を呼び出してLEDに信号を送ってください。 + void off(bool flag = true);//LEDを消す。flagは、送信するかしないか。デフォルトでする。 uint32_t color(uint8_t b,uint8_t g,uint8_t r); - int numPixels(); + int numPixels();//LEDの個数を返す。クラス宣言時に指定した数と同じ。 /** Wait long enough to make the colors show up */ void flip(void);