/********* 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: PotPWM
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2023-11-26 07:50:41
	- Source Code generated by: Mohd

********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include <Arduino.h>

/****** SYSTEM REQUIREMENT 1 *****/
  /* PWM varies with potentiometer */

/****** SYSTEM REQUIREMENT 2 *****/
  /* PWM varies with input potentiometer */

/****** SUBSYSTEM REQUIREMENTS *****/
  /* Subsystem Requirement 1: Read potentiometer value */
  /* Subsystem Requirement 2: Map potentiometer value to PWM range */
  /* Subsystem Requirement 3: Set PWM output value */

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

/***** DEFINITION OF ANALOG INPUT PINS *****/
const uint8_t Pot_Potentiometer_Vout_PIN_A0 = A0;

/***** DEFINITION OF PWM OUTPUT PIN *****/
const uint8_t PWM_Output_PIN_3 = 3;

void setup(void)
{
  // Set the potentiometer pin as input
  pinMode(Pot_Potentiometer_Vout_PIN_A0, INPUT);

  // Set the PWM output pin as output
  pinMode(PWM_Output_PIN_3, OUTPUT);
}

void loop(void)
{
  // Subsystem Requirement 1: Read the potentiometer value
  int potValue = analogRead(Pot_Potentiometer_Vout_PIN_A0);

  // Subsystem Requirement 2: Map the potentiometer value to the PWM range (0-255)
  int pwmValue = map(potValue, 0, 1023, 0, 255);

  // Subsystem Requirement 3: Set the PWM output value
  analogWrite(PWM_Output_PIN_3, pwmValue);
}
