#include "../include/LedLib.h" // Initialisation // Initialization LedLib::LedLib(int pixelCount, int pixelPin, int bright){ this->ledNb = 0; this->strip = new Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800); this->strip->begin(); this->strip->show(); this->strip->setBrightness(bright); } // Fonction pour allumer correctement les LEDs en fonction du Rotary // Function to manage LEDs colors according to the Rotary void LedLib::actLed(int nb, int start){ this->ledNb = nb; // On éteint tout // We shut everything up this->strip->clear(); // Allumer 0 LED ? Inutile // Useless to light up 0 LED if (nb != 0) { // Boucle dans les LEDs // Loop in LEDs for (int i = start; i <= nb+start-1; i++) { int j = i; if(j > 24){ j -= 25; } // Une LED sur deux est blanche : heure entière, l'autre rouge pour 30m // One LED out of two is white: whole hour, the other red for 30m if (j%2 == 0) { this->strip->setPixelColor(j, 255, 255, 255); }else{ this->strip->setPixelColor(j, 255, 0, 0); } } } // Maintenant on allume // Then light everything up this->strip->show(); } // Fonction qui renvoie le nombre de LEDs allumées // Function that returns the number of LEDs lit int LedLib::getledNB(){ return this->ledNb; } void LedLib::okBlink(){ this->strip->clear(); for(int i = 0; i < 3; i++){ for(int j = 0; j < 24; j++){ this->strip->setPixelColor(j, 0, 255, 0); } this->strip->show(); delay(100); this->strip->clear(); this->strip->show(); delay(100); } }