laupilot
laupilot
Сообщить

Lighthouse

Инструкция
IMG_4786.JPEG
IMG_4786
.JPEG
Сценарий применения
Laser processing
Машина и модуль
xTool S1
40W
Используемый материал
3 mm playwood
154
1781

Информация

      3 mm playwood +Arduino Nano +LDR

https://www.ameede.com/lighthouse-e0021503-file-cdr-and-eps-svg-free-vector-download-for-laser-cut/
    

Инструкция

1

Шаг1

const int groupPins[] = {3, 5, 6, 9};
const int ldrPin = A7;    // Capteur LDR modifié pour utiliser A7
const int threshold = 100;  // < threshold = obscurité


 

const int maxBrightness = 255;
const int fadeStep = 1;
const int fadeDelay = 8;


 

void setup() {
  for (int i = 0; i < 4; i++) {
    pinMode(groupPins[i], OUTPUT);
    analogWrite(groupPins[i], 0);
  }
  pinMode(ldrPin, INPUT);
}


 

void loop() {
  int ldrValue = analogRead(ldrPin);


 

  if (ldrValue < threshold) {
    // Lumière faible → animation phare
    static int current = 0;
    int next = (current + 1) % 4;
    for (int b = 0; b <= maxBrightness; b += fadeStep) {
      analogWrite(groupPins[current], maxBrightness - b);
      analogWrite(groupPins[next], b);
      for (int i = 0; i < 4; i++) {
        if (i != current && i != next) analogWrite(groupPins[i], 0);
      }
      delay(fadeDelay);
    }
    current = next;
  } else {
    // Trop lumineux → tout éteint
    for (int i = 0; i < 4; i++) {
      analogWrite(groupPins[i], 0);
    }
    delay(100);
  }
}
Комментарии

Ремиксы

Принадлежности xTool, использованные в этом проекте

Связанные коллекции

Связанные теги

Лицензия