Maurin Donneaud

Designer d’interaction @ www.eTextile.org - Paris

ZahraZoujaj/Arduino/firmware

  1. #include "Tlc5940.h"
  2. #include "tlc_modif_fades.h"
  3. TLC_CHANNEL_TYPE channel;      //  channel this fade is on
  4. uint32_t startMillis;          //  millis() when to start
  5. uint32_t endMillisUp;          //  millis() when to end
  6. uint32_t endMillisDown;        //  millis() when to end
  7. uint16_t duration;             // fade time
  8. boolean DEBUG_code = false;
  9. void setup(){
  10.   Tlc.init();
  11.   if(DEBUG_lib || DEBUG_code) Serial.begin(9600);          // connect to the serial port
  12. }
  13. void loop(){
  14.   if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2){     // - 3 to avode stack ower flow
  15.     if (!tlc_isFading(channel)){                            // si le fade de la channel est finit
  16.       startMillis = millis() + random(4000, 6000);          // when to start
  17.       duration = random(10000, 20000);                      // set the fade time duration      
  18.       endMillisUp = startMillis + duration;
  19.       endMillisDown = startMillis + duration * 2;
  20.       tlc_addFade(channel, 0, 3500, startMillis, endMillisUp);     // fade in
  21.       tlc_addFade(channel, 3500, 0, endMillisUp, endMillisDown);   // fade out
  22.     }
  23.     channel++;
  24.     if(channel >= 16){
  25.       channel = 0;
  26.     }
  27.   }
  28.   tlc_updateFades();
  29.   if(DEBUG_code) Serial.print(tlc_fadeBufferSize, DEC), Serial.print("\t");
  30.   if(DEBUG_code) Serial.print(TLC_FADE_BUFFER_LENGTH, DEC), Serial.print("\t");
  31.   if(DEBUG_code) Serial.print(channel, DEC), Serial.println();
  32. }

Forum sur abonnement

Pour participer à ce forum, vous devez vous enregistrer au préalable. Merci d'indiquer ci-dessous l'identifiant personnel qui vous a été fourni. Si vous n'êtes pas enregistré, vous devez vous inscrire.

Connexions'inscriremot de passe oublié ?