Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

  1. #21
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,206
    Post Thanks / Like

    Default Re: Success Modifying VictorPV and ZParticle Sketches to Accept Renard Protocol

    You can do that. That is how it can work. ESP outputs Renard, Mega runs Renard protocol for input and the Mega runs the dimming code.

    The current version of the Bill Porter library caused my Uno to slow down. I had to take out the "transmit code" to get it to be stable.

  2. #22
    Join Date
    Oct 2019
    Location
    SoCal
    Posts
    55
    Post Thanks / Like

    Default Re: Success Modifying VictorPV and ZParticle Sketches to Accept Renard Protocol

    Thank god someone replied so promptly!

    Ok. So with the ESP8266 (or ESP-01..or same thing?) connected to the arduino uno, the code compiled just fine when I hit verify within the Arduino IDE. But when I try to upload the code to the Uno, it gets stuck on "Uploading.." and produces this output:

    Code:
     
    Sketch uses 3,228 bytes (10%) of program storage space. Maximum is 32,256 bytes.
    Global variables use 225 bytes (10%) of dynamic memory, leaving 1,823 bytes for local variables. Maximum is 2,048 bytes.
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x20
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x20
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20
    Any idea what I'm missing here?

  3. #23
    Join Date
    Oct 2019
    Location
    SoCal
    Posts
    55
    Post Thanks / Like

    Default Re: Success Modifying VictorPV and ZParticle Sketches to Accept Renard Protocol

    Oh yeah, I'll add that I added the Renard-master library authored by Bill Porter before compiling the code, and that the ESP module lights up so I assume its connected correctly.

  4. #24
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    899
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    Quote Originally Posted by LateraLiz View Post
    Since the ESPixelstick uses the ESP8266 module, would I be able to Kev's code, posted at beginning of this thread, for an Arduino Uno (or Mega) if I attach the standalone ESP8266 wifi module to the Arduino?

    I'm currently using the original Victor_PV Arduino code to control my relay board via serial connection from FPP on a Raspberry Pi, and it works beautifully! Was hoping to take it a step further with either wifi or ethernet instead of maintaining the serial connection to the Pi.

    Thanks!
    YES. That is exactly why I modified the sketch, so I could run my MEGA via WiFi from the FPP.. I am not sure if the sketch will compile and run correctly on an UNO. I had only tested it on a MEGA.
    Kevin

  5. #25
    Join Date
    Oct 2019
    Location
    SoCal
    Posts
    55
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    I have a mega in case the uno doesn't work out so no big deal there. I did manage to get it i compile and upload to the uno but have run into a wall getting FPP setup via e.1.31. So i guess I'll have to do some digging to see why the sequence doesn't start using this route. Thanks for sharing the code!

  6. #26
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    899
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    ----
    Last edited by kev; 11-18-2019 at 04:40 PM.
    Kevin

  7. #27
    Join Date
    Nov 2017
    Posts
    3
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    EDIT - I am adding here in the first post of this thread that I have also modified the sketch by ZParticle to accept Renard protocol (as mentioned below).
    Kevin, could you please share your version of ZParticles code for renard, I have been using his code and would like to try the renard version thanks

  8. #28
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    899
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    I apologize. I thought I had included the code. Here it is, a heavily modified version of ZParticle's sketch that works with a Renard protocol data stream for 32 channels. I use this sketch in 3 of my controllers.

    Code:
    // WORKING RENARD PROTOCOL VERSION
    // REDUCED NUMBER OF DIMMING STEPS FROM 256 TO 64
    // REMOVED RANDOM LIGHTS SECTION
    // REVERSED ISR LOGIC AND COUNTER ACTION FROM ++ TO -=4
    // REMOVED A LOT OF EXTRA COMMENTS - REFER TO ORIGINAL FOR REFERENCE
    // 
    
    /************************************************************************************************ 
    *  This is a derivitave of the Version 2 Christmas Light Controller by Scott Shaver (ZParticle).
    *  It has been modified to accept the Renard protocol rather than generic serial. 
    *  Modifications by Kevin Graff during August 2017
    *************************************************************************************************  
    */
    /********************************************************
     * 
     * This is the code for Version 2 of the Christmas Lights 
     * Controller.
     *
     * This code is targetting - 32 channels with 256 dimming 
     * levels and a 50ms frame rate from Vixen.
     *
     * - Copyright Scott Shaver 2013
     * 
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     * 
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     * 
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     * 
     ********************************************************/
    
    #include <avr/power.h>
    
    #include <Arduino-Renard.h>  //kg add
    
    // comment this out if AC is 50Hz, uncomment if AC is 60Hz
    #define HERTZ60 true             
    
    #define CHANNEL_COUNT 32         // 32 channels to read from vixen
    #define CHANNEL_PIN_START 22     // 32 channels, assuming all are in order, start at what pin
    
    Renard renard; //kg add
    
    #define DIMMING_LEVELS 64  //kg changed from 256  // the number of levels of dimming we will get from Vixen 0-255
    
    // Ticks Per Half AC Cycle
    #ifdef HERTZ60
    #define TICK_HALF_CYCLE 133333
    #else
    #define TICK_HALF_CYCLE 160000
    #endif
    
    // This is the number of clock cycles the timer will cause an interrupt at.
    #define TIMER_CYCLE_COUNT (int)((float)(TICK_HALF_CYCLE)/(float)(DIMMING_LEVELS-1))
    
    #define ZCD_INT 0 // use interrupt 0 for zero cross detection
    #define ZCD_PIN 2 // interrupt 0 is on pin 2
    
    #define VIXEN_COM_SPEED 57600
    
    #define PC_COM_SPEED 57600
    
    //#define PC_COM_ON true // comment this out for "production" execution. ////////////////////
    
    // this just lets us know if we are switching from random mode to vixen mode
    boolean startingVixenMode = true;
    
    
    volatile unsigned int tickCounter = 0;             // track number of clock interrupts since last ZC detection, this needs to be pretty accurate, keep as volatile
    volatile byte channelValue[CHANNEL_COUNT];         // channel values 0-255 vixen values stored here - TODO: try this as non-volatile
    
    
    //byte channelPins[CHANNEL_COUNT];      // channel pins on the Arduino - changed this to #defines below so the macros produce the fastest code
    #define CHANNEL_PIN_1 CHANNEL_PIN_START
    #define CHANNEL_PIN_2 CHANNEL_PIN_START+1
    #define CHANNEL_PIN_3 CHANNEL_PIN_START+2
    #define CHANNEL_PIN_4 CHANNEL_PIN_START+3
    #define CHANNEL_PIN_5 CHANNEL_PIN_START+4
    #define CHANNEL_PIN_6 CHANNEL_PIN_START+5
    #define CHANNEL_PIN_7 CHANNEL_PIN_START+6
    #define CHANNEL_PIN_8 CHANNEL_PIN_START+7
    #define CHANNEL_PIN_9 CHANNEL_PIN_START+8
    #define CHANNEL_PIN_10 CHANNEL_PIN_START+9
    #define CHANNEL_PIN_11 CHANNEL_PIN_START+10
    #define CHANNEL_PIN_12 CHANNEL_PIN_START+11
    #define CHANNEL_PIN_13 CHANNEL_PIN_START+12
    #define CHANNEL_PIN_14 CHANNEL_PIN_START+13
    #define CHANNEL_PIN_15 CHANNEL_PIN_START+14
    #define CHANNEL_PIN_16 CHANNEL_PIN_START+15
    #define CHANNEL_PIN_17 CHANNEL_PIN_START+16
    #define CHANNEL_PIN_18 CHANNEL_PIN_START+17
    #define CHANNEL_PIN_19 CHANNEL_PIN_START+18
    #define CHANNEL_PIN_20 CHANNEL_PIN_START+19
    #define CHANNEL_PIN_21 CHANNEL_PIN_START+20
    #define CHANNEL_PIN_22 CHANNEL_PIN_START+21
    #define CHANNEL_PIN_23 CHANNEL_PIN_START+22
    #define CHANNEL_PIN_24 CHANNEL_PIN_START+23
    #define CHANNEL_PIN_25 CHANNEL_PIN_START+24 // or A0
    #define CHANNEL_PIN_26 CHANNEL_PIN_START+25 // or A1
    #define CHANNEL_PIN_27 CHANNEL_PIN_START+26 // or A2
    #define CHANNEL_PIN_28 CHANNEL_PIN_START+27 // or A3
    #define CHANNEL_PIN_29 CHANNEL_PIN_START+28 // or A4
    #define CHANNEL_PIN_30 CHANNEL_PIN_START+29 // or A5
    #define CHANNEL_PIN_31 CHANNEL_PIN_START+30 // or A6
    #define CHANNEL_PIN_32 CHANNEL_PIN_START+31 // or A7
    
    unsigned long time;  // used for timing during serial reads from Vixen
    int index = 0;
    int inByte = 0;     // used to read bytes in from Vixen
    
    /********************************************************
     * START OF FASTER DIGITAL WRITE LIBARY CODE
     *******************************************************/
    
    // Arduino Mega Pins
    #define digitalPinToPortReg(P) \
    (((P) >= 22 && (P) <= 29) ? &PORTA : \
    ((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PORTB : \
    (((P) >= 30 && (P) <= 37) ? &PORTC : \
    ((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PORTD : \
    ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PORTE : \
    (((P) >= 54 && (P) <= 61) ? &PORTF : \
    ((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PORTG : \
    ((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PORTH : \
    (((P) == 14 || (P) == 15) ? &PORTJ : \
    (((P) >= 62 && (P) <= 69) ? &PORTK : &PORTL))))))))))
    
    #define digitalPinToDDRReg(P) \
    (((P) >= 22 && (P) <= 29) ? &DDRA : \
    ((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &DDRB : \
    (((P) >= 30 && (P) <= 37) ? &DDRC : \
    ((((P) >= 18 && (P) <= 21) || (P) == 38) ? &DDRD : \
    ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &DDRE : \
    (((P) >= 54 && (P) <= 61) ? &DDRF : \
    ((((P) >= 39 && (P) <= 41) || (P) == 4) ? &DDRG : \
    ((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &DDRH : \
    (((P) == 14 || (P) == 15) ? &DDRJ : \
    (((P) >= 62 && (P) <= 69) ? &DDRK : &DDRL))))))))))
    
    #define digitalPinToPINReg(P) \
    (((P) >= 22 && (P) <= 29) ? &PINA : \
    ((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PINB : \
    (((P) >= 30 && (P) <= 37) ? &PINC : \
    ((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PIND : \
    ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PINE : \
    (((P) >= 54 && (P) <= 61) ? &PINF : \
    ((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PING : \
    ((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PINH : \
    (((P) == 14 || (P) == 15) ? &PINJ : \
    (((P) >= 62 && (P) <= 69) ? &PINK : &PINL))))))))))
    
    #define __digitalPinToBit(P) \
    (((P) >=  7 && (P) <=  9) ? (P) - 3 : \
    (((P) >= 10 && (P) <= 13) ? (P) - 6 : \
    (((P) >= 22 && (P) <= 29) ? (P) - 22 : \
    (((P) >= 30 && (P) <= 37) ? 37 - (P) : \
    (((P) >= 39 && (P) <= 41) ? 41 - (P) : \
    (((P) >= 42 && (P) <= 49) ? 49 - (P) : \
    (((P) >= 50 && (P) <= 53) ? 53 - (P) : \
    (((P) >= 54 && (P) <= 61) ? (P) - 54 : \
    (((P) >= 62 && (P) <= 69) ? (P) - 62 : \
    (((P) == 0 || (P) == 15 || (P) == 17 || (P) == 21) ? 0 : \
    (((P) == 1 || (P) == 14 || (P) == 16 || (P) == 20) ? 1 : \
    (((P) == 19) ? 2 : \
    (((P) == 5 || (P) == 6 || (P) == 18) ? 3 : \
    (((P) == 2) ? 4 : \
    (((P) == 3 || (P) == 4) ? 5 : 7)))))))))))))))
    
    // 15 PWM
    #define __digitalPinToTimer(P) \
    (((P) == 13 || (P) ==  4) ? &TCCR0A : \
    (((P) == 11 || (P) == 12) ? &TCCR1A : \
    (((P) == 10 || (P) ==  9) ? &TCCR2A : \
    (((P) ==  5 || (P) ==  2 || (P) ==  3) ? &TCCR3A : \
    (((P) ==  6 || (P) ==  7 || (P) ==  8) ? &TCCR4A : \
    (((P) == 46 || (P) == 45 || (P) == 44) ? &TCCR5A : 0))))))
    
    #define __digitalPinToTimerBit(P) \
    (((P) == 13) ? COM0A1 : (((P) ==  4) ? COM0B1 : \
    (((P) == 11) ? COM1A1 : (((P) == 12) ? COM1B1 : \
    (((P) == 10) ? COM2A1 : (((P) ==  9) ? COM2B1 : \
    (((P) ==  5) ? COM3A1 : (((P) ==  2) ? COM3B1 : (((P) ==  3) ? COM3C1 : \
    (((P) ==  6) ? COM4A1 : (((P) ==  7) ? COM4B1 : (((P) ==  8) ? COM4C1 : \
    (((P) == 46) ? COM5A1 : (((P) == 45) ? COM5B1 : COM5C1))))))))))))))
    
    #define __atomicWrite__(A,P,V) \
    if ( (int)(A) < 0x40) { \
      bitWrite(*((volatile uint8_t*)A), __digitalPinToBit(P), (V) ); \
    } \
    else {   \
      uint8_t register saveSreg = SREG;   \
      cli();   \
      bitWrite(*((volatile uint8_t*)A), __digitalPinToBit(P), (V) );   \
      SREG=saveSreg;   \
    } 
    
    #define customDigitalWrite(P, V) \
    do {   \
      if (__builtin_constant_p(P) && __builtin_constant_p(V))   __atomicWrite__((uint8_t*) digitalPinToPortReg(P),P,V) \
    else  digitalWrite((P), (V));   \
    }while (0)
    
    #define customPinMode(P, V) \
    do { \
      if (__builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite__((uint8_t*) digitalPinToDDRReg(P),P,V) \
      else pinMode((P), (V));   \
    } while (0)
    
    #define customDigitalRead(P) ( (int) _digitalReadFast2_((P)) )
    #define _digitalReadFast2_(P ) \
    (__builtin_constant_p(P) ) ? ( \
    ( bitRead(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \
    digitalRead((P))
    
    /********************************************************
     * END OF FASTER DIGITAL WRITE LIBARY CODE
     ********************************************************/
    
    
    void setup()
    {
    
    renard.begin((uint8_t*)&channelValue, CHANNEL_COUNT, &Serial3, 57600); //KG add for renard
    
    #ifdef PC_COM_ON
      Serial.begin(PC_COM_SPEED);
    #endif
    
    
    
      for(int c=0;c<CHANNEL_COUNT;c++)
      {
        pinMode(CHANNEL_PIN_START + c, OUTPUT); // set the channel pin to output mode
        channelValue[c] = 0; // currently off  kg changed value from 255 to 0
      }
    
      turnAllLightsOff(); // set the channels to off
    
      powerOnSelfTest(); // do a quick test of the channels
    
      setupVixenMode();
    
    #ifdef PC_COM_ON
          Serial.println("end of setup");
    #endif
    }
    
    /*********************************************************/
    
    void loop()
    {   
    #ifdef PC_COM_ON
          Serial.println("void loop");
         
    #endif
    
        if(renard.receive()) //kg
        {
    #ifdef PC_COM_ON
          Serial.println("read");
         
    #endif
        }
      
    }
    
    /******************************************************/
    void setupVixenMode()
    {
    #ifdef PC_COM_ON
      Serial.println("Setting up Vixen mode.");
    #endif
      // make sure we can read from Vixen COM port
     //kg Serial1.begin(VIXEN_COM_SPEED);  done by renard library now
    
      /* Disable all of the unused peripherals. Some of these
       * peripherals may generate interrupts and slow us down.
       */
      power_adc_disable();     //Disable the Analog to Digital Converter module.
      power_spi_disable();     //Disable the Serial Peripheral Interface module.
    //  power_timer0_disable();  //Disable the Timer 0 module. This kills the delay() and millis() methods
      power_timer2_disable();  //Disable the Timer 2 module.
      power_timer3_disable();  //Disable the Timer 3 module.
      power_timer4_disable();  //Disable the Timer 4 module.
      power_timer5_disable();  //Disable the Timer 5 module.
      power_twi_disable();     //Disable the Two Wire Interface module.
      power_usart2_disable();  //Disable the USART 2 module.
    //kg  power_usart3_disable();  //Disable the USART 3 module.
    
      turnAllLightsOff();
      noInterrupts(); // turn the interrupts off while we are setting everything up
    
      // attach the ISR for getting zero cross signals
      attachInterrupt(ZCD_INT, ZeroCrossDetected, CHANGE);
    
      TCCR1A = 0;
    
      TCCR1B = _BV(WGM12) | _BV(CS10); 
    
      TCNT1 = 0; 
    
      OCR1A = TIMER_CYCLE_COUNT;
    
      // enable timer/counter 1 Output Compare A Match interrupt
      TIMSK1 = _BV(OCIE1A);
    
      interrupts(); // okay, turn the interrupts on, let's go
    }
    
    /*****************************************************/
    void powerOnSelfTest()
    {
    #ifdef PC_COM_ON
      Serial.println("Power on self test running.");
    #endif
    
    #ifdef PC_COM_ON
        Serial.print("Channel: ");
    #endif
    
      for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelIndex++){
         #ifdef PC_COM_ON
             Serial.print(channelIndex+1,DEC); // print channel number not pin number
             Serial.print(" "); // print channel number not pin number
         #endif
       digitalWrite(channelIndex+CHANNEL_PIN_START, HIGH); // turn on one channel at a time
       delay(250); // wait .25 seconds
       digitalWrite(channelIndex+CHANNEL_PIN_START, LOW); // turn it back off
      }
    
    #ifdef PC_COM_ON
        Serial.println("\nPOST Done.");
        delay(2000); 
    #endif
    
    #ifdef PC_COM_ON
          Serial.print("TIMER_CYCLE_COUNT = ");
          Serial.println(TIMER_CYCLE_COUNT);
          delay(5000); 
    #endif
    
      turnAllLightsOff();
    }
    
    /***************************************************/
    void turnAllLightsOff()
    {
      for(int c=0;c<CHANNEL_COUNT;c++)
      {
        digitalWrite(c+CHANNEL_PIN_START,LOW);
        channelValue[c] = 255; // currently off
      }
    
    #ifdef PC_COM_ON
          Serial.println("turn all lights off");
    #endif
    }
    
    /****************************************************/
    void ZeroCrossDetected()
    {
      
      // reset the tick counter to zero/256 at the start of the half AC cycle
      tickCounter = 255; //kg changed from 0   try 256 with -=4 and TIMER_CYCLE_COUNT 2088
    
      // turn channels off immediately after zero cross here
      customDigitalWrite(CHANNEL_PIN_1, LOW);
      customDigitalWrite(CHANNEL_PIN_2, LOW);
      customDigitalWrite(CHANNEL_PIN_3, LOW);
      customDigitalWrite(CHANNEL_PIN_4, LOW);
      customDigitalWrite(CHANNEL_PIN_5, LOW);
      customDigitalWrite(CHANNEL_PIN_6, LOW);
      customDigitalWrite(CHANNEL_PIN_7, LOW);
      customDigitalWrite(CHANNEL_PIN_8, LOW);
      customDigitalWrite(CHANNEL_PIN_9, LOW);
      customDigitalWrite(CHANNEL_PIN_10, LOW);
      customDigitalWrite(CHANNEL_PIN_11, LOW);
      customDigitalWrite(CHANNEL_PIN_12, LOW);
      customDigitalWrite(CHANNEL_PIN_13, LOW);
      customDigitalWrite(CHANNEL_PIN_14, LOW);
      customDigitalWrite(CHANNEL_PIN_15, LOW);
      customDigitalWrite(CHANNEL_PIN_16, LOW);
      customDigitalWrite(CHANNEL_PIN_17, LOW);
      customDigitalWrite(CHANNEL_PIN_18, LOW);
      customDigitalWrite(CHANNEL_PIN_19, LOW);
      customDigitalWrite(CHANNEL_PIN_20, LOW);
      customDigitalWrite(CHANNEL_PIN_21, LOW);
      customDigitalWrite(CHANNEL_PIN_22, LOW);
      customDigitalWrite(CHANNEL_PIN_23, LOW);
      customDigitalWrite(CHANNEL_PIN_24, LOW);
      customDigitalWrite(CHANNEL_PIN_25, LOW);
      customDigitalWrite(CHANNEL_PIN_26, LOW);
      customDigitalWrite(CHANNEL_PIN_27, LOW);
      customDigitalWrite(CHANNEL_PIN_28, LOW);
      customDigitalWrite(CHANNEL_PIN_29, LOW);
      customDigitalWrite(CHANNEL_PIN_30, LOW);
      customDigitalWrite(CHANNEL_PIN_31, LOW);
      customDigitalWrite(CHANNEL_PIN_32, LOW);
    }
    
    /****************************************************/
    ISR(TIMER1_COMPA_vect)
    {
      register uint16_t tick = tickCounter;
      
      // the higher the channel value the faster we want to turn the channel on.
      // if the channel value is 255 (full bright) and this is the first interrupt (tick=0) after 
      // the ZC we want the channel on now (kg - this has been reversed from original ZParticle sketch)
      
      if(channelValue[0] >= tick) customDigitalWrite(CHANNEL_PIN_1, HIGH); // turn the channel on here 
      if(channelValue[1] >= tick) customDigitalWrite(CHANNEL_PIN_2, HIGH); // turn the channel on here
      if(channelValue[2] >= tick) customDigitalWrite(CHANNEL_PIN_3, HIGH); // turn the channel on here
      if(channelValue[3] >= tick) customDigitalWrite(CHANNEL_PIN_4, HIGH); // turn the channel on here
      if(channelValue[4] >= tick) customDigitalWrite(CHANNEL_PIN_5, HIGH); // turn the channel on here
      if(channelValue[5] >= tick) customDigitalWrite(CHANNEL_PIN_6, HIGH); // turn the channel on here
      if(channelValue[6] >= tick) customDigitalWrite(CHANNEL_PIN_7, HIGH); // turn the channel on here
      if(channelValue[7] >= tick) customDigitalWrite(CHANNEL_PIN_8, HIGH); // turn the channel on here
      if(channelValue[8] >= tick) customDigitalWrite(CHANNEL_PIN_9, HIGH); // turn the channel on here
      if(channelValue[9] >= tick) customDigitalWrite(CHANNEL_PIN_10, HIGH); // turn the channel on here
      if(channelValue[10] >= tick) customDigitalWrite(CHANNEL_PIN_11, HIGH); // turn the channel on here
      if(channelValue[11] >= tick) customDigitalWrite(CHANNEL_PIN_12, HIGH); // turn the channel on here
      if(channelValue[12] >= tick) customDigitalWrite(CHANNEL_PIN_13, HIGH); // turn the channel on here
      if(channelValue[13] >= tick) customDigitalWrite(CHANNEL_PIN_14, HIGH); // turn the channel on here
      if(channelValue[14] >= tick) customDigitalWrite(CHANNEL_PIN_15, HIGH); // turn the channel on here
      if(channelValue[15] >= tick) customDigitalWrite(CHANNEL_PIN_16, HIGH); // turn the channel on here
      if(channelValue[16] >= tick) customDigitalWrite(CHANNEL_PIN_17, HIGH); // turn the channel on here
      if(channelValue[17] >= tick) customDigitalWrite(CHANNEL_PIN_18, HIGH); // turn the channel on here
      if(channelValue[18] >= tick) customDigitalWrite(CHANNEL_PIN_19, HIGH); // turn the channel on here
      if(channelValue[19] >= tick) customDigitalWrite(CHANNEL_PIN_20, HIGH); // turn the channel on here
      if(channelValue[20] >= tick) customDigitalWrite(CHANNEL_PIN_21, HIGH); // turn the channel on here
      if(channelValue[21] >= tick) customDigitalWrite(CHANNEL_PIN_22, HIGH); // turn the channel on here
      if(channelValue[22] >= tick) customDigitalWrite(CHANNEL_PIN_23, HIGH); // turn the channel on here
      if(channelValue[23] >= tick) customDigitalWrite(CHANNEL_PIN_24, HIGH); // turn the channel on here
      if(channelValue[24] >= tick) customDigitalWrite(CHANNEL_PIN_25, HIGH); // turn the channel on here
      if(channelValue[25] >= tick) customDigitalWrite(CHANNEL_PIN_26, HIGH); // turn the channel on here
      if(channelValue[26] >= tick) customDigitalWrite(CHANNEL_PIN_27, HIGH); // turn the channel on here
      if(channelValue[27] >= tick) customDigitalWrite(CHANNEL_PIN_28, HIGH); // turn the channel on here
      if(channelValue[28] >= tick) customDigitalWrite(CHANNEL_PIN_29, HIGH); // turn the channel on here
      if(channelValue[29] >= tick) customDigitalWrite(CHANNEL_PIN_30, HIGH); // turn the channel on here
      if(channelValue[30] >= tick) customDigitalWrite(CHANNEL_PIN_31, HIGH); // turn the channel on here
      if(channelValue[31] >= tick) customDigitalWrite(CHANNEL_PIN_32, HIGH); // turn the channel on here
    
      // decrease/increase tick counter by one/4
      tickCounter-=4;   //kg changed from ++ and change DIMMING_LEVELS to 64
    
     
    }
    Kevin

  9. #29
    Join Date
    Nov 2017
    Posts
    3
    Post Thanks / Like

    Default Re: Success Modifying VictorPV Sketch to Accept Renard Protocol from ESPixelstick

    Kevin Thank you

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •