/********* 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 NOT compiled for: Arduino Pro Mini 3.3V
	- Source Code created on: 2024-10-01 20:33:15

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* read and provide pot value via wifi */
/****** END SYSTEM REQUIREMENTS *****/


/********* User code review feedback **********
#### Feedback 1 ####
- change key.h in key2.h
********* User code review feedback **********/

/****** DEFINITION OF LIBRARIES *****/
#include <SPI.h>  // Include SPI library for communication with the WiFi module
#include "wifi_connection.h"  // Include the WiFi connection header
#include "potentiometer_reader.h"  // Include the potentiometer reader header

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);

void setup(void)
{
    // Initialize serial communication
    Serial.begin(115200);
    
    // Connect to WiFi using credentials
    connectToWiFi();  // Call the function to connect to WiFi
    
    // Set up the potentiometer
    setupPotentiometer();  // Call the function to set up the potentiometer
}

void loop(void)
{
    // Read the potentiometer value
    int potValue = readPotentiometer();  // Read the analog value from the potentiometer
    
    // Print the potentiometer value to the serial monitor
    Serial.print("Potentiometer Value: ");
    Serial.println(potValue);
    
    // Add a small delay to avoid flooding the serial output
    delay(1000);  // Delay for 1 second
}
