/********* 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: Smart_parking
- Source Code compiled for: Arduino Nano
- Source Code created on: 2023-11-11 02:21:31
- Source Code generated by: Umesh Kumar
********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** SYSTEM REQUIREMENT 1 *****/
/* No of 5 car parking in slot if one out and one add */
const int MAX_PARKING_SLOTS = 5;
int availableParkingSlots = MAX_PARKING_SLOTS;
/****** SYSTEM REQUIREMENT 2 *****/
/* No of 5 car parking in slot if one out and one add */
const int MAX_CARS_ALLOWED = 5;
int currentCarsCount = 0;
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void addCar();
void removeCar();
/***** DEFINITION OF PWM OUTPUT PINS *****/
const uint8_t Gate_open_Servomotor_PWMSignal_PIN_D3 = 3;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
Servo myservo;
void setup(void)
{
// put your setup code here, to run once:
pinMode(Gate_open_Servomotor_PWMSignal_PIN_D3, OUTPUT);
// Attach the servo motor to the PWM pin
myservo.attach(Gate_open_Servomotor_PWMSignal_PIN_D3);
}
void loop(void)
{
// put your main code here, to run repeatedly:
}
void addCar()
{
if (currentCarsCount < MAX_CARS_ALLOWED && availableParkingSlots > 0)
{
currentCarsCount++;
availableParkingSlots--;
// Perform necessary actions for adding a car
}
}
void removeCar()
{
if (currentCarsCount > 0)
{
currentCarsCount--;
availableParkingSlots++;
// Perform necessary actions for removing a car
}
}