Results 1 to 9 of 9

Thread: Can't be united

  1. #1
    Join Date
    Oct 2021
    Posts
    5
    Post Thanks / Like

    Unhappy Can't be united

    Hello!
    I downloaded this code for arduino:
    [code]
    // There are some defining lines on top that determine the sequence rate, the number of channels used, and whether the relays activate with a high or low signal:
    // Specify the number of channels to use with line CHANNEL_COUNT 16
    // Set "#define MODE INVERTED" or "#define MODE NOT_INVERTED" in the mode bar if necessary. If your channels behave differently than expected, switch to another mode.
    // Set port speed (currently 57600) define VIXEN_COM_SPEED 57600
    // Set the random timeout (in milliseconds) by setting TIME_OUT 1000
    // It uses only one library watchdog timer in the arduino IDE, so just copy the code to a new sketch, change the channels, speed, and transfer mode settings, and upload it to your Arduino.
    // NOTE. If you are using Arduino Uno, after 18 years, remove all channel definition lines and remove those channels from the line "int channels [] = {CH01 ...", as all of these pins are only valid for Arduino Mega and would cause an Arduino Uno build error.
    // It works as follows.
    // - Vixen must be configured to use the header: ~!
    // - turns off all channels on startup.
    // - Wait up to 2 seconds (can be changed longer) and if there is no valid input, it will switch to random mode by flashing some lights every second.
    // - If it detects a valid input (with a ~! Header), it writes to relays while Vixen is running.
    // - If the Vixen switches off for more than 2 seconds, return to random mode.
    // Here is the code:
    // This code was written by Click that moment.
    // To customize the code for your case, simply edit this top section with the #define lines.
    // Includes watchdog timer library
    #include <avr / wdt.h>
    // This determines how many channels vixen sends. You can set any number from 1 to 48 for the Arduino Mega and 1 to 18 for the Arduino Uno.
    #define CHANNEL_COUNT 12
    // speed The speed of the compode for chatting with wikis. 9600 to 115200. Use the same speed set in the Vixen.
    #define VIXEN_COM_SPEED 115200
    // Timeout waiting for sequence input before going into random mode (in milliseconds).
    #define TIME_OUT 2000
    // If the relays turn on and off in reverse order of the Vixen sequence, change "#define MODE NOT_INVERTED" to "#define MODE INVERTED"
    #define NOT_INVERTED 0
    #define INVERTED 1
    #define MODE NOT_INVERTED
    // which contacts control which channels
    // You can change these settings to use different contacts, but be very careful not to repeat the same PIN for two channels.
    // DO NOT use voltages 0 and 1 as they are for talking to a serial port computer.
    #define CH01 2
    #define CH02 3
    #define CH03 4
    #define CH04 5
    #define CH05 6
    #define CH06 7
    #define CH07 8
    #define CH08 9
    #define CH09 10
    #define CH10 11
    #define CH11 12
    #define CH12 13
    // So far for Arduino uno.
    #
    internal channels [] = {CH01, CHO2, CHO3, CHO4, CHO5, CH06, CH07, CH08, CH09,
    CH10, CH11, CH12};
    int incoming byte [CHANNEL_COUNT];
    int i = 0; // Loop counter
    volatile unsigned long timer_a = 0; // new line
    // configure pins / inputs and outputs
    void setup () {
    // enable the watchdog timer for 1 second. If the disc freezes, it will reset after 1 second.
    wdt_enable (WDTO_1S);
    // specifically for UNO
    sei ();
    // initialize PWM channels / pins
    (i = 0; i <CHANNEL_COUNT; i ++) {
    pinMode (channels [i], OUTPUT);
    }
    // start out all the realities
    if (MODE == NOT_INVERTED) {
    (i = 0; i <CHANNEL_COUNT; i ++) {
    digitalWrite (channels [i], LOW);
    }
    }
    sell {
    (i = 0; i <CHANNEL_COUNT; i ++) {
    digitalWrite (channels [i], HIGH);
    }
    }
    testSequence ();
    // configure the sequence according to the above speed.
    Serial.begin (VIXEN_COM_SPEED);
    }
    void cycle ()
    {
    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) {
    (i = 0; i <CHANNEL_COUNT; i ++) {
    // read each byte
    incoming byte [i] = Serial.read ();
    }
    if (MODE == NOT_INVERTED) {
    (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);
    }
    sell {
    digitalWrite (channels [i], LOW);
    }
    }
    }
    }
    }
    }
    // Random mode code. Random mode is triggered if no serial input is received within TIME_OUT milliseconds
    sell {
    wdt_reset (); // resets the watchdog
    mark long diff = millis () - timer_a;
    if (difference> = 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) {
    (i = 0; i <CHANNEL_CO;
    }
    }
    else {
    for (i = 0; i <CHANNEL_COUNT; i ++) {
    wdt_reset (); // resets the watchdog
    digitalWrite (channels [i], LOW);
    delay (500);
    digitalWrite (channels [i], HIGH);
    }
    }
    }
    [/ code]
    but it won't work flashing only RX light but TX is dark. When I play a file from vixen, it doesn't work either. I read that it may be in the arduino code, but since I can't control it myself, maybe someone will catch an eye and see the problem.

  2. #2
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    1,287
    Post Thanks / Like

    Default Re: Can't be united

    Are you using an Arduino UNO or MEGA?

    This sketch (code) seems to be similar to the Victor_PV sketch. I would suggest using the Victor_PV sketch found in post #1 the thread shown below.

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

    Make sure you have the Com port settings correct, including the START and STOP or END headers.
    Kevin

  3. #3
    Join Date
    Oct 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Can't be united

    i use arduino uno.

  4. #4
    Join Date
    Oct 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Can't be united

    I tried it seems to me that I uno broken.

  5. #5
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    1,287
    Post Thanks / Like

    Default Re: Can't be united

    pictures of your hardware setup and screenshots of your Vixen output and com port configuration can help us troubleshoot.

    Also, you have not told us if the system works during the self-test or during the random mode.
    Kevin

  6. #6
    Join Date
    May 2021
    Location
    The world
    Posts
    51
    Post Thanks / Like

    Default Re: Can't be united

    Yes, on the setup page make sure you have the same com as on the arduino. It can take some try’s from my experience. Here is a channel that would help you https://m.youtube.com/channel/UCWuJo4zLdgG_PNw_I2n5eCg

  7. #7
    Join Date
    Oct 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Can't be united

    Com port same.

  8. #8
    Join Date
    Oct 2021
    Posts
    5
    Post Thanks / Like

  9. #9
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    1,287
    Post Thanks / Like

    Default Re: Can't be united

    the code you posted above is using com port speed of 115200 while the picture of your Vixen setup show 57600. I suggest using 57600 for both.
    Kevin

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
  •