Zeneger

Untitled

Jan 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.91 KB | None | 0 0
  1.  
  2. #include <Conceptinetics.h>
  3.  
  4. //
  5. // CTC-DRA-13-1 ISOLATED DMX-RDM SHIELD JUMPER INSTRUCTIONS
  6. //
  7. // If you are using the above mentioned shield you should
  8. // place the RXEN jumper towards G (Ground), This will turn
  9. // the shield into read mode without using up an IO pin
  10. //
  11. // The !EN Jumper should be either placed in the G (GROUND)
  12. // position to enable the shield circuitry
  13. //   OR
  14. // if one of the pins is selected the selected pin should be
  15. // set to OUTPUT mode and set to LOGIC LOW in order for the
  16. // shield to work
  17. //
  18.  
  19. //
  20. // The slave device will use a block of 10 channels counting from
  21. // its start address.
  22. //
  23. // If the start address is for example 56, then the channels kept
  24. // by the dmx_slave object is channel 56-66
  25. //
  26. #define DMX_SLAVE_CHANNELS   10
  27.  
  28. //
  29. // Pin number to change read or write mode on the shield
  30. // Uncomment the following line if you choose to control
  31. // read and write via a pin
  32. //
  33. // On the CTC-DRA-13-1 shield this will always be pin 2,
  34. // if you are using other shields you should look it up
  35. // yourself
  36. //
  37. // Configure a DMX slave controller
  38. DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );
  39.  
  40. // If you are using an IO pin to control the shields RXEN
  41. // the use the following line instead
  42. ///// DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS , RXEN_PIN );
  43.  
  44. const int ledPin1 = 3;
  45. const int ledPin2 = 5;
  46. const int ledPin3 = 6;
  47. const int ledPin4 = 9;
  48. const int ledPin5 = 10;
  49. const int ledPin6 = 11;
  50.  
  51.  
  52. int button1 = 1;
  53. int button2 = 2;
  54. int button3 = 4;
  55. int button4 = 8;
  56. int button5 = 16;
  57. int button6 = 32;
  58. int button7 = 64;
  59. int button8 = 128;
  60. int button9 = 256;
  61. int cim;
  62.  
  63. // the setup routine runs once when you press reset:
  64. void setup() {            
  65.  
  66.   // Enable DMX slave interface and start recording
  67.   // DMX data
  68.   dmx_slave.enable ();
  69.  
  70.     pinMode (button1, INPUT);
  71.     pinMode (button3, INPUT);
  72.     pinMode (button3, INPUT);
  73.     pinMode (button4, INPUT);
  74.     pinMode (button5, INPUT);
  75.     pinMode (button6, INPUT);
  76.     pinMode (button7, INPUT);
  77.     pinMode (button8, INPUT);
  78.     pinMode (button9, INPUT);
  79.  
  80.   // Set start address to 1, this is also the default setting
  81.   // You can change this address at any time during the program
  82.  
  83.   dmx_slave.setStartAddress (1);
  84.  
  85.   // Set led pin as output pin
  86.   pinMode ( ledPin1, OUTPUT );
  87.   pinMode ( ledPin2, OUTPUT );
  88.   pinMode ( ledPin3, OUTPUT );
  89.   pinMode ( ledPin4, OUTPUT );
  90.   pinMode ( ledPin5, OUTPUT );
  91.   pinMode ( ledPin6, OUTPUT );
  92. }
  93.  
  94. // the loop routine runs over and over again forever:
  95. void loop()
  96. {
  97.    
  98.     analogWrite ( ledPin1,( dmx_slave.getChannelValue (1)));
  99.     analogWrite ( ledPin2,( dmx_slave.getChannelValue (2)));
  100.     analogWrite ( ledPin3,( dmx_slave.getChannelValue (3)));
  101.     analogWrite ( ledPin4,( dmx_slave.getChannelValue (4)));
  102.     analogWrite ( ledPin5,( dmx_slave.getChannelValue (5)));
  103.     analogWrite ( ledPin6,( dmx_slave.getChannelValue (6)));  
  104.  
  105. }
Add Comment
Please, Sign In to add comment