Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Why isn't my LED fading? on: March 30, 2011, 07:35:05 pm
Oh! Got it, thanks! From my code, which pin do I want to set?
2  Using Arduino / Programming Questions / Re: Why isn't my LED fading? on: March 30, 2011, 06:00:18 pm
I am so confused. I used the wrong output pins?
3  Using Arduino / Programming Questions / Re: Why isn't my LED fading? on: March 30, 2011, 05:46:20 pm
Thanks, Pedro. It still isn't working for me. Did I put it in the wrong place?
Code:
int datapin  = 10; // DI
int latchpin = 11; // LI
int enablepin = 12; // EI
int clockpin = 13; // CI
unsigned long Packet;
int Command;
int Blue = 0; // Maximum Blue
int Red = 1023; // Maximmum Red
int Green = 1023; // Maximum Green
int Fade = 50;

void setup() {
   pinMode(datapin, OUTPUT);
   pinMode(latchpin, OUTPUT);
   pinMode(enablepin, OUTPUT);
   pinMode(clockpin, OUTPUT);

   digitalWrite(latchpin, LOW);
   digitalWrite(enablepin, LOW);
}

void SendPacket() {
   Packet = Command & B11;
   Packet = (Packet << 10)  | (Blue & 1023);
   Packet = (Packet << 10)  | (Red & 1023);
   Packet = (Packet << 10)  | (Green & 1023);

   shiftOut(datapin, clockpin, MSBFIRST, Packet >> 24);
   shiftOut(datapin, clockpin, MSBFIRST, Packet >> 16);
   shiftOut(datapin, clockpin, MSBFIRST, Packet >> 8);
   shiftOut(datapin, clockpin, MSBFIRST, Packet);

   delay(1); // adjustment may be necessary depending on chain length
   digitalWrite(latchpin,HIGH); // latch data into registers
   delay(1); // adjustment may be necessary depending on chain length
   digitalWrite(latchpin,LOW);
}

void loop() {
   SendPacket();
   
   Command = B00;
   Blue = Blue + Fade;
   
   Command = B00;
   if (Blue = 0);
      Fade = -Fade; 
     
   delay (10);
 
}
4  Using Arduino / Programming Questions / Re: Why isn't my LED fading? on: March 30, 2011, 05:37:54 pm
Hi! Can you explain that a little bit more? Or maybe provide some sample code? I'm new to coding.. and electronics in general. Thanks smiley

Jack
5  Using Arduino / Programming Questions / Why isn't my LED fading? on: March 30, 2011, 05:25:16 pm
I'm using a Shiftbrite. My first time writing code!   smiley Any improvements? Also... why doesn't it work? I tried to copy the sample LED fade as best as I could.

Code:
int datapin  = 10; // DI
int latchpin = 11; // LI
int enablepin = 12; // EI
int clockpin = 13; // CI
unsigned long CommandPacket;
int Command;
int Blue = 1023; // Maximum Blue
int Red = 1023; // Maximmum Red
int Green = 1023; // Maximum Green
int Fade = 5;

void setup() {
   pinMode(datapin, OUTPUT);
   pinMode(latchpin, OUTPUT);
   pinMode(enablepin, OUTPUT);
   pinMode(clockpin, OUTPUT);

   digitalWrite(latchpin, LOW);
   digitalWrite(enablepin, LOW);
}

void SendPacket() {
   CommandPacket = Command & B11;
   CommandPacket = (CommandPacket << 10)  | (Blue & 1023);
   CommandPacket = (CommandPacket << 10)  | (Red & 1023);
   CommandPacket = (CommandPacket << 10)  | (Green & 1023);

   shiftOut(datapin, clockpin, MSBFIRST, CommandPacket >> 24);
   shiftOut(datapin, clockpin, MSBFIRST, CommandPacket >> 16);
   shiftOut(datapin, clockpin, MSBFIRST, CommandPacket >> 8);
   shiftOut(datapin, clockpin, MSBFIRST, CommandPacket);

   delay(1); // adjustment may be necessary depending on chain length
   digitalWrite(latchpin,HIGH); // latch data into registers
   delay(1); // adjustment may be necessary depending on chain length
   digitalWrite(latchpin,LOW);
}

void loop() {
   
   Command = B00;
   Blue = Blue - Fade;
   
   delay (10);
   
   Fade = Fade + 5;
   
   if (Blue = 0);
      Fade = -Fade;
 
}

Thanks!
Jack
6  Using Arduino / LEDs and Multiplexing / Re: Shiftbrite Help? on: March 27, 2011, 08:15:42 pm
Oh! Thanks so much! Will the 5V on the Arduino do?
7  Using Arduino / LEDs and Multiplexing / Re: Shiftbrite Help? on: March 27, 2011, 09:43:56 am
Thanks so much!

I used that sample code. I'm using a 9V battery connected via breadboard to the respective V+ and Gnd pins. Then, I ran the sample code on my Arduino. With the breadboard, I connected Digital pin 10 on my Arduino to the DI on the Shiftbrite, 11 to LI, 12 to EI, and 13 to CI. If you haven't caught my mistake already I can post a photo.

jxmorris
8  Using Arduino / LEDs and Multiplexing / Shiftbrite Help? on: March 20, 2011, 03:18:27 pm
Hi! How do I use a Shiftbrite? I tried with sample code that I found online with no avail. Any code for me? And which wires go where? I'm new to this stuff. I have six jumper wires, a breadboard, and an Arduino Uno.

