Show Posts
Pages: 1 2 [3]
31  Using Arduino / Programming Questions / Re: Best approach for changing PWM in certain time? on: July 02, 2011, 05:55:51 am
Ok I see, let me show the code I have now, so you can comment on that or send me to a better direction...

This are excerpts from the total code as I have lots of other functions than the ON/OFF/DIM for the leds.

Code:
on_led_increment =  255.0 / (((float)dur_on * 60) );


void loop()
{

  if (on_finished == 0 && sec_on_count == 0){
    sec_on_count = sec_count;
    sec_on_count = sec_count + ldur_on;
  }


if (on_finished == 0 && sec_count == sec_on_count && led_dim < 255) {

    sec_on_count += 1;

    if (led_dim < 255) {
      led_dim += (float)on_led_increment;
      for (led = led_dim - on_led_increment; led <= led_dim; led += 0.10){
        analogWrite(10, led);
      }
    }

    if (led_dim >= 255) {
      on_finished = 1;
      getCloudsSec();
    }
}

void SyncClock() {
  // create a military-time integer from RTC values
  mil_time = (hours * 100) + minutes;
  sec_count = hours * 60;
  sec_count *= 60;
  sec_count += (minutes * 60);
  sec_count += seconds;
}
32  Using Arduino / Programming Questions / Re: Best approach for changing PWM in certain time? on: July 02, 2011, 05:27:08 am
Hi, thanks for your reply PaulS, when I said timer I meant to say that my machine is as sort of a clock to turn ON/OFF leds, so the user specifies X time and Y duration for the on, the machine at that time starts increasing PWM values from 0 to 255 divided by the Y duration specified, them the leds stay on until reach the time specifyd for OFF and do the oposit, witch is decreasing the PWM from 255 to 0 in another duration specifyed for OFF cycle.

Hope you understand now what I'm doing?

My main problem for now is trying to avoid float vars, since I have this already running with floats.

I take the duration value, convert it to seconds, them divide 255 for those seconds and I get the increment.
Using mils() everytime reach my next changing second I increase the PWM, I think is mor or less like you are saying... but how to take the float vars out so I can save as much memory space as possible?
33  Using Arduino / Programming Questions / Best approach for changing PWM in certain time? on: July 02, 2011, 04:58:13 am
Hi, I'm creating a sort of timer for turn/DIM leds.
On this timer I can specify the duration I want that the leds take from 0 to 255 (PWM value), so to speak from off (0%) to full bright (100%).

So whats the best approach to do this and have always a smooth incresed brightness, taking in consideration that the user can setup a diferent duration time from 1 minute to 120 minutes to do the 0 to 100% DIM variation?

Thanks.
34  Forum 2005-2010 (read only) / Development / Re: Imcompatible LiquidCrystal.h & DS1307 librarys on: November 21, 2009, 05:31:37 am
Solution for now is using only Wire.h library and not the RTC DS1307.h one and talk to RTC manually like this for example:

  Wire.begin();
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0);
  Wire.send(0x00);
  ..................................

But I hope soon anyone can find out a solution for using back the DS1307.h lib as is much easier with the commands.

If anyone wants to see the error/bug I'm talking about, just need to load the FADE example from Arduino IDE, change the led pin var to D3 (pin3) and even not having an LCD shield or RTC load this as I mention on previous post:

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

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

You going to realize that the led doesn't do nothing, or my Arduino is totally crazy and is the only one with this behavior...


 :o
35  Forum 2005-2010 (read only) / Development / Imcompatible LiquidCrystal.h & DS1307 librarys on: November 19, 2009, 11:53:37 am
Hi, just one problem I'm facing with.

My sketch starts like this:

.........................................
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h> // OPTION 1
#include <LiquidCrystal.h> // OPTION 2

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // OPTION 2
.........................................

My problem is stopping having PWM on pin 3, only works if I either comment option 1 or both 2.

Can anyone confirm that problem? Is there a workaround?

I'm using Arduino Duemilanove + Sparkfun RTC + LCD Keypad Shield from DFROBOT.

Thanks.
36  Forum 2005-2010 (read only) / Development / Re: Help - New project using Arduino mini Pro on: October 09, 2010, 08:42:15 pm
It's 17mm tactile switch bought from ebay, search for: "tactile switch 6x6x17" and you will find them.
37  Forum 2005-2010 (read only) / Development / Help - New project using Arduino mini Pro on: October 09, 2010, 05:33:15 am
 HI, I created a PCB for a new project using the Arduino mini Pro board, my question is:
should I use header pins to solder the Arduino board on my PCB or I can directly solder toghter (Arduino board straight on top of my PCB) just putting a drop of solder in each hole.

I have an LCD on top with just the distance of female and male headers so the lower I manage to have the Arduino better so it can't toutch for shure the back of LCD.

Here is a photo with a Arduino using header pins:




Thanks.
38  Forum 2005-2010 (read only) / Interfacing / Re: I'm Confused DS1307 & LCD on: December 06, 2009, 12:51:32 am
Hi, had the same problem and solve using the wire.h library to talk directly to DS1307 chip as I reported on this topic:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258649617

Anyway apart managed to solve the comunications problems, I still have once up a while some strange /garbage caracteres in the LCD.

Going to try the power capacitator solution to see if it helps since the modified .cpp version didn't help and I can't use the LCD4bit library since doesn't have a lot of functions I need to use on the LCD.
39  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: DFRobot LCD shield on: November 22, 2009, 01:42:36 pm
The problem is realy the pixels, as I said not doing anything on the Arduino pin 10 where acording to they schematic is the control of backlight, they have normal intensity and off course the trimmmer pot was regulated once and never again touched after.

But as soon and any analogWrite to that pin, the pixels stop having normal brightness, the only way to go back normal is cutting Arduino power and back on again.

EDIT: Sorry... problem solved !!! For some reason after using D10 pin for sending PWM to dim the LCD backlight I was facing that pixels low brightness problem, I just retune the contrast pot and now all his ok in any option.  :smiley
40  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: DFRobot LCD shield on: November 22, 2009, 11:23:20 am
@CaptainObvious

You missed my point or I didn't explained correctly.
My problem is not controling the LCD backlight, that I can do with:

analogWrite(backLight,value); // value from 0 to 255

puting 255 I get the same intensity on backlight led as when if I don't do nothing after power on Arduino.

The real problem is the intensity on the LCD digits/pixels witch after and if I used analogWrite with any value even sending 255 (maximum again I presume) I never got tha same intensity on them as after I power on Arduino and do nothing of analogWrite on backlight pin.
Conclusion if any analogWrite used on backlight led's control pin, pixels on lcd never became to have the same intensity, so anything is messing up that.

Anyway the backlight led's for the LCD RF-Robot shield are power by a transitor as you can see here on they schematic:

http://www.robotshop.us/content/PDF/dfrobot-lcd-keypad-shield-schematic.pdf


41  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: DFRobot LCD shield on: November 22, 2009, 07:20:54 am
I have one of this shields, and notice that pin 10 (not documented in the manual) is the backlight led controll, so if you send diferent values of PWM to that pin you can dim the backlight.


Althought I got a problem, if not sending anything to that the white dots from the display have normal intensity, but has soon you play with pin 10 PWM even sending 255 I never managed to got the same intensity.

Anyone face this problem or know a work around to get back the maximum intensity?
Pages: 1 2 [3]