Bonjour,
je voulais simplement faire clignoter deux LED néopixel avec la librairie Adafruit en changeant de couleur toute les 2 secondes pour test, mais cela ne fonctionne déjà pas (Arduino Mega 2560).
Le code
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 8
Adafruit_NeoPixel strip = Adafruit_NeoPixel(2, PIN, NEO_GRB + NEO_KHZ400);
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
strip.begin();
strip.show(); // Initialize all pixels to 'off'
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
strip.setPixelColor(0, 0, 10, 0);
strip.setPixelColor(1, 20, 0, 0);
Serial.print("milli = ");
Serial.println(millis());
delay(2000);
strip.setPixelColor(0, 10, 0, 0);
strip.setPixelColor(1, 0, 0, 20);
Serial.print("milli = ");
Serial.println(millis());
delay(2000);
strip.show();
}
J'ai mis des compteurs millis pour voir si la boucle ne bloque pas et c'est OK
Les leds prennent immédiatement la configuration de fin de boucle et ne changent pas d'état.
Je suis dans le flou le plus total, si quelqu'un peut m'aider?
Merci
Jean-Claude