Advertisement
pleasedontcode

LED Control rev_01

Apr 22nd, 2024
55
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 Control
  13.     - Source Code NOT compiled for: Arduino Nano
  14.     - Source Code created on: 2024-04-22 10:56:44
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* i'm working on an arduino project that aims to */
  21.     /* test cables similair as the Cable Eye tester, im */
  22.     /* using 8 shit registers and 9 demuxes (8 demux are */
  23.     /* connected to the 9th one to be an input in the */
  24.     /* arduino) and the system is connected to a counter */
  25.     /* part us */
  26. /****** END SYSTEM REQUIREMENTS *****/
  27.  
  28. /****** DEFINITION OF LIBRARIES *****/
  29. #include <ShiftRegister74HC595.h>
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34. void updateOutputs(void);
  35.  
  36. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  37. const uint8_t r_LED_PIN_D2 = 2;
  38.  
  39. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  40. bool r_LED_PIN_D2_rawData = 0;
  41.  
  42. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  43. float r_LED_PIN_D2_phyData = 0.0;
  44.  
  45. // Define the number of shift registers and the data pin
  46. const int numRegisters = 8;
  47. const int dataPin = 11;
  48. const int clockPin = 13;
  49. const int latchPin = 10;
  50.  
  51. // Create an object for the ShiftRegister74HC595 library
  52. ShiftRegister74HC595 sr(numRegisters, dataPin, clockPin, latchPin);
  53.  
  54. void setup(void)
  55. {
  56.     // put your setup code here, to run once:
  57.     pinMode(r_LED_PIN_D2, OUTPUT);
  58.  
  59.     // Initialize the shift register
  60.     sr.begin();
  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.     // Update the shift register with the raw data
  72.     sr.set(r_LED_PIN_D2_rawData, 0);
  73.     sr.write();
  74. }
  75.  
  76. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement