Show Posts
Pages: [1] 2 3
1  Using Arduino / LEDs and Multiplexing / Radioshack LED Strip Programming on: May 21, 2013, 02:40:03 pm
Hey guys!

I've searched around and couldn't find an answer to this. I'd really appreciate the help. So I've purchased two Radioshack LED Strips (http://www.radioshack.com/product/index.jsp?productId=16306856). I've cut them into segments of six lights each (there are 10 segments of 3 lights each on one strip when it is whole) and connected eight of these segments together. This means I've used one whole strip and a few segments from the second strip. When I upload the code from the Radioshack site, the lights work, but only the first 5 segments (which would be the whole first strip). None of the segments from the second strip light up. I know it must be the code, but I am having trouble deciphering where in the code you tell it how many of the segments to light up.

I tried pasting the code but it was too many characters. Here is a link to download the sketch (http://www.radioshack.com/graphics/uc/rsk/Support/SoftwareDownload/2760249.zip)


If anyone could just explain to me how to alter this code to get the 3 extra segments to light up, I would be extremely grateful. Thank you so much in advance.

FennelRye
2  Using Arduino / Project Guidance / Re: Radio Proximity Silencer on: July 09, 2012, 08:06:43 pm
Thanks for all the replies, guys. I would like it to be pretty powerful. If possible, I would like it to be able to "transmit" from a few blocks away. Also, would it be possible to encode this transmission so that only cars with the transmitter would be able to send to the receivers? Basically I would just like to prevent anyone from transmitting and muting the radio unless they had the correct transmitter and code. Thanks again!
3  Using Arduino / Project Guidance / Re: Radio Proximity Silencer on: July 08, 2012, 02:43:37 am
pylon,

Yes, you are correct. I would like to have a car with a "receiver" built into the radio and a car with a "transmitter". Only cars with this receiver installed would be effected. When the transmitter car comes a certain distance from the receiver car, the receiver car's radio would be soft muted or silenced. Eventually I would like the transmitter to be in several cars, but for now one will work to test it out. Thanks for your response, looking forward to hearing your thoughts.

Coding Badly,

If I were trying to do something unethical and illegal I probably wouldn't come to an Arduino message board to announce it. Not with ever-vigilant sleuths like yourself on the lookout.
4  Using Arduino / Project Guidance / Radio Proximity Silencer on: July 05, 2012, 11:44:20 pm
Hey guys,

Had an idea and was wondering if it was feasible.  I would like to build something into a car radio that would silence whatever you were listening to (think bluetooth phone. when you receive a call, the music silences and the phone call comes through) when another vehicle with a "transmitter", came near.  In other words, in one car I would like to build a transmitter of some sort that would cause the music in any cars near it to soft mute or mute completely. Is this possible? What would be the best way to go about this? Thanks in advance!

Fennel Rye
5  Using Arduino / Programming Questions / Re: LED Chasing Lights Progamming on: May 24, 2012, 07:47:02 pm
But what is byte j? Are you creating and naming a byte with that declaration or is byte j something that already exists that you are calling upon? 
6  Using Arduino / Programming Questions / Re: LED Chasing Lights Progamming on: May 24, 2012, 07:21:45 pm
Quote
for (byte j = 0; j < 14; j++)
  doCircle (20);

Little confused about bytes.  Where are you getting the names 'i' and 'j' from for these bytes?  I understand that they are there to store a number, but I'm getting confused on where the letters are coming from.
7  Using Arduino / Programming Questions / Re: LED Chasing Lights Progamming on: May 24, 2012, 07:06:05 pm
Now we're getting somewhere! Here's the code I have now:

Code:
const int numberOfLEDs = 14;

const byte LEDorder [numberOfLEDs] = { 1, 2, 3, 4, 5, 7, 6, 8, 12, 9, 13, 10, 0, 11 };

void setup() {               
  for (byte i = 0; i < numberOfLEDs; i++) 
    pinMode(LEDorder [i], OUTPUT);
}  // end of setup

void doCircle (const unsigned long delayAmount)
  {
  for (byte i = 0; i < numberOfLEDs; i++)
    {
    byte pin = LEDorder [i];
    digitalWrite(pin, HIGH);
    delay(delayAmount);             
    digitalWrite(pin, LOW);
    }   // end of for
  }  // end of doCircle
 
void loop()
  {
 doCircle (500);
  doCircle (450);
  doCircle (400);
  doCircle (350);
  doCircle (300);
  doCircle (250);
  doCircle (200);
  doCircle (150);
  doCircle (100);
  doCircle (90);
  doCircle (80);
  doCircle (70);
  doCircle (60);
  doCircle (50);
  doCircle (40);
  doCircle (30);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);
  doCircle (20);

 
  } // end of loop

And it's doing it's speed up and then stay at a 20 delay perfectly.  Now I'm trying to implement the pulsing after it does it's cycle of doCircle (20)'s by using a modified version of your 'fading 20 LEDs' code, but I'm running into problems. I tried this on it's own as an experiment:

Code:
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

const byte pwmPin = 3;
const byte maxPin = 11;

ISR (PCINT0_vect)
 {
static byte val = 0;

 val = !val;
 for (byte i = 0; i <= maxPin; i++)
   if (i != pwmPin)
     digitalWrite (i, val);
 }
 
void setup()
  {
  for (byte i = 0; i <= maxPin; i++)
    pinMode (i, OUTPUT);

  // pin change interrupt
  PCMSK0 = _BV (PCINT1);  // only want pin 9
  PCIFR  = _BV (PCIF0);   // clear any outstanding interrupts
  PCICR |= _BV (PCIE0);   // enable pin change interrupts for PCINT7..0
  }   // end of setup

void loop() 
  {
  // set the brightness of pin 9:
  analogWrite(pwmPin, brightness);   

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255)
    fadeAmount = -fadeAmount ;

  // wait for 30 milliseconds to see the dimming effect   
  delay(30);                           
}  // end of loop

