| Arduino Forum ::  Members :: JeffCoalfax
 Show Posts Pages: [1] 2
 1 Using Arduino / Project Guidance / Re: cycling 4 LEDs at varrying speeds on: October 10, 2012, 07:32:35 am Thank you sir, It sounds like it's exactly what I'm looking for. I will have to load it this evening to play with it. Jeff
 2 Using Arduino / Project Guidance / Re: cycling 4 LEDs at varrying speeds on: October 09, 2012, 08:37:12 pm Yeah, it looks like I'm going to have to take a few steps back and get on the same page as everyone. I'm no where near where everyone expects me to be. All the advice that is given to me flies way over my head. I'm totally missing what apparently is staring me right in the face with this "blink without delay" sketchI know that everyone that reads this is asking themselves, "Is he really that dense?" well the answer is emphatically yesPlease bear with me...
 3 Using Arduino / Project Guidance / Re: cycling 4 LEDs at varrying speeds on: October 09, 2012, 07:22:06 pm QuoteCan you clarify please?4 LEDs. What do you mean by "cycle"? One and then the next, and so on? So only one is one at once? Or all flashing together? Or one on, then two on, then three on, and then four on?One right after the other: STEP1 led1 on, STEP2 led1 off (same time) led2 on, STEP3 led2 off (same time) led3 on, STEP4 led3 off (same time) led4 on, STEP5 led4 off (same time) led1 on etc.QuoteQuote... and have it increase speed not by cycle completion but by time ...What does that mean?The current code increases the speed of the LEDs after every cycle (I define a cycle as when all 4 LEDs have lit up once) by 20 milliseconds Code:// lower the delay if timer >= 20                   from 700 millisecondsCode:int timer = 700;                                                    to the targeted 20 millisecondsCode:if (timer >= 20) {      timer = timer - 1;    }This code works well for the slower cycles but once the cycles start to speed up the rate at which 20 is subtracted becomes really quick it cascades to 20 rather quickly.Quote700 what? You mean 700 Hz? You wouldn't spot anything much over 25 Hz cycle.I believe it's set in ms.QuoteInputted how? Keyboard? Knob? Serial port?imbedded in the codeCode:if (timer >= 20) {      timer = timer - 1;    }
 4 Using Arduino / Project Guidance / Re: cycling 4 LEDs at varrying speeds on: October 09, 2012, 12:53:46 pm Quoteyou don't know how to formulate your requirements in a form that someone else could implement themYou're probably right because I'm not sure what this means. Tell me if I'm way off when I say, "I want to take this current code that cycles 4 LEDs at a rate that increases as each cycle is completed by what ever value that's inputted and have it increase speed not by cycle completion but by time. For example: it starts at 700 and every second that passes it reduces by a factor of 20, in 5 seconds, it will reduce to 600 and so on, until it reaches a target value which in this case is 20.Code:int timer = 700;           // The higher the number, the slower the timing.void setup() {  // use a for loop to initialize each pin as an output:  for (int thisPin = 2; thisPin < 6; thisPin++)  {    pinMode(thisPin, OUTPUT);        }}void loop() {  // loop from the lowest pin to the highest:  for (int thisPin = 2; thisPin < 6; thisPin++) {    // turn the pin on:    digitalWrite(thisPin, HIGH);      delay(timer);                      // lower the delay if timer >= 20           if (timer >= 20) {      timer = timer - 1;    }    // turn the pin off:    digitalWrite(thisPin, LOW);      }}Now I know you want me to intruduce millis() and remove delay()So here's what I know about delay(), when it's read it stops all other function until the task is complete. And I know that Millis allows other functions to take place at the same the same time other tasks are being completed. Which will be perfect to allow a counter to run while the LEDs cycle.Let me also throw out a disclamer that this isn't for any school project, nor is it a project that is going to financially benifit me. It is just me trying to have fun with the Arduino. and as you can tell at this point i'm not having much fun. but dispite the rhetoric I'm learning quite a bit.Jeff
 5 Using Arduino / Project Guidance / Re: cycling 4 LEDs at varrying speeds on: October 09, 2012, 08:06:59 am come on,  really?