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.

Class

LED

Name

close()

Examples
import processing.io.*;
LED greenLed;
boolean ledOn = false;

void setup() {
  // the green LED is led0 on the Raspberry Pi
  greenLed = new LED("led0");
  frameRate(1);
}

void draw() {
  ledOn = !ledOn;
  if (ledOn) {
  	greenLed.brightness(1.0);
  } else {
  	greenLed.brightness(0.0);
  }
}

// cleanup on keypress
void keyPressed() {
  led.close();
  exit();
}

Description Restores the previous state

Without calling this function the LED will remain in the current state even after the sketch has been closed.
Syntax
.close()
Returnsvoid
Updated on January 21, 2019 10:05:14am EST

Creative Commons License