Go Down

Topic: Newbie help ws2812b (Read 697 times) previous topic - next topic

alemartk

int ledPin1 = 8;
unsigned long previousMillis1 = 0;
unsigned long previousMillis2 = 0;
unsigned long currentMillis = millis();
long OnTime1 = 10000;
long gTime = 5000;
int ledPin1 = 8;
int ledState1 = HIGH; 
int ledState2 = LOW;
const int garage = 10;
const int BOTON = 7;
int val = 0;
String voice;

void setup()
{ Serial.begin(9600);
  pinMode(ledPin1, OUTPUT);

  pinMode(garage,OUTPUT);
  pinMode(BOTON,INPUT);
 digitalWrite(garage, HIGH);
 digitalWrite(ledPin1, HIGH);

 
}
void loop()
{ while (Serial.available())
  {
  delay(10);
  char c = Serial.read();
   voice += c;
  }
  val = digitalRead(BOTON);
 
if (val == HIGH)
{
unsigned long currentMillis = millis();
 previousMillis2 = currentMillis;
 digitalWrite(garage, LOW);
 Serial.write ("pressed");
 delay(gTime);
 digitalWrite(garage, HIGH);
}
 if (voice.length() > 0)
  {
    Serial.println(voice);
 //Revisa si es momento de apagar el LED
  unsigned long currentMillis = millis();
 
 
   if((voice == "hallway") && (ledState1 == HIGH - currentMillis - previousMillis1 >= OnTime1))
  {unsigned long currentMillis = millis();
    previousMillis1 = currentMillis;
     digitalWrite(ledPin1, LOW);
  }
 else (digitalWrite(ledPin1, HIGH));
  {
   unsigned long currentMillis = millis();
    previousMillis1 = currentMillis;
   
  }
 
  voice="";
}
}

alemartk

Hi everyone ,,,I'm looking for some help.this is killing meeeee...i need some help to get this code working ,,im trying to send commands via bluetooth and a button pin , but only one work at a time...i can't get the millis code together yet....can anyone help me out , i'm drowning already....

alemartk

const int led1 = 8;
const int led2 = 9;
const int led3 = 10;
const int LEDOM = 12;
const int BOTON = 7;

int val = 0;
String voice;

void setup(){
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(LEDOM,OUTPUT);
  pinMode(BOTON,INPUT);
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(LEDOM, HIGH);
}
 
void loop(){
  while (Serial.available())
  {
  delay(10);
  char c = Serial.read();
   voice += c;
  }
  val = digitalRead(BOTON);

if (val == HIGH){
 digitalWrite(LEDOM, LOW);
 Serial.write ("SORY");
 delay(800);
 digitalWrite(LEDOM, HIGH);
}
 if (voice.length() > 0)
  {
    Serial.println(voice);
       if(voice == "1111")
       {
        digitalWrite(led1, LOW);
        delay(1000);
        digitalWrite(led1, HIGH);
        } 
  if(voice == "2222")
  {
   digitalWrite(led2, LOW);
   delay(2000);
   digitalWrite(led2, HIGH);
    }
      if(voice == "3333")
  {
   digitalWrite(led3, LOW);
   delay(3000);
   digitalWrite(led3, HIGH);
    }
voice="";
    }
  }

Grumpy_Mike

Don't hijack threads, start your own.
Read the rules How to use this forum
Because your post is breaking the rules about posting code.

Teeth2k

#19
Oct 23, 2018, 08:37 pm Last Edit: Oct 23, 2018, 08:38 pm by Teeth2k
Do you require them at full brightness? If you half the brightness, you'll half the power draw.  Make sure the ground of the power strip is wired to the same ground for the Arduino (this gave me problems). If you are going to run at full brightness white you will need some decent gauge wire also. How many power/ground lines are on the PSU you bought? If 3 id put 200 LEDs worth on each main. This will help in the long run for you.

I just did a similar but smaller project (440 LEDs) so I'm fresh on this project.
My psu has 3 power outputs

Teeth2k

Also looking to make a led wall using 2 meter lengths and 11 lengths, quite fancy a music equaliser display, is this achievable?

Also
1320 LEDs x 0.07 = 79.2 amps

So an 80 amp power supply would be enough with a audrino?

Go Up