I changed the 'maxPin' to 11, because I didn't want all the LEDs to fade in and out at once (I don't have sufficient power so I only want pins 3, 5, 6, 9, 10, and 11 pulsing) but I only got the pin 3 LED fading.  I'm assuming I'm not understanding the maxPin.  Just tried your brightness limiting code and it worked perfectly. You're helping so much, Nick.  I really aprecciate it.  I apologize for the neverending questions, but it's exciting to be learning this stuff, however slow that process may be.  You've gotten me to the point where this thing is almost finished!  Now I just need it to end with the pulsing loop and have it all activated by a button push.  Hehe.  smiley-roll-blue
8  Using Arduino / Programming Questions / Re: LED Chasing Lights Progamming on: May 24, 2012, 03:34:57 pm
Ahhhh. smiley-roll-sweat That is much better. Thank you, Nick. The one thing I understood how to do with the old cumbersome code that I do not with your new, nice and clean code is that once it reaches it's fastest spinning speed (which I would like to be a delay of 10 between lights) I'd like it to spin around at that speed ten times and then begin the pulsing.

My LEDs are very, very bright and I've been getting a bit of a headache working on this. It's too hard for me to not stare at the pretty, blinky LEDs.  If I wanted to set them all at a lower brightness, would I just change digitalWrite(pin, HIGH) into digitalWrite(pin, 100) or something like this? Thanks so much.
9  Using Arduino / Programming Questions / LED Chasing Lights Progamming on: May 23, 2012, 07:19:47 pm
Hey guys,

So I have a code for a ring of LEDs to make them chase faster and faster.  I have the LEDs connected into the PWM pins arranged so that they are symmetrical, which is why the pins switching on and off in my code jump around a little. Here's the code:

Code:
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT); 
}

