Tarek Lule / LED_WS2812

Dependencies:   WS2812 PixelArray

Fork of LED_WS2812 by CreaLab

Revision:
3:ba8dc8811164
Parent:
0:999518b1799b
Child:
4:15b992a39c77
--- a/LED_WS2812.cpp	Mon Jul 17 11:30:12 2017 +0000
+++ b/LED_WS2812.cpp	Thu Nov 02 09:56:59 2017 +0000
@@ -44,6 +44,22 @@
 
 
 
+void LED_WS2812::SetColor(LED_COLORS _color, int position) {
+      SetColor((unsigned int) _color, position);
+};
+
+void LED_WS2812::SetColor(unsigned int _color, int position) {
+      if(position < nbLeds && position >=0 ) {
+          pxArray->Set(position, _color);
+          pxArray->SetI(position,intensity);
+      
+      }
+      __writeBuf(0);
+      nbInsert = 0;
+      if(rotationState) StopRotation();
+       rotationPosition = nbLeds;
+};
+
 void LED_WS2812::SetColor(LED_COLORS _color) {
       SetColor((unsigned int) _color);
 };
@@ -67,6 +83,7 @@
 
 void LED_WS2812::__writeBuf(int z) {
      ws->write_offsets(pxArray->getBuf(),z,z,z);
+     wait(0.01);
  }
  
 void LED_WS2812::__insert2buf() {