Advertisement
pleasedontcode

Digital Pins rev_01

Apr 21st, 2024
97
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 Pins
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-04-22 00:00:04
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* The system will be activated when the user enters */
  21.     /* a value x from the serial monitor or clicks on the */
  22.     /* first push button. */
  23. /****** SYSTEM REQUIREMENT 2 *****/
  24.     /* The system will be deactivated if the user press */
  25.     /* on the second push button. */
  26. /****** END SYSTEM REQUIREMENTS *****/
  27.  
  28. /****** DEFINITION OF LIBRARIES *****/
  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 push_PushButton_PIN_D2      = 2;
  37. const uint8_t Tem_DS18B20_DQ_PIN_D6       = 6;
  38.  
  39. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  40. const uint8_t led_LEDRGB_Red_PIN_D3       = 3;
  41. const uint8_t led_LEDRGB_Green_PIN_D4     = 4;
  42. const uint8_t led_LEDRGB_Blue_PIN_D5      = 5;
  43.  
  44. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  45. /***** used to store raw data *****/
  46. bool    led_LEDRGB_Red_PIN_D3_rawData     = 0;
  47. bool    led_LEDRGB_Green_PIN_D4_rawData   = 0;
  48. bool    led_LEDRGB_Blue_PIN_D5_rawData    = 0;
  49.  
  50. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  51. /***** used to store data after characteristic curve transformation *****/
  52. float   led_LEDRGB_Red_PIN_D3_phyData     = 0.0;
  53. float   led_LEDRGB_Green_PIN_D4_phyData   = 0.0;
  54. float   led_LEDRGB_Blue_PIN_D5_phyData    = 0.0;
  55.  
  56. void setup(void)
  57. {
  58.     // put your setup code here, to run once:
  59.  
  60.     pinMode(push_PushButton_PIN_D2,    INPUT_PULLUP);
  61.     pinMode(Tem_DS18B20_DQ_PIN_D6,     INPUT);
  62.  
  63.     pinMode(led_LEDRGB_Red_PIN_D3,     OUTPUT);
  64.     pinMode(led_LEDRGB_Green_PIN_D4,   OUTPUT);
  65.     pinMode(led_LEDRGB_Blue_PIN_D5,    OUTPUT);
  66.  
  67. }
  68.  
  69.  
  70. void loop(void)
  71. {
  72.     // put your main code here, to run repeatedly:
  73.  
  74.     updateOutputs(); // Refresh output data
  75.  
  76. }
  77.  
  78. void updateOutputs()
  79. {
  80.     digitalWrite(led_LEDRGB_Red_PIN_D3, led_LEDRGB_Red_PIN_D3_rawData);
  81.     digitalWrite(led_LEDRGB_Green_PIN_D4, led_LEDRGB_Green_PIN_D4_rawData);
  82.     digitalWrite(led_LEDRGB_Blue_PIN_D5, led_LEDRGB_Blue_PIN_D5_rawData);
  83. }
  84.  
  85. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement