Advertisement
Komenymag

Pia Onto Lampa PRO V0.001

Jul 24th, 2023 (edited)
1,340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //----- Load libaries
  2. #include <DmxSimple.h>
  3. #include <FastLED.h>
  4.  
  5. //----- Setup screen library
  6.  
  7. //----- Setup DMX library
  8. DmxSimple.usePin(/*dmx out pin*/);
  9.  
  10. //------ Setup LED library
  11. FASTLED_USING_NAMESPACE
  12. #define NUM_LEDS 6
  13. #define DATA_PIN //LED out pin
  14. #define LED_TYPE WS2812B
  15. #define BRIGHTNESS 255
  16. #define SATURATION 255  
  17.  
  18. //----- Sceen varibles
  19.  
  20. //----- DMX varibles
  21. //DMX addres
  22. int panId = 5;
  23. int tiltId = 6;
  24. //P-T positions
  25. int homePan = 102;
  26. int homeTilt = 128;
  27. int shotTilt = 5;
  28. int shot1Pan = 92;
  29. int shot2Pan = 102;
  30. int shot3Pan = 112;
  31.  
  32. //----- LED varibles
  33. int glassColor[3];
  34. int shot1Color[3];
  35. int shot2Color[3];
  36. int shot3Color[3];
  37. bool rainbow;
  38.  
  39. //----- Drink option varibles
  40. bool shot1 = false;
  41. bool shot2 = false;
  42. bool shot3 = false;
  43. bool doubleshot = false;
  44.  
  45. //----- User msg varibles
  46. bool save = false;
  47. bool noShot = false;
  48.  
  49.  
  50.  
  51. void boot() {
  52. //----- Load starting screen
  53.  
  54. //----- Load saved varibles
  55.  
  56. //----- Fixture to home pos
  57.  
  58. //----- Goto main screena
  59. delay(15000);
  60. mainScreen();
  61. }
  62.  
  63. void mainScreen() {
  64. //----- Load main screen
  65.  
  66. //----- Detect touch
  67.   if (fill) {
  68.     if(shot1 == false && shot2 == false && shot3 == false) {
  69.       bool noShot = true;
  70.       userMsg()
  71.     } else {
  72.       filling()
  73.     }
  74.   if (shot1) {}
  75.   if (shot2) {}
  76.   if (shot3) {}
  77.   if (options) {}
  78.  
  79. //----- Load idle colors
  80.   // Glass Color
  81.   if (rainbow == false){              //Solid color
  82.    
  83.     leds[0].setRGB(glassColor[0], glassColor[1], glassColor[2]);
  84.     leds[1].setRGB(glassColor[0], glassColor[1], glassColor[2]);
  85.     leds[2].setRGB(glassColor[0], glassColor[1], glassColor[2]);
  86.     leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  87.     leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
  88.     leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
  89.  
  90.     FastLED.show();
  91.  
  92.   } else if(rainbow == true) {       //Rainbow color
  93.    
  94.     //Ide nagyon ki kell talalni valamit
  95.    
  96.   }
  97.   mainScreen();
  98. }
  99.  
  100. void filling() {
  101. //----- Load filling scree
  102.  
  103. //----- Start filling
  104.     //1st shot
  105.     if(shot1 == true) {
  106.       //Set color
  107.       leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  108.       leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  109.       leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  110.       leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  111.       leds[4].setRGB(0, 0, 0);
  112.       leds[5].setRGB(0, 0, 0);
  113.       FastLED.show();
  114.  
  115.       //Move fixture
  116.       DmxSimple.write(panId, shot1Pan);
  117.       delay(1500);
  118.       DmxSimple.write(tiltId, shotTilt);
  119.       delay(3500);
  120.       DmxSimple.write(tiltId, homeTilt);
  121.       delay(1500);      
  122.       DmxSimple.write(panId, homePan);
  123.       delay(1500);
  124.     }
  125.  
  126.  
  127.     //Shot 2
  128.     if(shot2 == true) {
  129.       //Set color
  130.       leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  131.       leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  132.       leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  133.       leds[3].setRGB(0, 0, 0);
  134.       leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
  135.       leds[5].setRGB(0, 0, 0);
  136.       FastLED.show();
  137.  
  138.       //Move fixture
  139.       DmxSimple.write(panId, shot2Pan);
  140.       delay(1500);
  141.       DmxSimple.write(tiltId, shotTilt);
  142.       delay(3500);
  143.       DmxSimple.write(tiltId, homeTilt);
  144.       delay(1500);      
  145.       DmxSimple.write(panId, homePan);
  146.       delay(1500);
  147.     }    
  148.  
  149.  
  150.     //Shot 3
  151.     if(shot3 == true) {
  152.       //Set color
  153.       leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  154.       leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  155.       leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  156.       leds[3].setRGB(0, 0, 0);
  157.       leds[4].setRGB(0, 0, 0);
  158.       leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
  159.       FastLED.show();
  160.  
  161.       //Move fixture
  162.       DmxSimple.write(panId, shot3Pan);
  163.       delay(1500);
  164.       DmxSimple.write(tiltId, shotTilt);
  165.       delay(3500);
  166.       DmxSimple.write(tiltId, homeTilt);
  167.       delay(1500);      
  168.       DmxSimple.write(panId, homePan);
  169.       delay(1500);
  170.     }
  171.  
  172.     //2nd Shot
  173.     if (doubleshot == true) {
  174.       //Shot 1
  175.       if(shot1 == true) {
  176.         //Set color
  177.         leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  178.         leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  179.         leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  180.         leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  181.         leds[4].setRGB(0, 0, 0);
  182.         leds[5].setRGB(0, 0, 0);
  183.         FastLED.show();
  184.  
  185.         //Move fixture
  186.         DmxSimple.write(panId, shot1Pan);
  187.         delay(1500);
  188.         DmxSimple.write(tiltId, shotTilt);
  189.         delay(3500);
  190.         DmxSimple.write(tiltId, homeTilt);
  191.         delay(1500);      
  192.         DmxSimple.write(panId, homePan);
  193.         delay(1500);
  194.       }
  195.  
  196.  
  197.       //Shot 2
  198.       if(shot2 == true) {
  199.         //Set color
  200.         leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  201.         leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  202.         leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  203.         leds[3].setRGB(0, 0, 0);
  204.         leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
  205.         leds[5].setRGB(0, 0, 0);
  206.         FastLED.show();
  207.  
  208.         //Move fixture
  209.         DmxSimple.write(panId, shot2Pan);
  210.         delay(1500);
  211.         DmxSimple.write(tiltId, shotTilt);
  212.         delay(3500);
  213.         DmxSimple.write(tiltId, homeTilt);
  214.         delay(1500);      
  215.         DmxSimple.write(panId, homePan);
  216.         delay(1500);
  217.       }    
  218.  
  219.  
  220.       //Shot 3
  221.       if(shot3 == true) {
  222.         //Set color
  223.         leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  224.         leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  225.         leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
  226.         leds[3].setRGB(0, 0, 0);
  227.         leds[4].setRGB(0, 0, 0);
  228.         leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
  229.         FastLED.show();
  230.  
  231.         //Move fixture
  232.         DmxSimple.write(panId, shot3Pan);
  233.         delay(1500);
  234.         DmxSimple.write(tiltId, shotTilt);
  235.         delay(3500);
  236.         DmxSimple.write(tiltId, homeTilt);
  237.         delay(1500);      
  238.         DmxSimple.write(panId, homePan);
  239.         delay(1500);
  240.       }
  241.     }
  242.  
  243.    
  244. //----- Reset to next fill
  245.     bool shot1 = false;
  246.     bool shot2 = false;
  247.     bool shot3 = false;
  248.     bool doubleshot = false;
  249.     mainScreen();
  250. }
  251.  
  252. void optionScreen() {
  253. //----- Load options screen
  254.  
  255. }
  256.  
  257. void userMsg() {
  258.   //No glass selected error msg
  259.   if (noShot == true) {
  260.     //----- Load No glass selected msg
  261.  
  262.     //----- Back to main screen
  263.     bool noShot == false;
  264.     delay(3000);
  265.     mainScreen();
  266.   }
  267. }
  268. void saveSetup() {}
  269. void loadDefault() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement