Show Posts
Pages: 1 2 3 [4]
46  Using Arduino / Project Guidance / Re: Think...Think...Think... on: May 04, 2011, 12:30:07 pm
Hi Vishalapr,

How about a sensor or two, so it can react to the world?

e.g. light, sound, touch.

  Regards,
  Jim
47  Using Arduino / Project Guidance / Re: Sending a Pulse on: May 03, 2011, 03:16:15 pm
Hi Colaboy,

You can simplify your code like this:

Code:

  // Compare the buttonState to its previous state
  if (buttonState1 != lastButtonState1) {  // if the state has changed,
   
      digitalWrite(ledPin1, HIGH);  // Turn LED 1 on
      delay(250);                   // Wait quarter of a second
      digitalWrite(ledPin1, LOW);   // Turn LED 1 off

      lastButtonState1 = buttonState1;    // Save the current state of button 1 as the last state 1
  }
 

You had something like  if (X) do this, else do the same.

  Regards,
  Jim
Pages: 1 2 3 [4]