Skip to content

led blink code regressed again, we should maybe offer a thread based led animator #324

Closed

Description

@ensonic
  • ev3dev version: 4.4.47-19-ev3dev-ev3
  • ev3dev-lang-python version: 0.8.1

Take a look at OpenRoberta/robertalab-ev3dev@a95051b, before I was using the trigger feature and e.g. when using this with color=orange for left+right, the blinking was completely out of sync, one got the left led first turning green and maybe orange and then red and so on. With a blink thread we can do much more.

Activity

  1. WasabiFan commented on Jun 2, 2017

    @WasabiFan
    Member

    How's the performance of that blink code on the EV3? Is the blink consistent?

  2. ensonic commented on Jun 2, 2017

    @ensonic
    ContributorAuthor

    So far it works well. I'll test more and keep you posted. I don't mind to release a version with this and if it fare well extract it into the bindings. This also gives us some time to design the api.

  3. dwalton76 commented on Aug 31, 2017

    @dwalton76
    Collaborator

    @ensonic I like the idea of a thread to control led blinking...did you get this going?

  4. dwalton76 commented on Sep 1, 2017

    @dwalton76
    Collaborator

    If we had a thread class to control LED(s) would that kill the need to tackle #262 ?

  5. ensonic commented on Sep 5, 2017

    @ensonic
    ContributorAuthor

    Yes it works fine for me. I had a few courses by now and no complaints. And yes it solved the problem in #262 as well. What I like about it is that we can easilly add highlevel api with a bunch of led anims (pulsing, color cycling, ...).

  6. dwalton76 commented on Sep 7, 2017

    @dwalton76
    Collaborator

    @ensonic would you be willing to port it to here?

  7. ensonic commented on Sep 8, 2017

    @ensonic
    ContributorAuthor

    I'll take a look.

  8. bonmotwang commented on Apr 25, 2018

    @bonmotwang

    I am still getting the error
    Traceback (most recent call last):
    File "led_test.py", line 21, in
    Leds.set(Leds.LEFT, brightness_pct=0.5, trigger='timer')
    File "/usr/lib/python3/dist-packages/ev3dev/ev3.py", line 90, in set
    setattr(led, k, kwargs[k])
    File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 2516, in trigger
    raise Exception('"{}" attribute has wrong permissions'.format(attr))
    Exception: "delay_on" attribute has wrong permissions

    My code:
    Leds.all_off()

    Leds.set(Leds.LEFT, brightness_pct=0.5, trigger='timer')
    Leds.set(Leds.LEFT, delay_on=3000, delay_off=500)
    Leds.set_color(Leds.LEFT, Leds.RED)

  9. dlech commented on Apr 25, 2018

    @dlech
    Member

    Try putting a delay between setting the trigger to 'timer' and setting the delay_* attributes. Udev needs time to properly set the permissions of those attributes.

    import time
    
    Leds.all_off()
    
    Leds.set(Leds.LEFT, brightness_pct=0.5, trigger='timer')
    time.sleep(0.5)
    Leds.set(Leds.LEFT, delay_on=3000, delay_off=500)
    Leds.set_color(Leds.LEFT, Leds.RED)
  10. added a commit that references this issue on Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions