Show Posts
Pages: [1]
1  Using Arduino / General Electronics / duracell power reserves to power Arduino on: May 29, 2012, 02:05:28 pm
would it be possible to power an Arduino with a duracell power reserves i have one of these and thought it will be a good idea has anyone done something like this?. it is for backing up USB devices with power heres a link
2  Using Arduino / Programming Questions / Re: Remembering button state on: May 26, 2012, 05:08:50 pm
thanks for the the input guys; GoForSmoke i understand what not to do with that write up now so am going to take a hit at millis to get rid of  the delays. but would i still need a delay so lager amount of code dose not pile up ? any tips on millis would help
3  Using Arduino / Programming Questions / Re: Remembering button state on: May 25, 2012, 08:44:48 pm
so to get my code  to work i need to do  major changes to get the button to remember the sate for the lights for a set time? & executing the loop. also by getting rid of a delay i can use "millis" is millis a built in timer ?
4  Using Arduino / Programming Questions / Re: Remembering button state on: May 25, 2012, 12:32:11 pm
seems to be not working i forgot to mention i am trying to simulate a stop light so when i press the button the light delays goes to yellow then red while at red the cross walk goes on . i think the traffic light is the best way to get started with programming  my code is below it works the way i want it to but i have to be holding down the button which also means that red will stay on as long the button is HIGH i would like it to go back into the loop after red light.

feed back on my code greatly appreciated


const int red = 5;                //red led is on pin 5
const int yellow = 4;          //yellow led on pin 4
const int green = 3;          //green led on pin 3
const int crosswalk = 6;   //crosswalk button on pin 6
int buttonState = 0;       // button state is LOW

void setup()


  pinMode(red, OUTPUT);     //pins red- green set as Outputs
  pinMode(yellow, OUTPUT); 
  pinMode(green, OUTPUT); 

  pinMode(crosswalk, INPUT);   //crosswalk button set as input device


void loop(){   
buttonState = digitalRead(crosswalk);

    if (buttonState == HIGH){ 
    digitalWrite(yellow, LOW);
    digitalWrite(red, HIGH);
    digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);    // set the LED on
  delay(8000);                     // wait for eight seconds
  digitalWrite(red, LOW);    // set the LED off
  delay(1000);                     // wait for a second
  digitalWrite(green, HIGH);   // set the LED on
  delay(5000);              // wait for 5 seconds
  digitalWrite(green, LOW);    // set the LED off
  digitalWrite(yellow, HIGH);    // set the LED on
  delay(3000);                          // wait for three seconds
  digitalWrite(yellow, LOW);    // set the LED off
5  Using Arduino / Programming Questions / Remembering button state on: May 24, 2012, 08:33:35 am
Hello i am new here but i have done  programming and some parallax in highschool  know in college everything is Arduino based.i was just wondering how can you get a button to input a state and remember the state when the the button is depressed then follow the procedure  and then go through with the loop if the button is not pressed
Pages: [1]