/********* 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 Potentiometer - Source Code compiled for: Arduino Pro Mini 3.3V - Source Code created on: 2024-10-01 21:15:06 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* read and provide pot value via wifi */ /****** SYSTEM REQUIREMENT 2 *****/ /* if main code is too long so split code in other */ /* files. */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include "WiFiConfig.h" #include "PotentiometerReader.h" /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF ANALOG INPUT PINS *****/ const uint8_t pot_Potentiometer_Vout_PIN_A0 = A0; // WiFi connection status variable bool wifiConnected = false; void setup(void) { // Initialize serial communication for debugging Serial.begin(115200); // Connect to WiFi WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi..."); } Serial.println("Connected to WiFi"); wifiConnected = true; // Update connection status // Set the potentiometer pin as input pinMode(pot_Potentiometer_Vout_PIN_A0, INPUT); } void loop(void) { // Check if WiFi is connected before reading the potentiometer if (wifiConnected) { // Read the potentiometer value int potValue = readPotentiometer(pot_Potentiometer_Vout_PIN_A0); // Print the potentiometer value to the serial monitor Serial.print("Potentiometer Value: "); Serial.println(potValue); // Delay for a short period before the next reading delay(1000); } } /* END CODE */