Advertisement
pleasedontcode

"Digital Output" rev_01

Apr 20th, 2024
50
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: "Digital Output"
  13.     - Source Code compiled for: Arduino Nano
  14.     - Source Code created on: 2024-04-20 05:44:23
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* 6 inputs turn on or off a relay on the outputs */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24.  
  25. /******************************************************************************/
  26.  
  27. /****** SYSTEM REQUIREMENTS *****/
  28. /************ SYSTEM REQUIREMENT 1 ************/
  29. /* 6 inputs turn on or off a relay on the outputs */
  30. /***********************************************/
  31.  
  32. /****** FUNCTION PROTOTYPES *****/
  33. void setup(void);
  34. void loop(void);
  35. void updateOutputs(void);
  36.  
  37. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  38. const uint8_t r1_PIN_D3 = 3;
  39. const uint8_t r2_PIN_D4 = 4;
  40. const uint8_t r3_PIN_D5 = 5;
  41. const uint8_t r4_PIN_D6 = 6;
  42. const uint8_t r5_PIN_D7 = 7;
  43.  
  44. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  45. /***** used to store raw data *****/
  46. bool r1_PIN_D3_rawData = 0;
  47. bool r2_PIN_D4_rawData = 0;
  48. bool r3_PIN_D5_rawData = 0;
  49. bool r4_PIN_D6_rawData = 0;
  50. bool r5_PIN_D7_rawData = 0;
  51.  
  52. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  53. /***** used to store data after characteristic curve transformation *****/
  54. float r1_PIN_D3_phyData = 0.0;
  55. float r2_PIN_D4_phyData = 0.0;
  56. float r3_PIN_D5_phyData = 0.0;
  57. float r4_PIN_D6_phyData = 0.0;
  58. float r5_PIN_D7_phyData = 0.0;
  59.  
  60. void setup(void)
  61. {
  62.   // put your setup code here, to run once:
  63.  
  64.   pinMode(r1_PIN_D3, OUTPUT);
  65.   pinMode(r2_PIN_D4, OUTPUT);
  66.   pinMode(r3_PIN_D5, OUTPUT);
  67.   pinMode(r4_PIN_D6, OUTPUT);
  68.   pinMode(r5_PIN_D7, OUTPUT);
  69. }
  70.  
  71. void loop(void)
  72. {
  73.   // put your main code here, to run repeatedly:
  74.  
  75.   updateOutputs(); // Refresh output data
  76. }
  77.  
  78. void updateOutputs(void)
  79. {
  80.   digitalWrite(r1_PIN_D3, r1_PIN_D3_rawData);
  81.   digitalWrite(r2_PIN_D4, r2_PIN_D4_rawData);
  82.   digitalWrite(r3_PIN_D5, r3_PIN_D5_rawData);
  83.   digitalWrite(r4_PIN_D6, r4_PIN_D6_rawData);
  84.   digitalWrite(r5_PIN_D7, r5_PIN_D7_rawData);
  85. }
  86.  
  87. /************ END CODE ************/
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement