The Planted Tank Forum - View Single Post - Calling all DIY LED "Junkies" - Your opinions wanted!
View Single Post
Old 11-26-2012, 04:12 PM   #131
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: yorba linda, ca.
Posts: 564
Default

Quote:
Originally Posted by skanderson View Post
ok i have gotten all 3 strings to light up using the 5 volt as the dimming input so the wiring on the strings is now correct. this is the first time i have ever used and ardino and i am confused. i have placed the following files into the libraray file on the ardino, ds1307 cpp file, ds1307 o file, ds1307.h, timer1, but i dont know how to get them to compile. i read the part about restarting the ardino IDE but i dont know how to do that. my red blink button is blinking so there is something going on in there. also i dont know where to go into to do the setting of the timers on the dimmers. thanks in advance, hopefully i will get this thing up and running within the week so i can post some pics.

The Libraries don't need to be compiled Per Se. Just insert them into the "Libraries" folder first and then restart the Arduino IDE. The actual program"Sketch" that you're using will reference the needed libraries during the compiling process and pull in the needed information.
Since you're just getting started with Arduino programming, Try some of the simpler programs first, like "blink" ( that's the code that I left running on the unit that you have) The red led is tied to digital pin 13 and that pin is currently programmed to "blink". You can always edit the "Blink" code to add more pins like I've done here. Try this code-
Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain. This copy has been modified to test all 6 PWM output pins.
 */

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

void loop() {
  digitalWrite(3, HIGH);   // set the LED on
  digitalWrite(5, HIGH);   // set the LED on
  digitalWrite(6, HIGH);   // set the LED on  
  digitalWrite(9, HIGH);   // set the LED on 
  digitalWrite(10, HIGH);   // set the LED on 
  digitalWrite(11, HIGH);   // set the LED on
  
  delay(1000);              // wait for a second
  digitalWrite(3, LOW);    // set the LED off
  digitalWrite(5, LOW);    // set the LED off 
  digitalWrite(6, LOW);    // set the LED off 
  digitalWrite(9, LOW);    // set the LED off
  digitalWrite(10, LOW);    // set the LED off 
  digitalWrite(11, LOW);    // set the LED off
  
  delay(1000);              // wait for a second
}
When you've conquered this- try some of the "fading" code.

Like this-

Code:
/*
 Fade
 
 This example shows how to fade an LED on pin 9
 using the analogWrite() function.
 
 This example code is in the public domain. This copy has been modified to test all 6 PWM output pins.
 
 */
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

void setup()  { 
  // declare pin 9 to be an output:
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);

} 

void loop()  { 
  // set the brightness of pin 9:
  analogWrite(3, brightness);    
  analogWrite(5, brightness);
  analogWrite(6, brightness); 
  analogWrite(9, brightness); 
  analogWrite(10, brightness); 
  analogWrite(11, 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);                            
}
Let me know if you have any trouble with the codes and If needed, I'll custom edit some, with the variables you want, to get your system up and running.
At times it's easier to learn when you already have something working to use as an example.
__________________
225 Gal, Glass "Reef Ready" w/ twin Iwaki Pumps & 2 Ocean Clear inline filters. Custom 320 watt LED Lighting system utilizing a 6' Maker's Heat Sink, 12 BridgeLux Vero 18's,3 purpose built 5 channel A6211 Led driver/Controllers, and a 20lb CO2 system w/ Milwaukee Ph Controller.
O2surplus is offline   Reply With Quote