Show Posts
Pages: [1] 2 3 4
1  Using Arduino / General Electronics / Re: arduino optocoupler pwm feed on: February 12, 2013, 04:02:11 pm
No wonder they call you Grumpy Mike great name !

How can a led driver be overloaded when they are designed to regulate current, all leds in aquarium builds are not run at the full amount like the xte crees capable of 1.5 amp yet most run at 1100ma or 1200ma using a 1200ma driver so whats the difference, If a led driver did provide more then the leds can handle then the leds would simply burn out, And yes i do care how long they last HENCE leds been under driven derrrr
2  Using Arduino / General Electronics / Re: arduino optocoupler pwm feed on: February 07, 2013, 06:19:36 am
Sorry have to disagree about the driver it is set up running as we speak, will try to find a fast optocoupler

regards

kev

Not my led but same kind of set up
http://www.ebay.co.uk/itm/High-Power-50W-White-LED-Driver-Heat-Sink-/380531424736?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item589970bde0
3  Using Arduino / General Electronics / Re: arduino optocoupler pwm feed on: February 06, 2013, 05:45:40 pm
And just another on leds whilst i am on,

got a 36v 11amp psu turned down to 33v runnig 5 x 50w leds.
the leds specs are  DC Forward Voltage (VF): 30~34Vdc.  DC Forward Current (IF): 1500mA

The pwm driver is max current of 1200ma at 31.7v feeding the led, iS there any protection i can use on the led in case the driver fails at £50 a pop not cheap leds, simple fuse or resistor ?
4  Using Arduino / General Electronics / Re: arduino optocoupler pwm feed on: February 06, 2013, 05:38:45 pm
Is that the basic pww freq from the led drivers side, the arduino or the optocoupler/isolator ?

sorry for all the questions
5  Using Arduino / General Electronics / Re: arduino optocoupler pwm feed on: February 06, 2013, 05:31:27 pm
Sorry Mike on the sketch on the arduino 0 been off 255 been on 100% thats how many steps the led ramping has the pwm frequency has not been altered so would think that is as std if thats how it works sorry still quite new to it all, saw this on frequencies on another thread, 980Hz on 5 and 6, 490Hz on 3, 9, 10, 1

I am using
//Define the PWM PINS for the LEDs
const int ledPinSump = 7;             
const int ledPinBlue = 8;           
const int ledPinWhite = 9;           
const int ledPinRoyBlue = 10;         
const int ledPinRed = 11;             
const int ledPinUV = 12;             
const int ledPinMoon = 13;             
6  Using Arduino / General Electronics / arduino optocoupler pwm feed on: February 06, 2013, 05:22:51 pm
Trying to work out what optocoupler to get, the circuit design is the atmega 2560 and uses 7 pwm pins to feed high power led drivers, one arduino output has been fried my own fault for shorting the pwm feed to ground so looking to get an optocoupler to isolate its from the led drivers, the pwm is 0-255 so will need the same at the other side of the optocoupler,  will any do or do i need a high speed one something like the 6n137

cheers in advance

kev
7  Using Arduino / Programming Questions / Help please on program on: April 13, 2011, 11:26:50 am
Not for the first or last time i am struggling on a program

these are the parts i am using

Mega 1280
ITDB02 V1.1 MEGA SHIELD
3.2" TOUCH LCD

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&rd=1&item=280628967935&ssPageName=STRK:MEAFB:IT

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=270655252530

http://iteadstudio.com/produce/itdb02-arduino-mega-shield-v1-1-come-with-library-v1-2/


Now the screen does not light up at no back light or anything it is uploading to the arduino also the sample sketches dont work  smiley-sad
any one any ideas  smiley-confuse

thank you again

kev


Will not let me upload code for some reason so heres the top of it

