4 Replies Latest reply on Jan 9, 2016 10:22 PM by kylegray

    Edison timing issue?

    kylegray

      I am trying to control an rgb led with an Intel Edison and arduino breakout board and I noticed that when I try to turn all 3 nodes off at the same time, there is a slight delay between when each one turns off. In the below example red (pin 6) turns off first followed by green (pin 5) and blue (pin 3). The time difference is really small but noticeable, is there any way I can fix this problem?

      Example of code:

      #define green 5

      #define blue 3

      #define red 6

       

       

      void setup() {

        // put your setup code here, to run once:

        pinMode(green, OUTPUT);

        pinMode(blue, OUTPUT);

        pinMode(red, OUTPUT);

      }

       

       

      void loop() {

        // put your main code here, to run repeatedly:

        analogWrite(blue, 255* .2);

        analogWrite(green, 255 * .34);

        analogWrite(red, 255 );

        delay(1000);

        analogWrite(red, LOW);

        analogWrite(green, LOW);

        analogWrite(blue, LOW );

        delay(1000);

      }

        • 1. Re: Edison timing issue?
          Intel_Alvarado

          Hi,

           

          I tested the code and it compiled successfully. What RGB led strip are you using specifically?  Some strips use protocols that are very timing specific and will require some additional work to get them working. Others may require you to use specific libraries to get the strip working properly. Do you see any change in behavior if you put the analogWrite() values to 255 instead of different values?

           

          Sergio

          • 2. Re: Edison timing issue?
            kylegray

            Hello,

             

            I'm just using a single 4 pin RGB led with hooked up to the PWM pins. The problem seems to be that its not running fast enough. I have also tried a program I wrote that fades between colors, when I run it on my Arduino Uno the colors change smoothly but when I run it on the Edison the light flickers slightly as it changes. it does not seem to matter what values I use either (I scaled back the green and blue colors because they are brighter than the red and I wanted to make the led white, I actually meant to take that out before posting it). Is there any way I can speed up the interval that the PWM's are running off of?   

            • 3. Re: Edison timing issue?
              Intel_Alvarado

              To what frequency are you running the PWM, what speed do you need to reach? Have you already seen this Edison/setPWM_Edison.ino at master · MakersTeam/Edison · GitHub ?

               

              Sergio

              • 4. Re: Edison timing issue?
                kylegray

                Thanks for the information. It did not end up fixing it but it led me to the discovery that Edison does not like analogWrite() being set to zero. If I use analogWrite to try and turn off the led it turns it on high for whatever reason and because the blue is the brightest color it appeared to be turning blue off last when in reality they were all still on. Instead I found using digitalWrite solves the problem.