Results 1 to 3 of 3

Thread: Arduino in resting is at 255 when it should be 0

  1. #1
    Join Date
    Aug 2018
    Post Thanks / Like

    Default Arduino in resting is at 255 when it should be 0

    Hiya, new to the forum and I have a problem with my script that I can't figure out, it's almost like it's reversed because when Vixen is telling my Arduino to turn the light on it's turning it off and the rest position is the light turned on. Any fixes I can make to this code? I am using a 16 Channel configuration

    16 Channels Lighting Controller
    By smching ( modified by Thomas Morley
    Allow Arduino Uno to communicate with Vixen via generic serial plugin
    #define CHANNELS_COUNT 16
    ////////// PWM pin
    #define Ch1 22 // PWM Pin 22
    #define Ch2 23 // PWM Pin 23
    #define Ch3 24 // PWM Pin 24
    #define Ch4 25 // PWM Pin 25
    #define Ch5 26 // PWM Pin 26
    #define Ch6 27 // PWM Pin 27
    #define Ch7 28 // PWM Pin 28
    #define Ch8 29 // PWM Pin 29
    #define Ch9 30 // PWM Pin 30
    #define Ch10 31 // PWM Pin 31
    #define Ch11 32 // PWM Pin 32
    #define Ch12 33 // PWM Pin 33
    #define Ch13 34 // DIGITAL Pin 34
    #define Ch14 35 // DIGITAL Pin 35
    #define Ch15 36 // DIGITAL Pin 36
    #define Ch16 37 // DIGITAL Pin 37
    int Ch[CHANNELS_COUNT] = {Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7, Ch8, Ch9, Ch10, Ch11, Ch12, Ch13, Ch14, Ch15, Ch16};
    int incomingByte[CHANNELS_COUNT]; // array to store the values from serial port
    bool runningSeq = false;
    void setup()
    Serial.begin(9600); // set up Serial at 9600 bps
    for (byte i=0; i<CHANNELS_COUNT; i++){
    pinMode(Ch[i], OUTPUT); // declare channel pin as an output
    delay (200);
    digitalWrite(Ch[i], HIGH);
    void loop() {
    if (Serial.available() >= CHANNELS_COUNT) {
    for (int i=0; i<CHANNELS_COUNT; i++) {
    incomingByte[i] =; // read each byte
    if (i<17) { //arduino mega consists of 12 PWM
    if (Ch[i], incomingByte[i] < 10){
    digitalWrite(Ch[i], LOW ); // Write the Digital Output to the LED pin.
    digitalWrite(Ch[i], HIGH );
    void lightsOn(){
    for (byte i=0; i<CHANNELS_COUNT; i++){
    if (i<16) { digitalWrite(Ch[i], HIGH);

  2. #2
    Join Date
    Jan 2008
    Malden MA
    Post Thanks / Like

    Default Re: Arduino in resting is at 255 when it should be 0

    Do your lights turn on when you set the Arduino pin high or low? It sounds like whatever you are driving turns the lights on with a low on the Arduino's pin. In that case, swap the LOW and HIGH in the digital.write statement in loop()


  3. #3
    Join Date
    Dec 2012
    Hudson MA
    Post Thanks / Like

    Default Re: Arduino in resting is at 255 when it should be 0

    There are many things wrong with this code. However, the most likely issue is the polarity on the outputs. What are you driving with the outputs? What are you using the pwd outputs for? Why are you saving the data in the array as opposed to a local variable (uses fewer clock cycles), why are you saving to an int when you are using a byte (conversion from unsigned byte to a signed int is going to do weird things), where is your sync code (without it you will have a tough time keeping ch1 data going out to ch1).

    I suggest you look at the relay code discussed in this post:

    2019 - Going to visit my Daughter in New Zealand (again). I will be dark for the 2nd year in a row. Sigh..


Posting Permissions

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