Code:
//---------------------------------------------------------
//Stilo v.1 Aquarium Controller
//
//http://code.google.com/p/stilo/
//---------------------------------------------------------
//
//Libraries used:
//ITDB02_Graph16 and ITDB02_Touch (C)2010 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//libds1307 by Matt Joyce for Maxim DS1307 RTC chip
//http://code.google.com/p/libds1307/
//LED controlling algorithm is based on Krusduino by Hugh Dangerfield
//http://code.google.com/p/dangerduino/
//
//-----------------------------------------------------------
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
//------------------------------------------------------------------------------


#include <ITDB02_Graph16.h>
#include <ITDB02_Touch.h>
#include <Wire.h>
#include <DS1307.h>

// Change pins for screen and touch panel if needed
ITDB02        myGLCD(38,39,40,41);     // Remember to add ASPECT_16x9 if you are using an ITDB02-3.2WC!
ITDB02_Touch  myTouch(46,45,44,43,42);
 
8  Community / Exhibition / Gallery / Re: LED and aquarium controller with TFT LCD touch screen on: March 05, 2011, 02:28:08 pm
Great build lads im (reefergeek) was trying to amend your code for use on the atmega 328 but read that the tft on that arduino board ties all the pins up so none for dimming leds left or temp sensor

Going to buy a mega and try to solder some pin headers in my atmega 328 tft

Kev
9  Using Arduino / Programming Questions / ds1302 ds1307 on: February 13, 2011, 05:09:51 pm
Is it possible to amend a code with rtd defined as ds1307 to ds1302 i understand the ds1302 has 3 pins where as the ds1307 has the std two pins

Struggling a little understanding the code
10  Using Arduino / Programming Questions / Re: A little help please on: February 13, 2011, 12:55:47 pm
And then when we have fixed the bug in the above program i need to add this code unless you can work out which pin the rtc is linked to

Code:
#include <avr/pgmspace.h>
#include <sensor_pff.h>
#include <DS1302.h>

#include "dht11.c"

SENSOR_PFF sd;
DS1302 ds1302;
byte sensor_start = 0;
RTC rtc;

char buff[128];   /* i/o buffer */

