Page 2 of 12 FirstFirst 1234 ... LastLast
Results 11 to 20 of 112

Thread: Arduino Uno & Vixen 3: Need help with sketch

  1. #11
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Quote Originally Posted by ShadowLight8 View Post
    Gotcha! Can you send a screen shot of your Vixen config for the serial port? I've attached what I'm using. Ignore the header setting I'm using.
    Yes my setup is in the PDF attachment in the 3rd post, let me know if there are other details I should post. As a note, the baud rate in the vixen screenshot and the included sketch dont match but each time I tried to run the sequence I made sure the baud rate in the sketch, in vixen and in device manager all matched. I tried out a few different rates while trying to trouble shoot and took screen shots at different times.

    Thank you!
    Last edited by resjsu; 07-29-2017 at 12:14 AM.

  2. #12
    Join Date
    Mar 2017
    Location
    Indiana
    Posts
    51
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Bah! I totally missed that your config was back there. So I went back and re-read through everything

    For the config, I don't see anything that would cause a serial com issue. Sounds like you've already checked the ports, settings, rates, etc.

    You mentioned that the "L" led is staying on. For some reason, that seems odd to me. I was thinking the L led is off normally and your code doesn't change it. Either way, something to try would be to upload the Blink sketch from the examples and see if the L led goes on and off. Keep everything wired up just to rule out a crossed wire.

    You might copy the blink code into your code's setup() function, just to give a visual indicator that the arduino is starting.

    Here are the steps I ended up using when setting up a Teensy (arduino compatible board) to connect to Vixen:
    • Upload sketch
    • Close Arduino IDE
    • Unplug Arduino
    • Plug in Arduino
    • Start Vixen (Serial leds might/should starting blinking at this point)
    • Click Setup Display
    • Edit the config on serial controller
    • Click Setup/Change Serial Port
    • See if COM1 shows up in the drop down (If it's missing, then your computer isn't seeing or there is something conflicting with it)


    I'll keeping thinking on this for other ideas to troubleshoot
    2017: bit.ly/2zUzCC9

  3. #13
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    520
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Looks like your vixen controller is set to 115600 baud but your sketch uses 9600
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  4. #14
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,398
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Quote Originally Posted by kev View Post
    Looks like your vixen controller is set to 115600 baud but your sketch uses 9600
    Yes, but in his Post #11 he claims that they were matched when testing.

  5. #15
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    520
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Quote Originally Posted by LightUp View Post
    Yes, but in his Post #11 he claims that they were matched when testing.
    Hmmmm..... I only see what he posted...............
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  6. #16
    Join Date
    Mar 2017
    Location
    Indiana
    Posts
    51
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Any luck resjsu?
    2017: bit.ly/2zUzCC9

  7. #17
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Hey All,
    I apologize I went on military training soon after the last post. Just to refresh I included new screen shots of my setup, board and uploaded code. I am still having no luck.
    I tried following the sequence that was suggested by ShadowLight in post #12 with no luck. However, when I go back into vixen it says comport#1 in use. I am thinking more and more this is a com issue. I have read other posts where members had issue with com ports.

    At this point I am just trying to verify the arduino is registering what vixen is sending out. If there are any ideas as to what else I can try I am all ears.

    Thank you,
    Aure


    Code:
    /*
    The purpose of this code is to allow the Arduino to use the
    generic serial output of vixen lights to control 5 channels of LEDs.
    Author: Matthew Strange
    Created: 14 October 2010
    Modifier: Ben Towner
    Modified: 19-OCT-2010
    Changes: Addition of 20 Digital On/Off Channels - Setup for Arduino Mega 2560
     
    */
     
    // PWM Output - ChanX=PWM Pin
    int Chan1 = 5;  
    int Chan2 = 6;  
    int Chan3 = 9;  
    int Chan4 = 10;  
    int Chan5 = 11;  
     
     
    int i = 0;     // Loop counter
    int incomingByte[5];   // array to store the 5 values from the serial port
     
    //setup the pins/ inputs & outputs
    void setup()
    {
      Serial.begin(9600);        // set up Serial at 9600 bps
     
      pinMode(Chan1, OUTPUT);   // sets the pins as output
      pinMode(Chan2, OUTPUT);
      pinMode(Chan3, OUTPUT);
      pinMode(Chan4, OUTPUT);
      pinMode(Chan5, OUTPUT);
    }
     
    void loop()
    {  // 5 channels are coming in to the Arduino
       if (Serial.available() >= 5) {
        // read the oldest byte in the serial buffer:
        for (int i=0; i<5; i++) {
          // read each byte
          incomingByte[i] = Serial.read();
        }
       
        analogWrite(Chan1, incomingByte[0]);   // Write current PWM values to LED pins
        analogWrite(Chan2, incomingByte[1]);  
        analogWrite(Chan3, incomingByte[2]);  
        analogWrite(Chan4, incomingByte[3]);  
        analogWrite(Chan5, incomingByte[4]);   
       }
    }
    Attached Files Attached Files

  8. #18
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    520
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    you might want to try the sketch in the following post -

    http://doityourselfchristmas.com/for...th-Random-mode

    once you get it working then you might have better understanding how to get your original sketch/setup working.
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  9. Thanks resjsu thanked for this post
  10. #19
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    I copied, pasted and modified code and for the first time I see my LEDs illuminating but they do so randomly. Before I even start vixen or anything else as soon as the code uploads, the LEDs begin illuminating on sort sort of sequence. Any ideas?

    Code:
     // This code was written by Victor Perez for doityourselfchristmas.com based on the code from Zparticle, Si_champion and Neil Tapp.
     // To adapt the code to your case, just change this top section, with the #define lines.
     
     // Includes the watchdog timer library
     #include <avr/wdt.h>
     
     // This sets how many channels will vixen be sending. Can be set to any number from 1 to 48 for Arduino Mega, and 1 to 18 for Arduino Uno.
     #define CHANNEL_COUNT 5
    
     // speed for the com port for talking with vixen. From 9600 to 115200. Use the same speed as set in Vixen.
     #define VIXEN_COM_SPEED 9600
     
     // Timeout waiting for serial input before going to random mode (in milliseconds).
     #define TIME_OUT 1000
     
     // If the relays turn On and Off opposite to Vixen sequence, change "#define MODE NOT_INVERTED" for "#define MODE INVERTED"
     #define NOT_INVERTED 0
     #define INVERTED 1
     #define MODE NOT_INVERTED
    
     // which pins control which channels
     // You can change these assignment to use different pins, but be very careful to not repeat the same pin number for 2 channels. 
     // DO NOT use pings 0 and 1, as those are for the serial port to talk to the computer.
    
     #define CH05 5
     #define CH06 6
     #define CH11 11
     #define CH09 9
     #define CH10 10
    
    // Up to here for Arduino uno.
    
     
     int channels[] = {CH05,CH06,CH09,CH10,CH11};
    
     int incomingByte[CHANNEL_COUNT];
    
    int i = 0;     // Loop counter
    volatile unsigned long  timer_a = 0; // new line
    
    //setup the pins/ inputs & outputs
    void setup(){
    
      // enable the watchdog timer with a time of 1 second. If the board freezes, it will reset itself after 1 second.
      wdt_enable(WDTO_1S);
      
      // specifically for the UNO
      sei();  
    
    // initalize PWM Channels / Pins
     for (i=0; i < CHANNEL_COUNT; i++){
        pinMode(channels[i], OUTPUT);
      }
    
    // set all the realys to off to start with
    if (MODE == NOT_INVERTED) {
     for (i=0; i < CHANNEL_COUNT; i++){
         digitalWrite(channels[i], LOW);
    
     }
    }
    
    else {
     for (i=0; i < CHANNEL_COUNT; i++){
         digitalWrite(channels[i], HIGH);
     }
    }
    
     testSequence();
     
    // set up Serial according to the speed defined above.
      Serial.begin(VIXEN_COM_SPEED);
    }
    
    void loop()
    {
       if (Serial.available() >= (CHANNEL_COUNT+2)) {
         wdt_reset(); // resets the watchdog
         timer_a = millis (); // new line
         int uno = Serial.read();
         if (uno == 126){
           
           int dos = Serial.read();
           if (dos == 33){
       
             for (i=0; i < CHANNEL_COUNT; i++) {
                 // read each byte
              incomingByte[i] = Serial.read();
             }
         if (MODE == NOT_INVERTED) {
          for (i=0; i < CHANNEL_COUNT; i++){
          int value = incomingByte[i];
          if (value <= 127) {
            digitalWrite(channels[i], LOW);
          }
          else {
            digitalWrite(channels[i], HIGH);
          }
          }
         }
         else {
         for (i=0; i < CHANNEL_COUNT; i++){
          int value = incomingByte[i];
          if (value < 127) {
            digitalWrite(channels[i], HIGH);
          }
          else {
            digitalWrite(channels[i], LOW);
          }
          }
         }
    
           }
         }
       }
    // Random mode code. Random mode starts if no serial input has been received in TIME_OUT millisenconds
       else {
         wdt_reset(); // resets the watchdog
         unsigned long diff = millis() - timer_a;
         if (diff >= TIME_OUT) {
           timer_a = millis ();
           int random_a = 0;
           for (i=0; i < CHANNEL_COUNT; i++){
             random_a = random(0, 2);
             if (random_a == 0) {
               digitalWrite(channels[i], LOW);
             }
             else {
               digitalWrite(channels[i], HIGH);
             }
           }
         }
       }
    }
    
    void testSequence(){
    
    if (MODE == NOT_INVERTED) {
     for (i=0; i < CHANNEL_COUNT; i++){
       wdt_reset(); // resets the watchdog
       digitalWrite(channels[i], HIGH);
       delay (500);
       digitalWrite(channels[i], LOW);
     }
    }
    
    else {
     for (i=0; i < CHANNEL_COUNT; i++){
       wdt_reset(); // resets the watchdog
       digitalWrite(channels[i], LOW);
       delay (500);
       digitalWrite(channels[i], HIGH);
       }
     }
    }

  11. #20
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    520
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    the sketch has a Random mode that will turn n the channels randomly when not connected to Vixen. That is a good start
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

Page 2 of 12 FirstFirst 1234 ... LastLast

Tags for this Thread

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
  •