/********* 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: Automated Pumping
- Source Code NOT compiled for: ESP32 DevKit V1
- Source Code created on: 2024-04-26 21:13:20
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* make a program that when the function is called 2 */
/* pumps activate start and stop at diferent times */
/* without using millis */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include //https://github.com/AndreaLombardo/L298N
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void activatePumps(void);
void updateOutputs(void);
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13 = 13;
const uint8_t pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14 = 14;
const uint8_t pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17 = 17;
const uint8_t pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18 = 18;
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13_rawData = 0;
bool pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14_rawData = 0;
bool pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17_rawData = 0;
bool pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13_phyData = 0.0;
float pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14_phyData = 0.0;
float pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17_phyData = 0.0;
float pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18_phyData = 0.0;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
L298NX2 motor(pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13, pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14, pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17, pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18);
void setup(void)
{
// put your setup code here, to run once:
pinMode(pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13, OUTPUT);
pinMode(pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14, OUTPUT);
pinMode(pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17, OUTPUT);
pinMode(pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18, OUTPUT);
}
void loop(void)
{
// put your main code here, to run repeatedly:
activatePumps(); // Activate pumps
}
void activatePumps()
{
// Activate pumps at different times
pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13_rawData = 1;
updateOutputs();
delay(1000); // Delay for 1 second
pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13_rawData = 0;
pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14_rawData = 1;
updateOutputs();
delay(1000); // Delay for 1 second
pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14_rawData = 0;
}
void updateOutputs()
{
digitalWrite(pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13, pump12_L298NDualFull_BridgeMotorDriver_IN1_PIN_D13_rawData);
digitalWrite(pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14, pump12_L298NDualFull_BridgeMotorDriver_IN2_PIN_D14_rawData);
digitalWrite(pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17, pump12_L298NDualFull_BridgeMotorDriver_IN3_PIN_D17_rawData);
digitalWrite(pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18, pump12_L298NDualFull_BridgeMotorDriver_IN4_PIN_D18_rawData);
}
/* END CODE */