Question about digital.write

If I have a digital pin and it is set to HIGH, if the program the next time though sets it to HIGH again, is there any “blip” where the pin cycles from HIGH to LOW and back to HIGH or something else other than staying at HIGH steadily?

Here is what is going on. I am switching a solid state relay (25A) and want it to power a 250W metal halide light. (fish tank) When it is running off of the relay, the light will sometimes flicker or die. Otherwise, there is no problem. I do think that some interference in the electricity can cause this.

The pin will stay high until you write it low.

Is this “solid state relay” you are using designed for AC or DC?

It looks like there may be interference from your solid state relay into the Arduino causing the Arduino to reset. You can test this theory by putting a piece of code in the setUp() routine to blink the on board LED. Then if you see it blinking and it coincides with your light flickering you have nailed the problem.
The it would be a matter of adding extra decoupling to eliminate this.

I think it was the Arduino not supplying power 100% of the time. I don’t think it was my code…but who knows. I think I have fixed the problem by placing a capacitor across the input of the SSR. That way a brief hiccup won’t turn the light off.

Feedback?

Ok, so it didn’t help. Funny thing is that if I use a 9V battery to run the SSR, no problems. I am wondering if there is a problem with the wires from the ardunio to the 8 SSR’s

That proves it is a decoupling problem.
See:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Mike – the OP mentioned that they’re running 8 SSRs off the Arduino. I wonder how much control current the SSRs are drawing – they could be drawing enough to drop the supply voltage far enough to cause strange behavior.

I think I found the problem…almost embarrassed to admit it, but here we go.

I was using CAT5 to power the SSRs. Yes, sending the +5v down the positive and negative of each pair and a separate ground. I was trying to minimize my wires. I have since rewired the SSRs with each pair going to their own SSR. Everything has been working fine since the switch.

So it looks like it was a coupling issue, I faintly remember something about two parallel wires with current messing with each other because of the electrical field. Live and learn.