Skip to main content

Projet Final - Minuteur

Polina- Souad - Souamaila 

  • Base : Impression 3D taille petite à moyenne (10- 15 cm)
  • Minuteurs : 10 plexiglass et allumer avec des leds 
  • arduino : pour programmer le temps 
  • LED adressables (type WS2812B)

Base : 

Objectif :
en 10 minutes → 10 segments s’allument progressivement
donc 1 segment = 1 minute

  • Arduino (Uno ou Nano)
  • Bande LED WS2812B (NeoPixel) → hyper simple à contrôler individuellement
  • Librairie : Adafruit_NeoPixel
  • Temps total = 10 min = 600 000 ms
  • Nombre de segments = 10
  • Intervalle = 600 000 / 10 = 60 000 ms (1 min)

Code : 


#include <Adafruit_NeoPixel.h>

#define PIN 6
#define NUM_LEDS 50 // adapte selon ta bande
#define SEGMENTS 10

Adafruit_NeoPixel strip(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

unsigned long previousMillis = 0;
const long interval = 60000; // 1 minute

int currentSegment = 0;
int ledsPerSegment;

void setup() {
strip.begin();
strip.show(); // tout éteint
ledsPerSegment = NUM_LEDS / SEGMENTS;
}

void loop() {
unsigned long currentMillis = millis();

if (currentMillis - previousMillis >= interval && currentSegment < SEGMENTS) {
previousMillis = currentMillis;

// Allumer un segment
for (int i = currentSegment * ledsPerSegment;
i < (currentSegment + 1) * ledsPerSegment; i++) {
strip.setPixelColor(i, strip.Color(0, 0, 255)); // bleu
}

strip.show();
currentSegment++;
}
}