ULN2003a use with delay..what happens?

Hello fellas...
I was wondering if anyone can tell me what happens or better yet if it is even possible to do something like this while using a ULN2003a mosfet:
Say i have two devices (lets say 2 LEDs for example) and i write a code that turns on LED1, delays 1s, turns LED1 off and then turns on LED2 and does the same.
If i just write something like:

void loop ()
{
digitalWrite(Uln_1, HIGH);
delay (1000);
digitalWrite(Uln_1, LOW);
delay (3000);
digitalWrite(Uln_2, HIGH);
delay (2000);
digitalWrite(Uln_2, LOW);
delay (2000);

Will this work like i have described or will they both turn on same time and LED2 just lasts a second longer?
And one more question, what happens if i used lets say "delay(10000)" at the end of the loop?
Will both lights be off for 10s and then the process repeats or is this something that can not be done here?

The ULN2003A is a high-voltage, high-current Darlington transistor array not a MOSFET. The transistors are independent.

2 Likes

Get the Arduino IDE, get an Arduino board. Connect the ULN and LEDs, upload your program and watch what happens.

1 Like

The lines of code will execute in order, doing whatever they say, and taking however long they will.

That is the beauty of simple processors that can really only do one thing at a time.

So Uln_1 be high for one second, then go low. There will be a three second pause and Uln_2 will go high for two seconds and so forth.

If the code you did not post is correct.

Whether LEDs go on or off is up to the circuit you did not post.

a7

2 Likes

They will not turn on at the same time. The code will execute sequentially, one line after the other.

It would be like reading a script, and for each delay(xxx), counting 1-onethousand, 2-onethousand,... as appropriate between toggling these switches:

1 Like

Why do you bother other people if you can answer all your questions yourself? Run your code and come back with specific questions if the behavior does not match your expectations.

Did you ask ChatGPT to write the code for you?

2 Likes

Ditto..
Do you have the hardware?

Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.