static void get_line (char *buff, byte len)
{
   byte c;
   int idx = 0;


   for (;smiley-wink {
      if(Serial.available()){
         c = Serial.read();
         if (c == '\r') break;
         if ((c == '\b') && idx) {
            idx--; Serial.print(c);
         }
         if (((byte)c >= ' ') && (idx < len - 1)) {
            buff[idx++] = c; Serial.print(c);
         }
      }
   }
   buff[idx] = 0;
   Serial.print(c);
   Serial.print('\n');
}

/* convert string "<year> <date> <mon> <mday> <hour> <min> <sec>"  to RTC value, return 1 if successful */

byte convert_RTC(char *ptr, RTC* rtc_p)
{
   int val[7];
  byte i = 0;
   int value=0;

   while(*ptr++ && i<7)
   {
      if( *ptr >='0' &&  *ptr<='9' )
         value = value * 10 + *ptr - '0';   
      else if (*ptr == ' '|| !*ptr){
         val[i++] = value;
         value = 0;
      }
   
   }
   
         
   if (i==7) {
         rtc_p->year = (unsigned int) val[0];
      rtc_p->wday = (byte) val[1];
      rtc_p->month = (byte) val[2];
      rtc_p->mday = (byte) val[3];
      rtc_p->hour = (byte) val[4];
      rtc_p->min = (byte)val[5];
      rtc_p->sec = (byte) val[6];
      return 1;
   }
   else return 0;
}
     
   
void setup()
{
   byte res;
   Serial.begin(57600);
  DHT11_init();
   sprintf_P(buff, PSTR("\nRTC datalog shield DEMO\n"));
   Serial.println(buff);   
   Serial.print('>');
}



void loop()
{

   char *ptr;
   long p1, p2;
   byte res;
  unsigned short w;
   
  if(Serial.available() == FALSE){

   if(sensor_start == TRUE){
     byte hum_int=0, hum_dec=0, temp_int=0, temp_dec=0;
     int ret;
          ret = DHT11_read(&hum_int, &hum_dec, &temp_int, &temp_dec);
          ds1302.gettime(&rtc);
   
     sprintf_P(buff, PSTR("%u/%u/%u, %u, %02u:%02u:%02u, hum= %02u.%02u, temp = %02u.%02u\n"), rtc.year, rtc.month, rtc.mday, rtc.wday, rtc.hour, rtc.min, rtc.sec, hum_int, hum_dec, temp_int, temp_dec);
     res = pf_write(buff, strlen(buff), &w);   /* Write data to the file */
     if (res != FR_OK) { Serial.println("write err\n"); }
     else Serial.print('.');
     delay(2000);
   
   }   
   }
  else
   {
     get_line(buff, sizeof(buff));
     ptr = buff;
   
     switch (*ptr++) {
       case 'm':   // mount SD card
          res = disk_initialize();
          if (!res)
              res = pf_mount(&sd.fs);
      if(res)
              sprintf_P(buff, PSTR("SD CARD mount error"));
           else
               sprintf_P(buff, PSTR("SD CARD mount OK"));
              Serial.println(buff);
              break;
      case 't' :   /* t [<year> <date> <mon> <mday> <hour> <min> <sec>] */
           
      if (convert_RTC(ptr, &rtc)) {
        ds1302.settime(&rtc);
          }
         ds1302.gettime(&rtc);
         sprintf_P(buff, PSTR("%u/%u/%u, %u, %02u:%02u:%02u"), rtc.year, rtc.month, rtc.mday, rtc.wday, rtc.hour, rtc.min, rtc.sec);
         Serial.println(buff);
         break;
   case 's':    /* start datalog */
              if(sensor_start == FALSE) sensor_start = TRUE;
         else sensor_start = FALSE;
              break;
         
       case 'f':      /* open a file */
         while(*ptr == ' ') ptr++;
         res = pf_open(ptr);
              if(res)
                sprintf_P(buff, PSTR("open file Error"));
              else
                sprintf_P(buff, PSTR("open file OK"));
               Serial.println(buff);
           break;
       case 'r':   /* read sensor value */
      break;

   }
     Serial.print('>');
   }
}

11  Using Arduino / Programming Questions / Re: A little help please on: February 13, 2011, 12:54:15 pm
ah sorry thats how you do it, Now tried this code i thought it was all fine but when its dimming back down it get stuck on 248 pwm on both white and blues any ideas how i can amend

Code:
//Marine Led Controller v1
//created by ReeferGeek 12-02-11.


#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

int whiteFadeOn = 0;
int whiteFadeOff = 0;
int blueFadeOn = 0;
int blueFadeOff = 0;
int violetFadeOn = 0;
int violetFadeOff = 0;

int whiteLedPin = 9; // White Led chain linked to Digital pin9
int blueLedPin = 10; // Blue Led chain linked to Digital pin10
int violetLedPin = 11; // violet led chain linked to digital pin 11

int blueFadeValue = 0;
int whiteFadeValue = 0;
int violetFadeValue = 0;

int userDefMaxWhite = 100; //0-100 user defines the max intensity of the leds
int userDefMaxBlue = 100; //0-100 user defines the max intensity of the leds
int userDefMaxViolet = 100; // 0-100 user defines the max intensity of the leds
int fadeMaxWhite; //variable used when converthing userDefMaxWhite into a PWM value
int fadeMaxBlue; //variable used when converthing userDefMaxBlue into a PWM value
int fadeMaxViolet; //variable used when converting userdefmax into  PWM Value

int hour;//variable used for the RTC timed event.
int minute;//variable used for the RTC timed event.

int counter = 0;//counter for PWN

void setup(){
  Serial.begin(9600); //not needed in end product
  rtcStart();
}





void loop(){
  debug(); //not needed in end product
  maxCalc();
  ledFade();
  rtcCatch(); 
}

void ledFade(){ 
  if(counter < 60){
    counter++;
    }
  else{
   
    if(whiteFadeOn == 1){
      if(whiteFadeValue <= fadeMaxWhite) {
        analogWrite(whiteLedPin, whiteFadeValue);     
        whiteFadeValue = whiteFadeValue+4; // 255/4 = 63.75 i.e. 0-100% takes 63.75 minutes roughly to complete if it takes 1 minutes to complete 1 cycle.
      }

  }
 
   
    if(violetFadeOn == 1){
      if(violetFadeValue <= fadeMaxViolet) {
        analogWrite(violetLedPin, violetFadeValue);     
        violetFadeValue = violetFadeValue+4; // 255/4 = 63.75 i.e. 0-100% takes 63.75 minutes roughly to complete if it takes 1 minutes to complete 1 cycle.
      }


    }

    if(blueFadeOn == 1){
      if(blueFadeValue <= fadeMaxBlue) {
        analogWrite(blueLedPin, blueFadeValue);     
        blueFadeValue = blueFadeValue+4;
     }
    } 
 
    if(blueFadeOff == 1){
      if(blueFadeValue >= 0) {
        analogWrite(blueLedPin, blueFadeValue);     
        blueFadeValue = blueFadeValue-4;
      }
    }
 
    if(whiteFadeOff == 1){
      if(whiteFadeValue >= 0) {
        analogWrite(whiteLedPin, whiteFadeValue);     
        whiteFadeValue = whiteFadeValue-4;
     }

  }
 
    if(violetFadeOff == 1){
      if(violetFadeValue >= 0) {
        analogWrite(violetLedPin, violetFadeValue);     
        violetFadeValue = violetFadeValue-4;
     }


   }
   counter =0;
}
}








void maxCalc(){
  fadeMaxWhite = userDefMaxWhite*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
  fadeMaxBlue = userDefMaxBlue*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
  fadeMaxViolet = userDefMaxViolet*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
}

void rtcCatch(){
  hour = RTC.get(DS1307_HR,false);
  minute = RTC.get(DS1307_MIN,false);
 
  if((hour == smiley-cool&&(minute == 30)){//sets blue on for 08.30
    blueFadeOn = 1; 
  }
 
  if((hour ==10)&&(minute == 30)){//sets white on for 10.30
    whiteFadeOn = 1; 
  }

  if((hour == 21)&&(minute == 00)){//sets violet on  for 21.00
    violetFadeOn = 1; 
  }
 
 
  if((hour ==20)&&(minute == 0)){//sets for 20:00
    whiteFadeOff = 1; 
  }
 
  if((hour ==10)&&(minute == 0)){//sets for 10:00
    violetFadeOff = 1; 
  }

  if((hour ==21)&&(minute == 00)){//sets for 21:00
    blueFadeOff = 1; 
  }
}

void debug(){ //not needed in end product
  Serial.print(RTC.get(DS1307_HR,true)); Serial.print(":"); Serial.print(RTC.get(DS1307_MIN,false));Serial.print(":");Serial.print(RTC.get(DS1307_SEC,false));
  Serial.print("      Counter:");   
  Serial.print(counter);
  Serial.print("      ");
  Serial.print(RTC.get(DS1307_DATE,false));Serial.print("/"); Serial.print(RTC.get(DS1307_MTH,false));Serial.print("/");Serial.print(RTC.get(DS1307_YR,false));Serial.print(" "); Serial.print(RTC.get(DS1307_DOW,false));
 
  Serial.print(" Blue LED state:");Serial.print(blueFadeOn);Serial.print(blueFadeOff);Serial.print("   PWM Value:");Serial.print(blueFadeValue);
  Serial.print("      ");
 
  Serial.print("White LED state:");Serial.print(whiteFadeOn);Serial.print(whiteFadeOff);Serial.print("   PWM Value");Serial.print(whiteFadeValue);
  Serial.print("      ");
 
  Serial.print("Violet LED state:");Serial.print(violetFadeOn);Serial.print(violetFadeOff);Serial.print("   PWM Value");Serial.print(violetFadeValue);
  Serial.println();
  delay(1000);
}

void rtcStart(){
  RTC.stop();
  RTC.set(DS1307_SEC,00);        //set the seconds
  RTC.set(DS1307_MIN,34);     //set the minutes
  RTC.set(DS1307_HR,9);       //set the hours
  RTC.set(DS1307_DOW,06);       //set the day of the week
  RTC.set(DS1307_DATE,12);       //set the date
  RTC.set(DS1307_MTH,02);        //set the month
  RTC.set(DS1307_YR,11);         //set the year
  RTC.start(); 
}
12  Using Arduino / Programming Questions / Re: A little help please on: February 12, 2011, 05:08:43 pm
After we have sorted this out i need to include a pwm fan driven from a temp input also a lcd touch screen sketch, any one up for helping

Thank you again


Kev
13  Using Arduino / Programming Questions / Re: A little help please on: February 12, 2011, 05:05:27 pm
Now i need to merge this one with the top code so i can use my data logger


#include <avr/pgmspace.h>
#include <sensor_pff.h>
#include <DS1302.h>

#include "dht11.c"

SENSOR_PFF sd;
DS1302 ds1302;
byte sensor_start = 0;
RTC rtc;

char buff[128];   /* i/o buffer */

static void get_line (char *buff, byte len)
{
   byte c;
   int idx = 0;


   for (;smiley-wink {
      if(Serial.available()){
         c = Serial.read();
         if (c == '\r') break;
         if ((c == '\b') && idx) {
            idx--; Serial.print(c);
         }
         if (((byte)c >= ' ') && (idx < len - 1)) {
            buff[idx++] = c; Serial.print(c);
         }
      }
   }
   buff[idx] = 0;
   Serial.print(c);
   Serial.print('\n');
}

/* convert string "<year> <date> <mon> <mday> <hour> <min> <sec>"  to RTC value, return 1 if successful */

byte convert_RTC(char *ptr, RTC* rtc_p)
{
   int val[7];
  byte i = 0;
   int value=0;

   while(*ptr++ && i<7)
   {
      if( *ptr >='0' &&  *ptr<='9' )
         value = value * 10 + *ptr - '0';   
      else if (*ptr == ' '|| !*ptr){
         val[i++] = value;
         value = 0;
      }
   
   }
   
         
   if (i==7) {
         rtc_p->year = (unsigned int) val[0];
      rtc_p->wday = (byte) val[1];
      rtc_p->month = (byte) val[2];
      rtc_p->mday = (byte) val[3];
      rtc_p->hour = (byte) val[4];
      rtc_p->min = (byte)val[5];
      rtc_p->sec = (byte) val[6];
      return 1;
   }
   else return 0;
}
      
   
void setup()
{
   byte res;
   Serial.begin(57600);
  DHT11_init();
   sprintf_P(buff, PSTR("\nRTC datalog shield DEMO\n"));
   Serial.println(buff);   
   Serial.print('>');
}



void loop()
{

   char *ptr;
   long p1, p2;
   byte res;
  unsigned short w;
   
  if(Serial.available() == FALSE){

   if(sensor_start == TRUE){
     byte hum_int=0, hum_dec=0, temp_int=0, temp_dec=0;
     int ret;
          ret = DHT11_read(&hum_int, &hum_dec, &temp_int, &temp_dec);
          ds1302.gettime(&rtc);
   
     sprintf_P(buff, PSTR("%u/%u/%u, %u, %02u:%02u:%02u, hum= %02u.%02u, temp = %02u.%02u\n"), rtc.year, rtc.month, rtc.mday, rtc.wday, rtc.hour, rtc.min, rtc.sec, hum_int, hum_dec, temp_int, temp_dec);
     res = pf_write(buff, strlen(buff), &w);   /* Write data to the file */
     if (res != FR_OK) { Serial.println("write err\n"); }
     else Serial.print('.');
     delay(2000);
    
   }   
   }
  else
   {
     get_line(buff, sizeof(buff));
     ptr = buff;
   
     switch (*ptr++) {
       case 'm':   // mount SD card
          res = disk_initialize();
          if (!res)
              res = pf_mount(&sd.fs);
      if(res)
              sprintf_P(buff, PSTR("SD CARD mount error"));
           else
               sprintf_P(buff, PSTR("SD CARD mount OK"));
              Serial.println(buff);
              break;
      case 't' :   /* t [<year> <date> <mon> <mday> <hour> <min> <sec>] */
            
      if (convert_RTC(ptr, &rtc)) {
        ds1302.settime(&rtc);
          }
         ds1302.gettime(&rtc);
         sprintf_P(buff, PSTR("%u/%u/%u, %u, %02u:%02u:%02u"), rtc.year, rtc.month, rtc.mday, rtc.wday, rtc.hour, rtc.min, rtc.sec);
         Serial.println(buff);
         break;
   case 's':    /* start datalog */
              if(sensor_start == FALSE) sensor_start = TRUE;
         else sensor_start = FALSE;
              break;
         
       case 'f':      /* open a file */
         while(*ptr == ' ') ptr++;
         res = pf_open(ptr);
              if(res)
                sprintf_P(buff, PSTR("open file Error"));
              else
                sprintf_P(buff, PSTR("open file OK"));
               Serial.println(buff);
           break;
       case 'r':   /* read sensor value */
      break;

   }
     Serial.print('>');
   }
}

14  Using Arduino / Programming Questions / A little help please on: February 12, 2011, 05:03:55 pm
Got this sketch for controlling 3 banks off leds with pwm dinning, i need to amend the sketch i have to incorporate the second sketch could some on please help, i am guessing all the rtc from the first sketch needs replacing with the second sketch

#
//Marine Led Controller v1
//created by ReeferGeek 12-02-11.


#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>

int whiteFadeOn = 0;
int whiteFadeOff = 0;
int blueFadeOn = 0;
int blueFadeOff = 0;
int violetFadeOn = 0;
int violetFadeOff = 0;

int whiteLedPin = 9; // White Led chain linked to Digital pin9
int blueLedPin = 10; // Blue Led chain linked to Digital pin10
int violetLedPin = 11; // violet led chain linked to digital pin 11

int blueFadeValue = 0;
int whiteFadeValue = 0;
int violetFadeValue = 0;

int userDefMaxWhite = 100; //0-100 user defines the max intensity of the leds
int userDefMaxBlue = 100; //0-100 user defines the max intensity of the leds
int userDefMaxViolet = 100; // 0-100 user defines the max intensity of the leds
int fadeMaxWhite; //variable used when converthing userDefMaxWhite into a PWM value
int fadeMaxBlue; //variable used when converthing userDefMaxBlue into a PWM value
int fadeMaxViolet; //variable used when converting userdefmax into  PWM Value

int hour;//variable used for the RTC timed event.
int minute;//variable used for the RTC timed event.

int counter = 0;//counter for PWN

void setup(){
  Serial.begin(9600); //not needed in end product
  rtcStart();
}





void loop(){
  debug(); //not needed in end product
  maxCalc();
  ledFade();
  rtcCatch();  
}

void ledFade(){  
  if(counter < 60){
    counter++;
    }
  else{
    
    if(whiteFadeOn == 1){
      if(whiteFadeValue <= fadeMaxWhite) {
        analogWrite(whiteLedPin, whiteFadeValue);      
        whiteFadeValue = whiteFadeValue+4; // 255/4 = 63.75 i.e. 0-100% takes 63.75 minutes roughly to complete if it takes 1 minutes to complete 1 cycle.
      }

  }
  
    
    if(violetFadeOn == 1){
      if(violetFadeValue <= fadeMaxViolet) {
        analogWrite(violetLedPin, violetFadeValue);      
        violetFadeValue = violetFadeValue+4; // 255/4 = 63.75 i.e. 0-100% takes 63.75 minutes roughly to complete if it takes 1 minutes to complete 1 cycle.
      }


    }

    if(blueFadeOn == 1){
      if(blueFadeValue <= fadeMaxBlue) {
        analogWrite(blueLedPin, blueFadeValue);      
        blueFadeValue = blueFadeValue+4;
     }
    }  
  
    if(blueFadeOff == 1){
      if(blueFadeValue >= 0) {
        analogWrite(blueLedPin, blueFadeValue);      
        blueFadeValue = blueFadeValue-4;
      }
    }
  
    if(whiteFadeOff == 1){
      if(whiteFadeValue >= 0) {
        analogWrite(whiteLedPin, whiteFadeValue);      
        whiteFadeValue = whiteFadeValue-4;
     }

  }
  
    if(violetFadeOff == 1){
      if(violetFadeValue >= 0) {
        analogWrite(violetLedPin, violetFadeValue);      
        violetFadeValue = violetFadeValue-4;
     }


   }
   counter =0;
}
}








void maxCalc(){
  fadeMaxWhite = userDefMaxWhite*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
  fadeMaxBlue = userDefMaxBlue*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
  fadeMaxViolet = userDefMaxViolet*2.55;//converts user defined percentage (0-100) into a PWM value (0-255)
}

void rtcCatch(){
  hour = RTC.get(DS1307_HR,false);
  minute = RTC.get(DS1307_MIN,false);
  
  if((hour == smiley-cool&&(minute == 30)){//sets blue on for 08.30
    blueFadeOn = 1;  
  }
  
  if((hour ==10)&&(minute == 30)){//sets white on for 10.30
    whiteFadeOn = 1;  
  }

  if((hour == 21)&&(minute == 00)){//sets violet on  for 21.00
    violetFadeOn = 1;  
  }
  
  
  if((hour ==20)&&(minute == 0)){//sets for 20:00
    whiteFadeOff = 1;  
  }
  
  if((hour ==10)&&(minute == 0)){//sets for 10:00
    violetFadeOff = 1;  
  }

  if((hour ==21)&&(minute == 00)){//sets for 21:00
    blueFadeOff = 1;  
  }
}

void debug(){ //not needed in end product
  Serial.print(RTC.get(DS1307_HR,true)); Serial.print(":"); Serial.print(RTC.get(DS1307_MIN,false));Serial.print(":");Serial.print(RTC.get(DS1307_SEC,false));
  Serial.print("      Counter:");    
  Serial.print(counter);
  Serial.print("      ");
  Serial.print(RTC.get(DS1307_DATE,false));Serial.print("/"); Serial.print(RTC.get(DS1307_MTH,false));Serial.print("/");Serial.print(RTC.get(DS1307_YR,false));Serial.print(" "); Serial.print(RTC.get(DS1307_DOW,false));
  
  Serial.print(" Blue LED state:");Serial.print(blueFadeOn);Serial.print(blueFadeOff);Serial.print("   PWM Value:");Serial.print(blueFadeValue);
  Serial.print("      ");
  
  Serial.print("White LED state:");Serial.print(whiteFadeOn);Serial.print(whiteFadeOff);Serial.print("   PWM Value");Serial.print(whiteFadeValue);
  Serial.print("      ");
  
  Serial.print("Violet LED state:");Serial.print(violetFadeOn);Serial.print(violetFadeOff);Serial.print("   PWM Value");Serial.print(violetFadeValue);
  Serial.println();
  delay(1000);
}

void rtcStart(){
  RTC.stop();
  RTC.set(DS1307_SEC,00);        //set the seconds
  RTC.set(DS1307_MIN,34);     //set the minutes
  RTC.set(DS1307_HR,9);       //set the hours
  RTC.set(DS1307_DOW,06);       //set the day of the week
  RTC.set(DS1307_DATE,12);       //set the date
  RTC.set(DS1307_MTH,02);        //set the month
  RTC.set(DS1307_YR,11);         //set the year
  RTC.start();  
}

 



15  Using Arduino / Programming Questions / Re: rtc errors on: February 11, 2011, 12:26:36 pm
Is there any easy software you can use for setting up lcd displays for the arduino or even for writing the code ?
Pages: [1] 2 3 4