Page 29 of 29 FirstFirst ... 19272829
Results 281 to 287 of 287

Thread: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

  1. #281
    Join Date
    Nov 2015
    Posts
    46
    Post Thanks / Like

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    Quote Originally Posted by MartinMueller2003 View Post
    The code in general has a major flaw. It does not have any header processing and will often not do what you expect.
    I totally agree. Last night the show ran fine without any issues. There were no power bumps since, and tonight nothing. It will not run the relays. I tried to reload the sketch. I tried to reload the Mega and the PI in different ways. I tried just about every trick in the book and it will not work with the show. it i unplug it from the PI I get the random mode working and turning the relays on and off. so frustrating. I really need a different controller for the AC strings, but I have no idea what to get and I'm already set up with the relays.

    I should mention that the pixel work flawlessly, not one issue

    How would I know if the controller was the issue? The reason i'm thinking it's the code is that it work fine in random mode.
    Last edited by Casper; 11-21-2020 at 05:56 PM.

  2. #282
    Join Date
    Dec 2012
    Location
    Newtown CT
    Posts
    4,571
    Post Thanks / Like

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    You just need a better sketch. A lot of people grab this sketch and another from Victor. They both have the same major flaw and should be avoided. You need to find a sketch that supports Generic Serial header processing. The code in the thread below uses a three byte header with the third byte telling the code how many channels to process.

    http://doityourselfchristmas.com/for...+Serial+header


    2020 Full sized show reworked for the new location. Only adding (famous last words) 13 RBLs that I finally got converted to using pixels
    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show. Dim show (3000 pixels) had regular visits most nights.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  3. #283
    Join Date
    Nov 2015
    Posts
    46
    Post Thanks / Like

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    Quote Originally Posted by MartinMueller2003 View Post
    You just need a better sketch. A lot of people grab this sketch and another from Victor. They both have the same major flaw and should be avoided. You need to find a sketch that supports Generic Serial header processing. The code in the thread below uses a three byte header with the third byte telling the code how many channels to process.

    http://doityourselfchristmas.com/for...+Serial+header
    Thanks I'll look it up.... and i just rebooted the PI again and the Relays/Mega are working again. I'll go look up this new code and try it tomorrow night. Thanks!!!!

  4. #284
    Join Date
    Nov 2015
    Posts
    46
    Post Thanks / Like

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    this code?

    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 = 2;  
    int Chan2 = 3;  
    int Chan3 = 4;  
    int Chan4 = 5;  
    int Chan5 = 6;  
     
     
    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]);   
       }
    }

  5. #285
    Join Date
    Dec 2012
    Location
    Newtown CT
    Posts
    4,571
    Post Thanks / Like

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    No. that is even worse. It uses analog output to control the relays. Relays are not analog devices.


    2020 Full sized show reworked for the new location. Only adding (famous last words) 13 RBLs that I finally got converted to using pixels
    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show. Dim show (3000 pixels) had regular visits most nights.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  6. #286
    Join Date
    Nov 2015
    Posts
    46
    Post Thanks / Like

    Default Re: Easy to use code for Arduino Uno/Mega. Up to 48 channels, with Random mode

    I looked through the whole thread but i didn't see anything else but the victor code.

    Sent from my SM-G960W using Tapatalk

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

    Default Re: Simple code for Arduino Uno/Mega. Up to 48 realy/SSR channels, with Random mode

    Many people use the VictorPV sketch and it has proven to be reliable. It does look for a header (~!) to signal the beginning of the data stream. I am glad to hear that it started working again.
    Kevin

Page 29 of 29 FirstFirst ... 19272829

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
  •