/********* 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: Potentiometer Reader
- Source Code compiled for: Arduino Mega
- Source Code created on: 2024-10-30 22:22:47
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* read pot each second and print on serial. */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF ANALOG INPUT PINS *****/
const uint8_t pot_Potentiometer_Vout_PIN_A0 = A0;
// Variable to store the potentiometer value
int potValue = 0;
void setup(void)
{
// Initialize serial communication at 9600 bits per second
Serial.begin(9600);
// Set the potentiometer pin as an input
pinMode(pot_Potentiometer_Vout_PIN_A0, INPUT);
}
void loop(void)
{
// Read the potentiometer value from the analog pin
potValue = analogRead(pot_Potentiometer_Vout_PIN_A0);
// Print the potentiometer value to the serial monitor
Serial.println(potValue);
// Wait for 1 second before the next reading
delay(1000);
}
/* END CODE */