/********* 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-09-28 12:21:33
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* read and provide pot value via wifi */
/****** END SYSTEM REQUIREMENTS *****/
/********* User code review feedback **********
#### Feedback 1 ####
- rename header keys.h in key1.h
********* User code review feedback **********/
/****** DEFINITION OF LIBRARIES *****/
#include // Include SPI library for communication with the WiFi module
#include // Include WiFi library for WiFi functionality
#include "key1.h" // Include the key1.h file for WiFi credentials
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF ANALOG INPUT PINS *****/
const uint8_t pot_Potentiometer_Vout_PIN_A0 = A0; // Define the analog pin for the potentiometer
/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
const char* ssid = WIFI_SSID; // WiFi SSID from key1.h
const char* password = WIFI_PASSWORD; // WiFi Password from key1.h
void setup(void)
{
// Initialize serial communication
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, password);
Serial.println("Connecting to WiFi...");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}
Serial.println("Connected to WiFi");
// Set the potentiometer pin as input
pinMode(pot_Potentiometer_Vout_PIN_A0, INPUT);
}
void loop(void)
{
// Read the potentiometer value
int potValue = analogRead(pot_Potentiometer_Vout_PIN_A0); // 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
}