This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

LED

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);
  }
}

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.
Methods
brightness() Sets the brightness
close() Restores the previous state
list() Lists all available LED devices
Constructor
LED(dev)
Parameters
dev String: device name
Updated on October 2, 2018 05:02:13pm EDT

Creative Commons License