void loop() {
  digitalWrite(1, HIGH);
  delay(500);             
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  delay(500);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  delay(500);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  delay(500);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(500);
  digitalWrite(5, LOW);
  digitalWrite(7, HIGH);
  delay(500);
  digitalWrite(7, LOW);
  digitalWrite(6, HIGH);
  delay(500);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  delay(500);
  digitalWrite(8, LOW);
  digitalWrite(12, HIGH);
  delay(500);
  digitalWrite(12, LOW);
  digitalWrite(9, HIGH);
  delay(500);
  digitalWrite(9, LOW);
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  digitalWrite(10, HIGH);
  delay(500);
  digitalWrite(10, LOW);
  digitalWrite(0, HIGH);
  delay(500);
  digitalWrite(0, LOW);
  digitalWrite(11, HIGH);
  delay(500);
  digitalWrite(11, LOW);
  digitalWrite(1, HIGH);
  delay(400);             
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  delay(400);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  delay(400);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  delay(400);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(400);
  digitalWrite(5, LOW);
  digitalWrite(7, HIGH);
  delay(400);
  digitalWrite(7, LOW);
  digitalWrite(6, HIGH);
  delay(400);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  delay(400);
  digitalWrite(8, LOW);
  digitalWrite(12, HIGH);
  delay(400);
  digitalWrite(12, LOW);
  digitalWrite(9, HIGH);
  delay(400);
  digitalWrite(9, LOW);
  digitalWrite(13, HIGH);
  delay(400);
  digitalWrite(13, LOW);
  digitalWrite(10, HIGH);
  delay(400);
  digitalWrite(10, LOW);
  digitalWrite(0, HIGH);
  delay(400);
  digitalWrite(0, LOW);
  digitalWrite(11, HIGH);
  delay(400);
  digitalWrite(11, LOW);
  digitalWrite(1, HIGH);
  delay(300);             
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  delay(300);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  delay(300);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  delay(300);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(300);
  digitalWrite(5, LOW);
  digitalWrite(7, HIGH);
  delay(300);
  digitalWrite(7, LOW);
  digitalWrite(6, HIGH);
  delay(300);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  delay(300);
  digitalWrite(8, LOW);
  digitalWrite(12, HIGH);
  delay(300);
  digitalWrite(12, LOW);
  digitalWrite(9, HIGH);
  delay(300);
  digitalWrite(9, LOW);
  digitalWrite(13, HIGH);
  delay(300);
  digitalWrite(13, LOW);
  digitalWrite(10, HIGH);
  delay(300);
  digitalWrite(10, LOW);
  digitalWrite(0, HIGH);
  delay(300);
  digitalWrite(0, LOW);
  digitalWrite(11, HIGH);
  delay(300);
  digitalWrite(11, LOW);
  digitalWrite(1, HIGH);
  delay(200);             
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  delay(200);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  delay(200);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  delay(200);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(200);
  digitalWrite(5, LOW);
  digitalWrite(7, HIGH);
  delay(200);
  digitalWrite(7, LOW);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  delay(200);
  digitalWrite(8, LOW);
  digitalWrite(12, HIGH);
  delay(200);
  digitalWrite(12, LOW);
  digitalWrite(9, HIGH);
  delay(200);
  digitalWrite(9, LOW);
  digitalWrite(13, HIGH);
  delay(200);
  digitalWrite(13, LOW);
  digitalWrite(10, HIGH);
  delay(200);
  digitalWrite(10, LOW);
  digitalWrite(0, HIGH);
  delay(200);
  digitalWrite(0, LOW);
  digitalWrite(11, HIGH);
  delay(200);
  digitalWrite(11, LOW);
  digitalWrite(1, HIGH);
  delay(100);             
  digitalWrite(1, LOW);
  digitalWrite(2, HIGH);
  delay(100);
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  delay(100);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  delay(100);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(100);
  digitalWrite(5, LOW);
  digitalWrite(7, HIGH);
  delay(100);
  digitalWrite(7, LOW);
  digitalWrite(6, HIGH);
  delay(100);
  digitalWrite(6, LOW);
  digitalWrite(8, HIGH);
  delay(100);
  digitalWrite(8, LOW);
  digitalWrite(12, HIGH);
  delay(100);
  digitalWrite(12, LOW);
  digitalWrite(9, HIGH);
  delay(100);
  digitalWrite(9, LOW);
  digitalWrite(13, HIGH);
  delay(100);
  digitalWrite(13, LOW);
  digitalWrite(10, HIGH);
  delay(100);
  digitalWrite(10, LOW);
  digitalWrite(0, HIGH);
  delay(100);
  digitalWrite(0, LOW);
  digitalWrite(11, HIGH);
  delay(100);
  digitalWrite(11, LOW);
  digitalWrite(1, HIGH);
 
}