Thanks!
jxmorris
9  Using Arduino / General Electronics / Science Fair on: February 13, 2011, 08:10:03 pm
My science fair project question is: How does the size of an LED affect the amount of current that it takes to burn out?

I decided to put my background paper on here for constructive criticism  smiley-wink Here goes!


Science Fair Background Paper
   Circuits are unsung heroes in our daily lives. They are in everything from dishwashers to remote control cars. Circuits can be so simple that they only power a light, or complex enough to power a supercomputer.
   A circuit consists of two main parts. A power source is the first, and the most essential part of a circuit. It provides the power for the rest of the circuit. A battery is one example of a power source. The second part of a circuit is made up of its components. The components of a circuit range from lights to motors to buttons and sensors.
   Drawing circuits is an easy way to show others what components make up your particular circuit. Sketching all of the components in a circuit is one way to record what it contains. Another way is to draw a circuit schematic. A circuit schematic uses symbols in succession to represent each item in a circuit. One other way to draw a circuit is to use the “PCB” technique. This uses squares, lines, and labels to represent the members of the circuit and their relationships.
   LEDs are one common component of a circuit. They are the lights used in almost all modern electronics. LEDs are cheap, accessible, and come in gobs of different shapes, sizes and colors. LED stands for Light-Emitting Diode. A diode is an electrical piece that can only be put in a circuit one way. This means that if you put an LED in a circuit backwards, it will not light up.
   In 1907, a British experimenter discovered electroluminescence, the essential principle in LEDs. No practical use was made of his discovery until a radio technician discovered the properties of semiconductors in 1955. Semiconductors are elements between conductors, like aluminum, and non-conductors, like carbon. They only partially conduct electricity. In 1961, two experimenters at Texas Instruments combined these innovations and created an infrared diode that, when electrically stimulated, produced light. Their design was improved, and the first light-emitting diode was patented the next year by a scientist at General Electric Company (GE).
   When they were first manufactured, LEDs cost around two hundred dollars per unit. Because of their small size and few practical applications, they were considered inefficient and therefore not widely used. However, as technological discoveries continued, the price of the lights decreased to a manageable amount. By then, light-emitting diodes were used in expensive equipment in laboratories and as replacements for neon lights. As the price of the diodes continued to fall, they took on a more common role in modern appliances. Today, you can find LEDs in lamps, calculators, scoreboards, televisions, traffic lights, and a myriad of other electronic items.
   LEDs have two prongs, or “leads”. The longer prong, called the anode, is connected to the power source. The second, and shorter, lead is known as the cathode. It connects back to the power source to complete the circuit. The lights work because the case of the LED contains a semiconductor, often a substance called silicon carbide.  Different semiconductors produce different colors and shades of light. When electricity passes through a semiconductor in such a fashion, it glows, producing colored light. White light-emitting diodes are actually red, blue, and green LEDs placed together inside one casing.
   If the electricity that enters an LED is not controlled, it can short circuit, or “burn out”. When too much current flows through a light-emitting diode, the semiconductor inside stops being able to expel all incoming energy through light. Instead, the extra electricity is released through heat. This heat melts the semiconductor and surrounding materials. The case takes on a blackish hue and the diode ceases to conduct electricity.
   Resistors are an efficient way to reduce the amount of current on an LED. Resistors are another type of electrical component. They use insulators to reduce the flow of electricity. Resistors are very cheap and come in an enormous variety. They are used in almost every electrical appliance to control the flow of electricity.
   Resistors are measured in ohms. Resistors range from one to thousands of ohms. Ohms are represented with the symbol Ω. They are named for German physicist George Ohm. He is famous for his equation that became the basis for all electrical theory, Ohm’s law. Ohm’s law is the foundation of measuring electrical current. The equation is “I = V/R”. “I” represents the flow of the current. This equation can also be shown as “V = IR” or “R = V/I”. Basically, the equation shows the relationship between ohms, amperes (or “amps”), and volts. Amperes measure the flow of current. They give electricity its power. Without amps, light-emitting diodes would never short circuit. Without amps, LEDs wouldn’t even turn on. Volts are “V” in the equation. Volts are a measurement of the actual amount of power. Batteries and other power sources are measured in volts. Most light-emitting diodes require one to four volts to run properly.
   Circuits are important parts of our daily lives. They are the essence of electronics.  Without circuits, our day-to-day lives would be drastically different.
10  Using Arduino / Project Guidance / Vocabulary on: February 01, 2011, 10:30:55 am
Hi! Where can I find basic definitions and the relationships between
  • ohms
  • volts
  • amps
  • capacitance
  • etc.

and the difference between serial, analog, and digital (like on the Arduino board pin labels???) and the difference between dc and ac? Thanks so much!!

Sincerely,
Very Confused  smiley-wink
11  Using Arduino / Installation & Troubleshooting / Arduino Board Diagram on: January 30, 2011, 07:34:51 pm
Hi! Does anybody know where a newbie could find a labeled diagram of an Arduino board? (specifically, an Uno)

-jxmorris12
12  Forum 2005-2010 (read only) / Frequently-Asked Questions / Wireless?? on: January 03, 2011, 05:32:39 pm
Hi! I'm completely new to Arduino (only read the books, and done things similar to "blink an LED".) I was wondering if there's a way that I can wire my light switch so that there's a button I can hit across the room to turn off the overhead without getting out of bed? Hopefully I wouldn't have to run a wire across the room or open up the wall  smiley some sort of Bluetooth-like system?

As I said, I'm new to this and could have it all wrong.

Thanks again!!
jxmorris12
Pages: [1]