Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----- Load libaries
- #include <DmxSimple.h>
- #include <FastLED.h>
- //----- Setup screen library
- //----- Setup DMX library
- DmxSimple.usePin(/*dmx out pin*/);
- //------ Setup LED library
- FASTLED_USING_NAMESPACE
- #define NUM_LEDS 6
- #define DATA_PIN //LED out pin
- #define LED_TYPE WS2812B
- #define BRIGHTNESS 255
- #define SATURATION 255
- //----- Sceen varibles
- //----- DMX varibles
- //DMX addres
- int panId = 5;
- int tiltId = 6;
- //P-T positions
- int homePan = 102;
- int homeTilt = 128;
- int shotTilt = 5;
- int shot1Pan = 92;
- int shot2Pan = 102;
- int shot3Pan = 112;
- //----- LED varibles
- int glassColor[3];
- int shot1Color[3];
- int shot2Color[3];
- int shot3Color[3];
- bool rainbow;
- //----- Drink option varibles
- bool shot1 = false;
- bool shot2 = false;
- bool shot3 = false;
- bool doubleshot = false;
- //----- User msg varibles
- bool save = false;
- bool noShot = false;
- void boot() {
- //----- Load starting screen
- //----- Load saved varibles
- //----- Fixture to home pos
- //----- Goto main screena
- delay(15000);
- mainScreen();
- }
- void mainScreen() {
- //----- Load main screen
- //----- Detect touch
- if (fill) {
- if(shot1 == false && shot2 == false && shot3 == false) {
- bool noShot = true;
- userMsg()
- } else {
- filling()
- }
- if (shot1) {}
- if (shot2) {}
- if (shot3) {}
- if (options) {}
- //----- Load idle colors
- // Glass Color
- if (rainbow == false){ //Solid color
- leds[0].setRGB(glassColor[0], glassColor[1], glassColor[2]);
- leds[1].setRGB(glassColor[0], glassColor[1], glassColor[2]);
- leds[2].setRGB(glassColor[0], glassColor[1], glassColor[2]);
- leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
- leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
- FastLED.show();
- } else if(rainbow == true) { //Rainbow color
- //Ide nagyon ki kell talalni valamit
- }
- mainScreen();
- }
- void filling() {
- //----- Load filling scree
- //----- Start filling
- //1st shot
- if(shot1 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[4].setRGB(0, 0, 0);
- leds[5].setRGB(0, 0, 0);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot1Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- //Shot 2
- if(shot2 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(0, 0, 0);
- leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
- leds[5].setRGB(0, 0, 0);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot2Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- //Shot 3
- if(shot3 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(0, 0, 0);
- leds[4].setRGB(0, 0, 0);
- leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot3Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- //2nd Shot
- if (doubleshot == true) {
- //Shot 1
- if(shot1 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[4].setRGB(0, 0, 0);
- leds[5].setRGB(0, 0, 0);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot1Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- //Shot 2
- if(shot2 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(0, 0, 0);
- leds[4].setRGB(shot2Color[0], shot2Color[1], shot2Color[2]);
- leds[5].setRGB(0, 0, 0);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot2Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- //Shot 3
- if(shot3 == true) {
- //Set color
- leds[0].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[1].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[2].setRGB(shot1Color[0], shot1Color[1], shot1Color[2]);
- leds[3].setRGB(0, 0, 0);
- leds[4].setRGB(0, 0, 0);
- leds[5].setRGB(shot3Color[0], shot3Color[1], shot3Color[2]);
- FastLED.show();
- //Move fixture
- DmxSimple.write(panId, shot3Pan);
- delay(1500);
- DmxSimple.write(tiltId, shotTilt);
- delay(3500);
- DmxSimple.write(tiltId, homeTilt);
- delay(1500);
- DmxSimple.write(panId, homePan);
- delay(1500);
- }
- }
- //----- Reset to next fill
- bool shot1 = false;
- bool shot2 = false;
- bool shot3 = false;
- bool doubleshot = false;
- mainScreen();
- }
- void optionScreen() {
- //----- Load options screen
- }
- void userMsg() {
- //No glass selected error msg
- if (noShot == true) {
- //----- Load No glass selected msg
- //----- Back to main screen
- bool noShot == false;
- delay(3000);
- mainScreen();
- }
- }
- void saveSetup() {}
- void loadDefault() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement