Smart Device : How to access the LED

The LEDs can be access directly from the folder /sys/class/leds

In my case I have a GPS device with only one LED running Android 4.4, I can turn on/off the LED with the following command :


public static void LedBlueOff() throws IOException {

BufferedWriter writer = new BufferedWriter(new FileWriter("/sys/class/leds/bblue/brightness"));

writer.write("0");

writer.close();

}

public static void LedBlueOn() throws IOException {

BufferedWriter writer = new BufferedWriter(new FileWriter("/sys/class/leds/bblue/brightness"));

writer.write("255");

writer.close();

}

If your device allows him you should be able to access others LEDs (red for example) and manage the intensity by setting a value between 0…255. In my case I can’t do this, consequently I can’t test it.

Categories:

Tags:

Comments are closed