Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: WiFi Monitor
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-03-19 09:04:06
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* using esp32 control 12 relay via esprainmaker code */
- /* and get live feed back from the 12 manual switch */
- /* show in the esprainmaker */
- /****** END SYSTEM REQUIREMENTS *****/
- /********* User code review feedback **********
- #### Feedback 1 ####
- - using esp32 control 12 relay via esprainmaker code and get live
- feed back from the 12 manual switch show in the esprainmaker
- ********* User code review feedback **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <WiFi.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t relay_PIN_D4 = 4;
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(relay_PIN_D4, INPUT_PULLUP);
- // Connect to WiFi network
- WiFi.begin("your_SSID", "your_PASSWORD");
- // Wait for connection
- while (WiFi.status() != WL_CONNECTED)
- {
- delay(1000);
- Serial.println("Connecting to WiFi...");
- }
- // Print ESP32 Local IP Address
- Serial.begin(115200);
- Serial.println();
- Serial.print("Connected to WiFi. IP Address: ");
- Serial.println(WiFi.localIP());
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Read the state of the relay_PIN_D4
- int relayState = digitalRead(relay_PIN_D4);
- // Print the relay state on the Serial Monitor
- Serial.print("Relay State: ");
- Serial.println(relayState);
- delay(1000); // Wait for 1 second before reading again
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement