Advertisement
pleasedontcode

Ultrasonic Update rev_01

May 14th, 2024
739
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: Ultrasonic Update
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-05-14 11:09:23
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* An Arduino Uno is programmed to accept inputs from */
  21.     /* sensors, process the data and produce an output */
  22.     /* that is sent to the output devices in form of */
  23.     /* signals that in turn switch on or off the pump at */
  24.     /* threshold and maximum values defined. */
  25. /****** END SYSTEM REQUIREMENTS *****/
  26.  
  27. /****** DEFINITION OF LIBRARIES *****/
  28. #include <Ultrasonic.h> // https://github.com/ErickSimoes/Ultrasonic
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33. void updateOutputs(void);
  34.  
  35. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  36. const uint8_t ultrasonic_HC_SR04_Echo_PIN_D3 = 3;
  37.  
  38. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  39. const uint8_t ultrasonic_HC_SR04_Trigger_PIN_D2 = 2;
  40.  
  41. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  42. /***** used to store raw data *****/
  43. bool ultrasonic_HC_SR04_Trigger_PIN_D2_rawData = 0;
  44.  
  45. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  46. /***** used to store data after characteristic curve transformation *****/
  47. float ultrasonic_HC_SR04_Trigger_PIN_D2_phyData = 0.0;
  48.  
  49. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  50. Ultrasonic ultrasonic(ultrasonic_HC_SR04_Trigger_PIN_D2, ultrasonic_HC_SR04_Echo_PIN_D3);
  51.  
  52. void setup(void)
  53. {
  54.     // put your setup code here, to run once:
  55.     pinMode(ultrasonic_HC_SR04_Echo_PIN_D3, INPUT);
  56.     pinMode(ultrasonic_HC_SR04_Trigger_PIN_D2, OUTPUT);
  57. }
  58.  
  59. void loop(void)
  60. {
  61.     // put your main code here, to run repeatedly:
  62.     updateOutputs(); // Refresh output data
  63. }
  64.  
  65. void updateOutputs()
  66. {
  67.     digitalWrite(ultrasonic_HC_SR04_Trigger_PIN_D2, ultrasonic_HC_SR04_Trigger_PIN_D2_rawData);
  68. }
  69.  
  70. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement