Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Esp GPIO

  1. #1
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Esp GPIO

    Does anyone have the secret code to invert the pins from active high to active low and vise versa ?
    Thanks

    I see that the dumb rgb can be controlled directly but unfortunately they are off while data and on while no data .

  2. #2
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,633
    Post Thanks / Like

    Default Re: Esp GPIO

    It depends on the build environment. Are you using Arduino?

    In Arduino you have to manually define on and off as needed for your project.
    #define ON LOW
    #define OFF HIGH

    Then use:

    digitalWrite(PinId, ON);
    digitalWrite(PinId, OFF);


    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.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  3. #3
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Esp GPIO

    Hi Martin

    Thanks for your reply .I have tried a few ways with your suggested method
    and only achieved turning the leds of completely.
    How would I incorporate the on off into this ?

    digitalWrite(input_1_blue, e131.data[channel_1_blue]);

    I may just have to be content with reverse sequencing lmao.
    Last edited by angus40; 09-11-2019 at 07:36 PM.

  4. #4
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,051
    Post Thanks / Like

    Default Re: Esp GPIO

    There are two ways to invert if not doing simple on off. say you have an unsigned int in the range 0- 255. simple inversion is 255 - x. a more complex inversion can be done with map described https://www.arduino.cc/reference/en/...ions/math/map/

  5. #5
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Esp GPIO

    Thanks Mike . I have tried everything to avoid extra parts but I think the only way is to use the mosfet circuit .
    Best I can get without the extras is reverse sequencing and only have on / off control . The downer with it is the lights would be continually on once the sequence ended but then again it is only for 7 pairs of eyes .

  6. #6
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,633
    Post Thanks / Like

    Default Re: Esp GPIO

    digitalWrite(input_1_blue, e131.data[channel_1_blue]);

    becomes

    digitalWrite(input_1_blue, (0 == e131.data[channel_1_blue]) ? OFF : ON));

    But this just gives you on or off. If you want to dim, then you need to generate a PWM signal which is very different.
    Last edited by MartinMueller2003; 09-12-2019 at 07:34 AM.


    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.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  7. #7
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,633
    Post Thanks / Like

    Default Re: Esp GPIO

    If you want to dim then you need to use a PWM channel. For a PWM channel you use the inversion example: PwmAccessMethod(id, value) where value = 0^InputDataFromE131 (^ == xor)


    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.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  8. #8
    Join Date
    Dec 2011
    Location
    Key West, FL
    Posts
    3,627
    Post Thanks / Like

    Default Re: Esp GPIO

    Quote Originally Posted by MartinMueller2003 View Post
    digitalWrite(input_1_blue, e131.data[channel_1_blue]);

    becomes

    digitalWrite(input_1_blue, (0 == e131.data[channel_1_blue]) ? OFF : ON));

    But this just gives you on or off. If you want to dim, then you need to generate a PWM signal which is very different.
    Martin: Your suggestion would be correct without the "0 == "

    As posted the instruction says if Value is == 0 (this is a TRUE) hence return/use OFF ... which is not what you wanted

    Correct way and uses less bytes in instruction:

    digitalWrite(input_1_blue, (e131.data[channel_1_blue]) ? OFF : ON));

    Now -- if e131.data[channel_1_blue is NON-Zero the value used is OFF whixh is the reversal you are attempting to get.

    My suggestion:

    #define Bit_Reversal(V) (V ? 0 : 1)


    now the example

    digitalWrite(input_1_blue, Bit_Reversal(e131.data[channel_1_blue]));


    Not to be picky.

    Joe
    Last edited by JHinkle; 09-12-2019 at 11:54 AM.
    Link to my DownLoad Site: [B][COLOR=#ff0000][URL]http://www.joehinkle.com/HLS[/URL]

    [/COLOR][/B][IMG]http://joehinkle.com/HLS/HLS%20Logo%20Small.jpg[/IMG]

  9. #9
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Esp GPIO

    Quote Originally Posted by martinmueller2003 View Post
    if you want to dim then you need to use a pwm channel. For a pwm channel you use the inversion example: Pwmaccessmethod(id, value) where value = 0^inputdatafrome131 (^ == xor)
    thank you

  10. #10
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Esp GPIO

    Firstly my apology for asking a question and providing wrong data .
    digitalWrite(input_1_blue, e131.data[channel_1_blue]); <<< should have been
    analogWrite(output_1_blue, e131.data[channel_1_blue]);

    Your willingness to help is unprecedented so Thanks very much for your detailed replies.

    Both solutions worked for different Write methods and my brain grew 3 sizes today lol

    Joe's solution gave a cleancut digital solution and that was mistakenly my fault in the example I posted

    Martin nailed it with this thanks for the push in the right direction
    If you want to dim then you need to use a PWM channel. For a PWM channel you use the inversion example: PwmAccessMethod(id, value) where value = 0^InputDataFromE131 (^ == xor)

    Analog blinded me to the actual issue .

    Woot now have direct control and dimming of RGB !!!!!

    Thanks much

Page 1 of 2 12 LastLast

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
  •