all valves on and off at same time

hey I am trying to control 10 solenoid valves with arduino

I want them all to go on for (50) and off for (150) at the same time however when I lay it out like the blink LED they seem to run along they don't all on/off at the same time

any help?

Thanks

Yes post the code of what you have. There should be no delay() between any of the digitalWrite() commands.

I want them all to go on for (50) and off for (150) at the same time

How much current do they need?

Is every solenoid on a diffent pin or all on one pin?

hi

alright but then how do i get the valves to stay open for like 10/1000 and closed for 100/1000? also each valve is on a different pin.

I was wondering how do I make them all do this for 5 seconds then do say open for 50/1000 and closed for 200/1000 for 5 seconds?

alright but then how do i get the valves to stay open for like 10/1000 and closed for 100/1000?

You..need..to..post..YOUR..code.

(10? seconds? minutes? weeks?)

void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(1, OUTPUT); pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT);

}

void loop() { digitalWrite(1, HIGH); // set the LED on delay(10); digitalWrite(1, LOW); // set the LED off delay(100); // wait for a second

digitalWrite(2, HIGH); delay(10); // wait for a second digitalWrite(2, LOW); delay(100); digitalWrite(3, HIGH); // set the LED on delay(10); digitalWrite(3, LOW); // set the LED off delay(100); // wait for a second

digitalWrite(4, HIGH); delay(10); // wait for a second digitalWrite(4, LOW); delay(100);

digitalWrite(5, HIGH); // set the LED on delay(10); digitalWrite(5, LOW); // set the LED off delay(100); // wait for a second

digitalWrite(6, HIGH); delay(10); // wait for a second digitalWrite(6, LOW); delay(100); digitalWrite(7, HIGH); // set the LED on delay(10); digitalWrite(7, LOW); // set the LED off delay(100); // wait for a second

digitalWrite(8, HIGH); delay(10); // wait for a second digitalWrite(8, LOW); delay(100); digitalWrite(9, HIGH); // set the LED on delay(10); digitalWrite(9, LOW); // set the LED off delay(100); // wait for a second

digitalWrite(10, HIGH); delay(10); // wait for a second digitalWrite(10, LOW); delay(100); }

the valves are going on/ off so many times a seconds and I want it to then do that for 5 seconds then do another set of timings for another 5 seconds if that makes sense

ultimately this is what I want to achieve

turn solenoids 1 to 10 (open x amount second) (closed x amount second) at same time for 5 seconds

turn solenoids 1 to 10 (open x amount second) (closed x amount second) at same time for 5 seconds

turn solenoids 1 to 10 (open x amount second) (closed x amount second) at same time for 5 seconds

then control over the valves

so

valve 1 moves at goes from x speend up to x speed

valve 2 has a slight delay the goes from x speed to x speed

valve 3 has slight delay from valve 2 and goes from x speed to x speed

valve 4 has a slight delay from valve 3 and goes from x speed to x speed

valve 5 has slight delay from valve 4 and goes from x speed to x speed

valve 6 has slight delay from valve 5 and goes from x speed to x speed

valve 7 has slight delay from valve 6 and goes from x speed to x speed

valve 8 has slight delay from valve 7 and goes from x speed to x speed

valve 9 has slight delay from valve 7 and goes from x speed to x speed

valve 10 has slight delay from valve 9 and goes from x speed to x speed

all valves go for 3 seconds (blinking)

valve 5 moves at goes from x speed up to x speed

valve 6 moves at goes from x speed up to x speed

valve 4 moves at goes from x speed up to x speed

valve 7 moves at goes from x speed up to x speed

valve 3 moves at goes from x speed up to x speed

valve 8 moves at goes from x speed up to x speed

valve 2 moves at goes from x speed up to x speed

valve 9 moves at goes from x speed up to x speed

valve 1 moves at goes from x speed up to x speed

valve 10 moves at goes from x speed up to x speed

then whole thing goes back and repeats whole thing over and over and over

delay(100);              // wait for a second

sp. "// wait for one tenth of a second."

Is that your problem? You're a factor of ten out?

I think arrays would make your problem easier to express and understand.

yeas someone mentioned arrays but I don't really understand them (the thing with the timings is they're working in time to strobe lights so the actual time doesn't matter that can be tweaked I'm needing help the principle code so I can go in and change the timings later)

Basically i'm completely clueless when it comes to programming.

So how would the array thing work?

So how would the array thing work?

explained here - http://www.arduino.cc/en/Reference/Array

i don't understand that at all

i mean how do I apply that to what I want to do?

int solenoids[10] = { 1,2,3,4,5,6,7,8,9,10 };
int firstDelay[10] = { 10,10, 10, 10 ,10,10,10,10,10,10};
int secondDelay[10] = {1000,1000, 1000, 1000 ,1000,1000,1000,1000,1000,1000};

void setup()
{
  for (int i=0; i < 10; i++) pinMode(solenoids[i], OUTPUT);
}

void loop()
{
  for (int i=0; i< 10; i++)
  {  
    digitalWrite(solenoid[i], HIGH);   // set the LED on
    delay(firstDelay[i]);
    digitalWrite(solenoid[i], LOW);    // set the LED off
    delay(secondDelay[i]);             
  }
}

you have three arrays and the elements with the same index belong to each other,.

Does this make more sense?

hey,

thanks for getting back.

yea it kind of does make sense but what does for (int i=0; i < 10; i++) mean exactly?

http://arduino.cc/en/Reference/For

isn´t it better like this? without two ''delay'' arrays?

  {  
    digitalWrite(solenoid[i], HIGH);   // set the LED on
    delay(10);
    digitalWrite(solenoid[i], LOW);    // set the LED off
    delay(100);             
  }

tege88 Ctrl + T makes Your code more beautiful.. :)

delay(firstDelay*);* i is not defined outside the for loops .. :)