| Arduino Forum ::  Members :: Personman
 Show Posts Pages: [1] 2 3 ... 5
 1 Forum 2005-2010 (read only) / Troubleshooting / Re: Programming Question on: June 27, 2008, 02:55:33 pm Check out http:// http://todbot.com/blog/bionicarduino/There is a sketch for a RGB mood light where it cycles the intensity of each pin of the RGB led in a similar fashion to fade through different colors.  Perhaps you could modify this code to achieve your goal.That or i have no idea what you are atempting ;D.
 2 Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Playground Switch tutorial not clear on: August 08, 2008, 04:33:01 pm How about a 2 or more part tutorial via links.  Progressive learning is easy when there are links on where to go next to expand on the current topic.
 3 Forum 2005-2010 (read only) / Syntax & Programs / Re: Random max & min/max function C code on: November 12, 2009, 06:15:00 pm Correct.  I would like to make a function for future use.  So what I am really interested in is the code used in the the Arduino function or comparable code to write a similar function. I could always rewrite that example or the code inside the Arduino function each time but I'm much to lazy for that.
 4 Forum 2005-2010 (read only) / Syntax & Programs / Re: Random max & min/max function C code on: November 12, 2009, 04:43:16 pm To generate a random number within a specified range.I saw this example online however I wanted to see the Arduino code version.  If it differs I would prefer to use it as opposed to what I found.Code://generates a psuedo-random integer between 0 and max int randint(int max) {     return int(max*rand()/(RAND_MAX+1.0)); } //generates a psuedo-random integer between min and max int randint(int min, int max) {     if (min>max)     {         return max+int((min-max+1)*rand()/(RAND_MAX+1.0));     }     else     {         return min+int((max-min+1)*rand()/(RAND_MAX+1.0));     } }
 5 Forum 2005-2010 (read only) / Syntax & Programs / Re: Random max & min/max function C code on: November 12, 2009, 01:00:36 pm @ programmerI am aware of that however their is no, at least no std, max or min/max functionally.  But thanks for the heads up.@AlphaBetaThanks
 6 Forum 2005-2010 (read only) / Syntax & Programs / Random max & min/max function C code on: November 11, 2009, 04:58:30 pm Hello,Would someone be able to point me to where I could find the C code used for the random max and random min/max functions.  I would like to port them to an ATtiny project I am working on among other things.  I've found various versions online however I've never had any issues using this function so If I could continue to use it that would be great.  Thanks
 7 Forum 2005-2010 (read only) / Syntax & Programs / Re: Interrupts, 2 questions on: October 10, 2008, 02:59:50 pm QuoteCan any pin on arduino be used with interrupts, and can I have several of them?You can use digital pins 2 or 3 for interrupts see this page,  http://arduino.cc/en/Reference/AttachInterruptQuoteIf the interrupt interrupts a main loop, after execution the function does it get back to the next command of the loop before interrupting or to beginning of the loop?In my experience to the next command in the loop, and I think the interrupt should always interrupt the main loop.  Thats the only code running, nothing else need interruption .  Someone correct me if I am wrong.
 8 Forum 2005-2010 (read only) / Syntax & Programs / Re: Interrupt question on: September 08, 2008, 03:57:37 pm Done! At lease with the frame of the sketch.  I added "if (Mode != 2) break;" to each for statement, adjusting the 2 to whatever the # Mode it was in obviously.Code:  if (Mode == 2) {    reset();    for (int greenVal=0; greenVal<=255; greenVal++) {      analogWrite(greenLedPin, greenVal);      if (Mode != 2) break;      delay(10);    }    for (int greenVal=255; greenVal>=0; greenVal--) {      analogWrite(greenLedPin, greenVal);      if (Mode != 2) break;      delay(10);    } That seems to have done the trick.  Ironic how after reading you advice the next chapter in my C book explained continue, break, and switch case.In any case thanks again.