![](/media/cache/profiles/80729472_p0.jpg.50x50_q85.jpg)
qweqwe
Dependencies: Si5351A NeoPixel
main.cpp@0:124662fe9af9, 2020-01-02 (annotated)
- Committer:
- tichise
- Date:
- Thu Jan 02 07:57:58 2020 +0000
- Revision:
- 0:124662fe9af9
- Child:
- 1:34ec04b8a8dd
NeoPixel sample
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tichise | 0:124662fe9af9 | 1 | #include "mbed.h" |
tichise | 0:124662fe9af9 | 2 | #include "neopixel.h" |
tichise | 0:124662fe9af9 | 3 | |
tichise | 0:124662fe9af9 | 4 | |
tichise | 0:124662fe9af9 | 5 | NeoPixelOut neoPixel(p11); |
tichise | 0:124662fe9af9 | 6 | |
tichise | 0:124662fe9af9 | 7 | int main() { |
tichise | 0:124662fe9af9 | 8 | wait(0.2); // wait for HSE to stabilize |
tichise | 0:124662fe9af9 | 9 | |
tichise | 0:124662fe9af9 | 10 | neoPixel.global_scale = 1.0f; // Adjust brightness |
tichise | 0:124662fe9af9 | 11 | neoPixel.normalize = true; // Equalize brightness to make r + g + b = 255 |
tichise | 0:124662fe9af9 | 12 | |
tichise | 0:124662fe9af9 | 13 | Pixel pixels[6]; |
tichise | 0:124662fe9af9 | 14 | pixels[0].hex = 0xFF0000; |
tichise | 0:124662fe9af9 | 15 | pixels[1].hex = 0xFFFF00; |
tichise | 0:124662fe9af9 | 16 | pixels[2].hex = 0x00FF00; |
tichise | 0:124662fe9af9 | 17 | pixels[3].hex = 0x00FFFF; |
tichise | 0:124662fe9af9 | 18 | pixels[4].hex = 0x0000FF; |
tichise | 0:124662fe9af9 | 19 | pixels[5].hex = 0xFF00FF; |
tichise | 0:124662fe9af9 | 20 | |
tichise | 0:124662fe9af9 | 21 | neoPixel.send(pixels, 6); |
tichise | 0:124662fe9af9 | 22 | |
tichise | 0:124662fe9af9 | 23 | while(1); |
tichise | 0:124662fe9af9 | 24 | } |