Étape 3: Le programme
#include
#define broche 4
Bande de Adafruit_NeoPixel = Adafruit_NeoPixel (16, broche, NEO_GRB + NEO_KHZ800) ;
void setup() {strip.begin() ; strip.show(); / / initialise tous les pixels sur « arrêt »}
void loop() {rainbow(20);}
Sub arc-en-ciel (attente uint8_t) {uint16_t i, j ;
pour (j = 0; j < 256; j ++) {pour (i = 0; i
Roue d’uint32_t (WheelPos octets) {if(WheelPos < 85) {bande de retour. Couleur (WheelPos * 3, 255 - WheelPos * 3, 0) ; } else if(WheelPos < 170) {WheelPos-= 85 ; bande de retour. Couleur (255 - WheelPos * 3, 0, WheelPos * 3) ; } else {WheelPos-= 170 ; bande de retour. Couleur (0, WheelPos * 3, 255 - WheelPos * 3) ; } }