Now, at the end of this code, I want the 6 PWM LEDs to begin pulsing (fading in and out) in an endless loop. I tried using this code:

Code:
analogWrite(9, brightness);   

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }     
  // wait for 30 milliseconds to see the dimming effect   
  delay(30);                           
}

at the end of it (I also set int brightness = 0 and int fadeAmount= 5 before the setup), but it did not work correctly. What's the best way to go about this? I've searched around but am having trouble finding the answer.  Thanks, guys!
10  Using Arduino / LEDs and Multiplexing / Re: Driving multiple LEDs with the Arudino and External Battery Pack on: May 23, 2012, 04:28:08 pm
NOTE: For a more in depth look into this topic, see http://arduino.cc/forum/index.php/topic,106844.0.html
11  Using Arduino / General Electronics / Re: Finding a forward voltage drop across an LED on: May 23, 2012, 04:25:41 pm
Quote
I have never seen a FW supply listed in any data sheet for an LED, such a thing does not make any sense.

On the back of the packaging of an LED from Radioshack it lists a "FW supply: 3.3V (typical), 4.0V (max.)".  Does this mean you should plan for and use resistors for this max setting (in this case, 4.0V)? 

Or is the best method for figuring out an LEDs voltage drop what Duane explained above?
12  Using Arduino / General Electronics / Re: Finding a forward voltage drop across an LED on: May 23, 2012, 02:09:50 am
Thanks, Duane! One thing I just want to clarify, though.  Is the FW supply listed on a LEDs tech specs the same thing as the voltage drop?
13  Using Arduino / General Electronics / Finding a forward voltage drop across an LED on: May 23, 2012, 01:39:24 am
Hey guys,

Another question that I'm sure is very basic but I am having a hard time finding a concise answer.  How do you determine the forward voltage drop across an LED? Is this the same thing as the FW Supply listed in the LEDs tech specs? How can you measure a forward voltage drop with a multimeter?  Thanks so much in advance and I apologize once again for my extreme n00bness!  smiley-sweat
14  Using Arduino / General Electronics / Re: Powering an Arduino Uno on: May 23, 2012, 01:23:53 am
Quote
It doesn't go through the voltage regulator. We assume that the 5V from USB is in range.

You're the man, Nick! Alas, I spoke to soon.  The questions keep on a comin'!  I just read somewhere that if you have two LEDs wired in series, you'll need to have a power source that can handle double their FW supply.  Is this true? In this case, will 5V not be enough to handle my two 3.3V LEDs in series pairs?

Bonus question: As long as only one LED is on at once, I could handle driving all 14 seperately, right?
15  Using Arduino / General Electronics / Re: Powering an Arduino Uno on: May 23, 2012, 01:07:11 am
Thanks so much, Nick.  I'll report back with pictures and results. Thank you and everyone else for all the help! Excited to try this stuff out.

One more question actually:  I see now that they recommed 7V - 12V, but doesn't the USB only provide 5V? Why is this considered a sufficient power source? Or is it not?  Thanks so much!
Pages: [1] 2 3