Arduino_APA102 - setPixelColor()

Saves the color value

Syntax

leds.setPixelColor(indexLed, newColor)

Parameters

  • indexLed: LED index number
  • newColor: the value of the R G and B togetger i.e 0xFFFFFF(white) or 255,255,255 (int)

Example

#include <Arduino_APA102.h> 

Arduino_APA102 leds(5, 5, 4);

void setup() {
  leds.begin();
} 
void loop() {
  leds.setPixelColor(0, 0xFF00FF);
  leds.setPixelColor(1, 255, 0, 255);
  leds.setPixelColor(2, 0, 0, 255);
  leds.show();
} 

See also