Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Removing Random from Victors sketch

  1. #11
    Join Date
    Nov 2016
    Posts
    12
    Post Thanks / Like

    Default Re: Removing Random from Victors sketch

    so how would i change the random code so that instead of random channels they all come on and stay on instead of randomizing.

  2. #12
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    2,374
    Post Thanks / Like

    Default Re: Removing Random from Victors sketch

    One way would be to skip the random function and just set the lights on. If you want to use an arduino to control your lights and want to customize the routines, you need to learn to read/write code.

    The random code is generated by this section below.
    The random(0,2) function will create a number 0,1,2 that is put into random_a.
    The next section is looking for 0 and turning "off" the pin (setting it to low). Depending on the how your SSRs work, they will either be turning on or turning off your lights by this action. So, right there is your chance to change the behavior. Figure out if you need low or high to turn on your lights and set the value accordingly.
    The "else" will also change to low or high (same as your equal to 0 section). This will cause your lights to go on in either case (equal to 0 or not equal to 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);
    }

Page 2 of 2 FirstFirst 12

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
  •