Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ev3dev.Ev3Leds.redLeft.flash repeorts error :EACCES, permission denied '/sys/class/leds/ev3:left:red:ev3dev/delay_on' #26

Open
aifer2007 opened this issue Mar 9, 2018 · 2 comments

Comments

@aifer2007
Copy link

aifer2007 commented Mar 9, 2018

Hi,

I install ev3dev on my LEGO EV3.

My code:

var ev3dev = require("ev3dev-lang");
if(!ev3dev.Ev3Leds.isConnected) {
    console.error("This sample can only run on the EV3 brick. Other platforms are not supported by this script.");
    process.exit(1);
  }
ev3dev.Ev3Leds.redLeft.flash(1,1);

Error reported:

There was an error while writing to the property file "/sys/class/leds/ev3:left:red:ev3dev/delay_on".
Inner error:
  Error: EACCES, permission denied '/sys/class/leds/ev3:left:red:ev3dev/delay_on'

The I check /sys/class/leds/ev3:left:red:ev3dev for delay_on :

robot@ev3dev:~/app$ cd /sys/class/leds/ev3:left:red:ev3dev
robot@ev3dev:/sys/class/leds/ev3:left:red:ev3dev$ ls
brightness  device  max_brightness  power  subsystem  trigger  uevent

There is no delay_on file.

What should I do?

@aifer2007
Copy link
Author

I try the code and get the same error

var redLeft = new ev3dev.LED("ev3:left:red:ev3dev");
var redRight = new ev3dev.LED("ev3:right:red:ev3dev");
redLeft.flash(1,1);
redRight.flash(1,1);

But the code below works well.

var redLeft = new ev3dev.LED("ev3:left:red:ev3dev");
var redRight = new ev3dev.LED("ev3:right:red:ev3dev");
redLeft.on();
redRight.on();

@WasabiFan
Copy link
Owner

I think there are two problems here. First, there is a known issue with the LED drivers where the delay_* properties are only created once trigger is set, and there is a small delay between those two events occurring (ev3dev/ev3dev#225). Second, I think the ordering is wrong here:

public flash(onInterval: number, offInterval: number) {
this.delayOn = onInterval;
this.delayOff = offInterval;
this.trigger = "timer";
}

So, as a stopgap, I'd suggest adding ev3dev.Ev3Leds.redLeft.trigger = "timer" (and likewise for other LEDs) to the top of your program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants