pleasedontcode

Automated Parking rev_01

Mar 22nd, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Automated Parking
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2024-03-22 06:01:02
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* automated parking system with 4 ir and servo. With */
  21.     /* three parking slots and the gate will open if */
  22.     /* there is any parking slot is left */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Wire.h>
  27. #include <Servo.h>
  28. #include <Adafruit_MLX90614.h>
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33. void updateOutputs(void);
  34.  
  35. /***** DEFINITION OF PWM OUTPUT PINS *****/
  36. const uint8_t servoPin = 3;
  37.  
  38. /***** DEFINITION OF I2C PINS *****/
  39. const uint8_t i2cPinSDA = A4;
  40. const uint8_t i2cPinSCL = A5;
  41. const uint8_t i2cSlaveAddress = 90;
  42.  
  43. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  44. /***** used to store raw data *****/
  45. uint8_t servoRawData = 0;
  46.  
  47. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  48. /***** used to store data after characteristic curve transformation *****/
  49. float servoPhysicalData = 0.0;
  50.  
  51. /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
  52. Servo servoMotor;
  53. Adafruit_MLX90614 mlx;
  54.  
  55. void setup(void)
  56. {
  57.     // put your setup code here, to run once:
  58.     pinMode(servoPin, OUTPUT);
  59.     servoMotor.attach(servoPin);
  60.  
  61.     Wire.begin();
  62.     mlx.begin(i2cSlaveAddress);
  63.  
  64.     // Add your code for the automated parking system here
  65. }
  66.  
  67. void loop(void)
  68. {
  69.     // put your main code here, to run repeatedly:
  70.  
  71.     updateOutputs(); // Refresh output data
  72.  
  73.     // Add your code for the automated parking system here
  74. }
  75.  
  76. void updateOutputs()
  77. {
  78.     servoMotor.write(servoRawData);
  79. }
  80.  
  81. /****** SYSTEM REQUIREMENTS *****/
  82. /****** SYSTEM REQUIREMENT 1 *****/
  83.     /* Automated parking system with 4 IR sensors and a servo */
  84.     /* Three parking slots */
  85.     /* The gate will open if there is any parking slot left */
  86. /****** END SYSTEM REQUIREMENTS *****/
  87.  
Add Comment
Please, Sign In to add comment