• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Zapalone diody przy starcie
#1
Witam,
borykam się z problemem jakim jest po podaniu zasilania do podświetlania schodów.
Po zmierzchu dochodzi dopiero prąd do całego układu i wtedy na stale zapalają się wszystkie światła,
do momentu gdy nie wejdę na czujnik i uruchomi się sekwencja i od tego momętu wszystko działa normalnie.
Próbowałem już komendy clear do TLC ale nie pomaga.
Zwracam się do was o pomoc co zrobić aby się nie uruchamiały samoczynnie.
Pozdrawiam
Oto kod jaki mam:
Kod:
#include <Tlc5940.h>
const int downButtonPin = 6;     // włącznik dolny
const int upButtonPin = 7;     // włącznik górny
int downButtonState = 0;         // status
int upButtonState = 0;         //status
int ledCount = 16; //liczba aktywnych wyjść (światełek)
int brightness = 4095; //maksymalna jasność
int brightStep = 28; //krok przy rozjaśnianiu
int brightStep1 = 7; //krok przy ściemnianiu
int delayTime = 2; //szybkosc
int outs[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; //wyjścia do których podpinane są taśmy

void setup()
{
 Tlc.init();
 for (int diode=0; diode<ledCount; diode++)
 pinMode(downButtonPin, INPUT);
 digitalWrite(downButtonPin, LOW);  
 pinMode(upButtonPin, INPUT);    
 digitalWrite(upButtonPin, LOW);  

for (int diode = 0; diode<ledCount;diode++) {
    Tlc.set(outs[diode], brightness-outs[diode]);

}
Tlc.update();
}

void loop()

{
downButtonState = digitalRead(downButtonPin);

 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:

if (downButtonState == LOW) {    
   downButton();
 //  upButton();
 }

 upButtonState = digitalRead(upButtonPin);
 if (upButtonState == LOW) {    
   upButton();
 }
}

void downButton() {

for (int diode = 0; diode<ledCount;diode++) {
 
  int bright = brightness;
  do {
     if (bright<0) {
       bright = 0;
     }
     Tlc.set(outs[diode], bright);
     Tlc.update();

     delay(delayTime);
     bright = bright - brightStep;
  } while (bright>=0);
 }
 
 for (int diode = 0; diode<ledCount;diode++) {
   int bright = 0;
   while (bright<brightness) {
     bright = bright + brightStep1;
     if (bright>brightness) {
       bright = brightness;
     }

     Tlc.set(outs[diode], bright);
     Tlc.update();
     delay(delayTime);
   } ;
 }

}

void upButton() {

for (int diode = ledCount-1; diode>=0;diode--) {
 
  int bright = brightness;
  do {
     if (bright<0) {
       bright = 0;
     }
     Tlc.set(outs[diode], bright);
     Tlc.update();

     delay(delayTime);
     bright = bright - brightStep;
  } while (bright>=0);
 }
 
 for (int diode = ledCount-1; diode>=0;diode--) {
   int bright = 0;
   while (bright<brightness) {
     bright = bright + brightStep1;
     if (bright>brightness) {
       bright = brightness;
     }
     
    Tlc.set(outs[diode], bright);
    Tlc.update();
    delay(delayTime);    
  }
 }
}
 
Odpowiedź
  


Wiadomości w tym wątku
Zapalone diody przy starcie - przez Minek3 - 08-03-2019, 20:36
RE: Zapalone diody przy starcie - przez kaczakat - 08-03-2019, 23:00
RE: Zapalone diody przy starcie - przez Minek3 - 10-03-2019, 10:38
RE: Zapalone diody przy starcie - przez es2 - 10-03-2019, 12:46
RE: Zapalone diody przy starcie - przez koralm - 03-03-2021, 23:30
RE: Zapalone diody przy starcie - przez Minek3 - 10-03-2019, 13:02
RE: Zapalone diody przy starcie - przez kaczakat - 10-03-2019, 14:28
RE: Zapalone diody przy starcie - przez es2 - 10-03-2019, 14:48
RE: Zapalone diody przy starcie - przez Minek3 - 10-03-2019, 16:53
RE: Zapalone diody przy starcie - przez es2 - 10-03-2019, 17:09
RE: Zapalone diody przy starcie - przez kaczakat - 10-03-2019, 19:16
RE: Zapalone diody przy starcie - przez Minek3 - 11-03-2019, 22:17
RE: Zapalone diody przy starcie - przez kaczakat - 13-03-2019, 18:40
RE: Zapalone diody przy starcie - przez koralm - 04-03-2021, 19:13

Skocz do:


Przeglądający: 1 gości