Répondre à : Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led

Accueil/Questions/Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led/Répondre à : Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led
Répondre à : Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led 2016-01-18T19:14:49+00:00

Accueil Forums Questions Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led Répondre à : Arduino + VS1053B MP3 + 25 LED Pixels WS2801 = problème de led

erwan
Participant
Nombre d'articles : 2

Bonjour,

Voici mon code….

#include <SPI.h>
//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
//and the MP3 Shield Library
#include <SFEMP3Shield.h>
#include "Adafruit_WS2801.h"
#include "SPI.h" // Comment out this line if using Trinket or Gemma

SdFat sd;
SFEMP3Shield MP3player;

const byte dim_curve[] = {
  0,   1,   1,   2,   2,   2,   2,   2,   2,   3,   3,   3,   3,   3,   3,   3,
  3,   3,   3,   3,   3,   3,   3,   4,   4,   4,   4,   4,   4,   4,   4,   4,
  4,   4,   4,   5,   5,   5,   5,   5,   5,   5,   5,   5,   5,   6,   6,   6,
  6,   6,   6,   6,   6,   7,   7,   7,   7,   7,   7,   7,   8,   8,   8,   8,
  8,   8,   9,   9,   9,   9,   9,   9,   10,  10,  10,  10,  10,  11,  11,  11,
  11,  11,  12,  12,  12,  12,  12,  13,  13,  13,  13,  14,  14,  14,  14,  15,
  15,  15,  16,  16,  16,  16,  17,  17,  17,  18,  18,  18,  19,  19,  19,  20,
  20,  20,  21,  21,  22,  22,  22,  23,  23,  24,  24,  25,  25,  25,  26,  26,
  27,  27,  28,  28,  29,  29,  30,  30,  31,  32,  32,  33,  33,  34,  35,  35,
  36,  36,  37,  38,  38,  39,  40,  40,  41,  42,  43,  43,  44,  45,  46,  47,
  48,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,
  63,  64,  65,  66,  68,  69,  70,  71,  73,  74,  75,  76,  78,  79,  81,  82,
  83,  85,  86,  88,  90,  91,  93,  94,  96,  98,  99,  101, 103, 105, 107, 109,
  110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144,
  146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190,
  193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255,
};

int NUM_LEDS = 25;
int RECV_PIN = 19;
int inputPin = 18;
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status
int choice = 1;
int NUM_FUNCTIONS = 2;
uint8_t dataPin  = 3;    // Yellow wire on Adafruit Pixels
uint8_t clockPin = 4;    // Green wire on Adafruit Pixels
float (*functionPtrs[10])(); //the array of function pointers
int16_t last_ms_char; // milliseconds of last recieved character from Serial port.
int8_t buffer_pos; // next position to recieve character from Serial port.
char buffer[6]; // 0-35K+null
uint32_t  millis_prv;
int hue;

Adafruit_WS2801 strip = Adafruit_WS2801(NUM_LEDS, dataPin, clockPin);

void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
  clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif
  Serial.begin(9600);
  strip.begin(); // Neopixel setup
  strip.show(); // Initialize all pixels to 'off'

  //Initialize the SdCard.
  if (!sd.begin(SD_SEL, SPI_FULL_SPEED)) sd.initErrorHalt();

  //Initialize the MP3 Player Shield
  MP3player.begin();

}
void loop() {
  hue = random(70, 260);
  MP3player.playTrack(1);
  introduction();
}

// scenes
void turnAllPixelsOff() {
  for (int i = 0; i < NUM_LEDS; i++) {
    strip.setPixelColor(i, 0);
  }
  strip.show();
}

void introduction() {
  int rgb_colors[3];
  for (int i = 0; i <= 255; i++) {
    getRGB(80, 255, i, rgb_colors);
    for (int j = 0; j <= 24; j++) {
      strip.setPixelColor(j, Color(rgb_colors[0], rgb_colors[1], rgb_colors[2]));
    }
    strip.show();
    delay(10);
  }
  delay(10000);
}

En croisant les doigts pour touver une solution car je désespère …

Merci d’avance