MCPcopy Index your code
hub / github.com/processing/processing / brightness

Method brightness

java/libraries/io/src/processing/io/LED.java:111–126  ·  view source on GitHub ↗

Sets the brightness @param bright 0.0 (off) to 1.0 (maximum) @webref

(float bright)

Source from the content-addressed store, hash-verified

109 * @webref
110 */
111 public void brightness(float bright) {
112 if (bright < 0.0 || 1.0 < bright) {
113 System.err.println("Brightness must be between 0.0 and 1.0.");
114 throw new IllegalArgumentException("Illegal argument");
115 }
116
117 if (NativeInterface.isSimulated()) {
118 return;
119 }
120
121 String fn = "/sys/class/leds/" + dev + "/brightness";
122 int ret = NativeInterface.writeFile(fn, Integer.toString((int)(bright * maxBrightness)));
123 if (ret < 0) {
124 throw new RuntimeException(fn + ": " + NativeInterface.getError(ret));
125 }
126 }
127
128
129 /**

Callers

nothing calls this directly

Calls 5

isSimulatedMethod · 0.95
writeFileMethod · 0.95
getErrorMethod · 0.95
printlnMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected