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

Method list

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

Lists all available LED devices @return String array @webref

()

Source from the content-addressed store, hash-verified

156 * @webref
157 */
158 public static String[] list() {
159 if (NativeInterface.isSimulated()) {
160 // as on the Raspberry Pi
161 return new String[]{ "led0", "led1" };
162 }
163
164 ArrayList<String> devs = new ArrayList<>();
165 File dir = new File("/sys/class/leds");
166 File[] files = dir.listFiles();
167 if (files != null) {
168 for (File file : files) {
169 devs.add(file.getName());
170 }
171 }
172 // listFiles() does not guarantee ordering
173 String[] tmp = devs.toArray(new String[devs.size()]);
174 Arrays.sort(tmp);
175 return tmp;
176 }
177}

Callers 1

Calls 6

isSimulatedMethod · 0.95
listFilesMethod · 0.45
addMethod · 0.45
getNameMethod · 0.45
sizeMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected