Why this code only actuates for the relay (pin 8) not for the Mosfet switch at pin 2. can you help me with the error.
int relayPin = 8;// set pin 8 for relay output
int injectorPin = 2;
void setup() {
pinMode(injectorPin, OUTPUT); // set pin 2 as injector
pinMode(relayPin, OUTPUT); // for relay
}
void loop() {
digitalWrite(injectorPin, HIGH); // turn on second light
delay(5); // wait for 3 milliseconds
digitalWrite(injectorPin, LOW); // turn off second light
delay(5000); // wait for 1 hr before starting again
// Turn the relay switch ON
digitalWrite(relayPin, HIGH);// set relay pin to HIGH
delay(90000);
I moved your topic to an appropriate forum category @sridharsahoo366.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
What are you using to power your project?
So the code works if the relay code is not included?
No, I want the relay to operate for 90 sec, then turn off...
then 5ms operation of injector.. I dont bother about turn off, i dont require continuous operation.
Thanks it worked. However, the injector actuates once the relay stops. Can we write such a way that injector will actuate while relay is on.
Just after 60 sec of relay, injector MOSFET will on.