Class Name

LED

Description

Opens a LED device.

This class can control your computer's build-in LEDs, such as the ones commonly used to indicate the power status and disk activity.

Your operating system might not be set up to allow regular users to do this kind of modification. If this is the case you should install a so-called udev rule that relaxes the permissions for the files in /sys/class/leds. You can also try running Processing as root user using "sudo", but this is generally not recommended.

Examples

  • import processing.io.*;
    LED greenLed;
    boolean ledOn = false;
    
    void setup() {
      // list all available LEDs
      printArray(LED.list());
    
      // the green LED is led0 on the Raspberry Pi
      greenLed = new LED("led0");
      frameRate(0.5);
    }
    
    void draw() {
      ledOn = !ledOn;
      if (ledOn) {
      	greenLed.brightness(1.0);
      } else {
      	greenLed.brightness(0.0);
      }
    }
    
    

Constructors

  • LED(dev)

Parameters

  • devdevice name

Methods