明石高専ロボ研 mbedライブラリ

Dependencies:   mbed

Revision:
7:4ad54efe2fdd
Parent:
5:a7894e6982ea
Child:
8:82727add54ce
diff -r 678c6b604ac7 -r 4ad54efe2fdd neopixel.h
--- a/neopixel.h	Thu Nov 12 16:44:10 2020 +0000
+++ b/neopixel.h	Sun Dec 06 08:09:01 2020 +0000
@@ -6,7 +6,7 @@
 /*
 // Example
 
-NeoPixelOut npx(D12);
+NeoPixelOut npx(D12,6);//出力ピン LEDの個数
 
 int main() {
     wait(0.2); // wait for HSE to stabilize
@@ -14,15 +14,14 @@
     npx.global_scale = 1.0f; // Adjust brightness
     npx.normalize = true; // Equalize brightness to make r + g + b = 255
     
-    Pixel strip[6];
-    strip[0].hex = 0xFF0000;
-    strip[1].hex = 0xFFFF00;
-    strip[2].hex = 0x00FF00;
-    strip[3].hex = 0x00FFFF;
-    strip[4].hex = 0x0000FF;
-    strip[5].hex = 0xFF00FF;
+    npx.setPixelColor(0,0xff0000);
+    npx.setPixelColor(1,0xffff00);
+    npx.setPixelColor(2,0x00ff00);
+    npx.setPixelColor(3,0x00ffff);
+    npx.setPixelColor(4,0x0000ff);
+    npx.setPixelColor(5,0xff00ff);
     
-    npx.send(strip, 6);
+    npx.show();
     
     while(1);
 }
@@ -53,7 +52,6 @@
 class NeoPixelOut : DigitalOut {
 private:
     void byte(uint32_t b);
-    int board_;
     int num_pixels_;
     vector<Pixel> strip_;