controling 2 relays independantly


hi

i have managed after frustration double relay module work...hooray, cant find (and believe me ive looked days) regarding code create timed stop between relay1 & relay 2 -to allow motor come stop before rotating in opposite direction.

this code im using, works need insert (millis) break/stop

void setup(){
pinmode(11,output);
pinmode(12,output);
}

void loop(){
digitalwrite(11,low);                            // somehow need insert code make 5 second break between
digitalwrite(12,high);                             relay 1 , relay 2
delay(500);
digitalwrite(11,high);
digitalwrite(12,low);
delay(500);
}
this im trying achieve

relay 1 on 5 secs

then  break/stop

relay 2 start 5 secs after stop

then break/stop

the 2 relays must never on @ same time.

i trying turn motor 1 way, let stop,  then turn other way

as have said have managed both relays activated seems need split programme in half , add stop command

yes weve heard before can please throw me crumb of kindness , lend advice

many many in advance

something this?
code: [select]

const int relay1pin = 11;
const int relay2pin = 12;
const int relayon = high;
const int relayoff = low;

void setup() {
  digitalwrite(relay1pin,relayoff);
  pinmode(relay1pin,output);
  digitalwrite(relay2pin,relayoff);
  pinmode(relay2pin,output);
}

void loop() {
  // relay 1 on 5 seconds
  digitalwrite(relay1pin,relayon);
  delay(5000);

  //both relays off 5 seconds
  digitalwrite(relay1pin,relayoff);
  digitalwrite(relay2pin,relayoff);
  delay(5000);

  // relay 2 on 5 seconds
  digitalwrite(relay2pin,relayon);
  delay(5000);
 
  //both relays off 5 seconds
  digitalwrite(relay1pin,relayoff);
  digitalwrite(relay2pin,relayoff);
  delay(5000);
}


Arduino Forum > Using Arduino > Programming Questions > controling 2 relays independantly


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support