Go Down

Topic: Trying to control relay with Arduino Yun....(PLEASE HELP ME!!!!!!)  (Read 4056 times) previous topic - next topic


Hi guys :)
As I mentioned in title, I'm trying to control relay with my arduino yun(and my own webpage.)
I'm just getting everything right but my relay won't work right.  :o  :o
I wrote the code bellow which I'm having trouble with.

Code: [Select]
HttpClient client_2;
        int c = client_2.read();
        int k = c-48;
        if (client_2.available()){

I first wrote the code with "char c" instead of "int c" but it did not work.
So I changed them into "int" type. In the Serial moniter, I'm getting
which means the code is working great! However, my relay won't turn on....
It would be great to know the problem. Please help me!


Thats only partial code.

If you want anyone to take a better look at it then please post the WHOLE sketch along with a schematic (even hand drawn will do).

Some relays take a little more current than some boards can supply and may need an external supply but with a common ground to the Arduino.

I have a few relays and relay modules a couple of which will not work on the MKR and 101 series boards as the output is just not quite enough yet a very similar relay modules work great on everything else.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.


I'll second bob: post the full sketch and schematic.

It could be a wiring error, a design flaw in the way it's hooked up, or a problem in the sketch. Bob hit on a few potential electrical issues, and here's a potential problem in the sketch: did you perform a pinmode() call to set relay pin to be an output?

Go Up