Advertisement
pleasedontcode

**LED Buzzer** rev_04

Nov 4th, 2024
78
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: **LED Buzzer**
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-11-04 14:03:35
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* activate led */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /* START CODE */
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Arduino.h>
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31. void updateOutputs(void);
  32.  
  33. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  34. const uint8_t led_LED_PIN_D2 = 2;
  35. const uint8_t buzz_ActiveBuzzer_output_PIN_D3 = 3;
  36.  
  37. /***** DEFINITION OF PWM OUTPUT PINS *****/
  38. const uint8_t out_PIN_D5 = 5;
  39.  
  40. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  41. /***** used to store raw data *****/
  42. bool led_LED_PIN_D2_rawData = 0;
  43. bool buzz_ActiveBuzzer_output_PIN_D3_rawData = 0;
  44. uint8_t out_PIN_D5_rawData = 0;
  45.  
  46. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  47. /***** used to store data after characteristic curve transformation *****/
  48. float led_LED_PIN_D2_phyData = 0.0;
  49. float buzz_ActiveBuzzer_output_PIN_D3_phyData = 0.0;
  50. float out_PIN_D5_phyData = 0.0;
  51.  
  52. void setup(void)
  53. {
  54.     // put your setup code here, to run once:
  55.     pinMode(led_LED_PIN_D2, OUTPUT);
  56.     pinMode(buzz_ActiveBuzzer_output_PIN_D3, OUTPUT);
  57.     pinMode(out_PIN_D5, OUTPUT);
  58.  
  59.     // Activate the LED by setting its raw data to HIGH
  60.     led_LED_PIN_D2_rawData = 1; // Set to HIGH to turn on the LED
  61. }
  62.  
  63. void loop(void)
  64. {
  65.     // put your main code here, to run repeatedly:
  66.     updateOutputs(); // Refresh output data
  67. }
  68.  
  69. void updateOutputs()
  70. {
  71.     digitalWrite(led_LED_PIN_D2, led_LED_PIN_D2_rawData);
  72.     digitalWrite(buzz_ActiveBuzzer_output_PIN_D3, buzz_ActiveBuzzer_output_PIN_D3_rawData);
  73.     analogWrite(out_PIN_D5, out_PIN_D5_rawData);
  74. }
  75.  
  76. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement