I'm fairly new to Arduino. I've been doing research the last few days for my problem and I'm not sure what else to do now.
I have an ESP-8266 that is connected to a 2 channel relay. It is this one:
I now I can already control the relay without changing the code, but there is some custom stuff I need to change (I want the relays to turn off after a certain amount of time). Since this is one of my first few Arduino projects, I tried to see if there was anything online similar to what I needed. I found some code that I think is pretty much what I need, minus the custom part for me. This certain relay turns on and off after receiving a Hex command.
I used a usb to ttl adapter with the GPIO-0 and Gnd pins connected so I can program the ESP-8266. The Arduino sketch appears to have uploaded succesfully to the ESP-8266. When I go to the IP address of the device on a web browser, it says "Relay is now off".
According to the code, I just need to put /1/on after the IP address for the relay to turn on. When I do this, the web page continuously spins forever and the relay doesn't come on.
Is there any obvious mistakes I'm making? Or is there a simpler solution to what I'm doing?
You are asking us to look on another web site for your code. Please post YOUR code (not the code you based your code on) here, in code tags, according to the instructions above.
I suggest you learn the basics first then you will understand the code you are trying to modify. There are plenty of examples in the Arduino IDE and on this web site.
I now I can already control the relay without changing the code, but there is some custom stuff I need to change (I want the relays to turn off after a certain amount of time). Since this is one of my first few Arduino projects, I tried to see if there was anything online similar to what I needed. I found some code that I think is pretty much what I need, minus the custom part for me. This certain relay turns on and off after receiving a Hex command.
I used a usb to ttl adapter with the GPIO-0 and Gnd pins connected so I can program the ESP-8266. The Arduino sketch appears to have uploaded succesfully to the ESP-8266. When I go to the IP address of the device on a web browser, it says "Relay is now off".
According to the code, I just need to put /1/on after the IP address for the relay to turn on. When I do this, the web page continuously spins forever and the relay doesn't come on.
Is there any obvious mistakes I'm making? Or is there a simpler solution to what I'm doing?
That module is not documented very well.
Lots of problems with people using it.
Forget about that module.
The module seems to be grossly over-complex for the purpose! Apparently it has a second microcontroller which seems quite superfluous as the ESP-01 has enough I/O pins to control two relays easily.
Using two microcontrollers for a task always means that part of the code and resources for each is occupied simply by the
task of communicating with the other - a situation best avoided.