I am currently working my way through the Web Server course and have progressed to Project 2.2 Web Server Control Multiple Outputs (Toggle Switches). The project is working fine using the suggested 4 LEDs.
I am making some relatively minor modifications to the project to drive 4 relays. The relay module requires an active-LOW signal to turn the relays ON as opposed to an active-HIGH signal to illuminate the LEDs in the original version of the project. I seem to have figured out how obtain that active-LOW signal when I click the toggle switches appropriately, but the initial conditions are not to my liking.
When the ESP32 is first powered-up, all of the relays start in the active-LOW state which turns them ON. I would like to start with all relays active-HIGH or OFF. Also, I would like all relays to start in the OFF state when the client makes its first request to the server.
I am still in the process of trying to understand the software as presented in the course version of this project and would appreciate some hints on how I might implement modifications to the code to realize the circuit operation as described above.
Thanks in advance!
Ed Wilson
Sara,
I was able to set the relays to the OFF position upon power-up by inserting four digitalWrite (pin, HIGH); statements in the setup function part of main.cpp. I assume that I was able to do this since the cpp program had an #include <Arduino.h> header. Upon further reflection I decided that I did not want to reset all relays to the off position when I get a request from the client.
I guess that I have solved my problem, but not with the most “elegant” approach. You may mark this question as resolved…thanks.
Ed Wilson