/********* 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: Motor Control
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2024-01-29 22:45:59

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

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* Activate the L298N Dual Full-Bridge Motor Driver */
	/* connected to pins D4, D5, and D3. Set IN1 and IN2 */
	/* to HIGH, EN1 to 50% duty cycle, for 3 seconds. */
/****** SYSTEM REQUIREMENT 2 *****/
	/* Refine the user description requirement by */
	/* including the functionality to stop the motor */
	/* connected to the L298N Dual Full-Bridge Motor */
	/* Driver after a duration of 6 seconds. */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include <L298N.h>    // Library for L298N motor driver

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
  /* Activate the L298N Dual Full-Bridge Motor Driver */
  /* connected to pins D4, D5, and D3. Set IN1 and IN2 */
  /* to HIGH, EN1 to 50% duty cycle, for 3 seconds. */
/****** SYSTEM REQUIREMENT 2 *****/
  /* Refine the user description requirement by */
  /* including the functionality to stop the motor */
  /* connected to the L298N Dual Full-Bridge Motor */
  /* Driver after a duration of 6 seconds. */
/****** END SYSTEM REQUIREMENTS *****/

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);   // Function to update the motor driver outputs

/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t driver_L298NDualFullBridgeMotorDriver_IN1_PIN_D4 = 4;
const uint8_t driver_L298NDualFullBridgeMotorDriver_IN2_PIN_D5 = 5;

/***** DEFINITION OF PWM OUTPUT PINS *****/
const uint8_t driver_L298NDualFullBridgeMotorDriver_EN1_PIN_D3 = 3;

/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
L298N motor(driver_L298NDualFullBridgeMotorDriver_EN1_PIN_D3, driver_L298NDualFullBridgeMotorDriver_IN1_PIN_D4, driver_L298NDualFullBridgeMotorDriver_IN2_PIN_D5);

void setup(void)
{
  // put your setup code here, to run once:

  pinMode(driver_L298NDualFullBridgeMotorDriver_IN1_PIN_D4, OUTPUT);
  pinMode(driver_L298NDualFullBridgeMotorDriver_IN2_PIN_D5, OUTPUT);
  pinMode(driver_L298NDualFullBridgeMotorDriver_EN1_PIN_D3, OUTPUT);

  // Activate the L298N Dual Full-Bridge Motor Driver
  digitalWrite(driver_L298NDualFullBridgeMotorDriver_IN1_PIN_D4, HIGH);
  digitalWrite(driver_L298NDualFullBridgeMotorDriver_IN2_PIN_D5, HIGH);
  analogWrite(driver_L298NDualFullBridgeMotorDriver_EN1_PIN_D3, 128);  // 50% duty cycle

  delay(3000);  // Wait for 3 seconds

  // Stop the motor after a duration of 6 seconds
  delay(3000);  // Wait for 3 seconds
  motor.stop();
}

void loop(void)
{
  // put your main code here, to run repeatedly:

  updateOutputs(); // Refresh output data
}

void updateOutputs()
{
  // Not required for this code example
}