MCPcopy Index your code
hub / github.com/benfry/processing4 / list

Method list

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

Lists all available LED devices @return String array @webref LED @webBrief Lists all available LED devices

()

Source from the content-addressed store, hash-verified

176 * @webBrief Lists all available LED devices
177 */
178 public static String[] list() {
179 if (NativeInterface.isSimulated()) {
180 // as on the Raspberry Pi
181 return new String[]{ "led0", "led1" };
182 }
183
184 ArrayList<String> devs = new ArrayList<>();
185 File dir = new File("/sys/class/leds");
186 File[] files = dir.listFiles();
187 if (files != null) {
188 for (File file : files) {
189 devs.add(file.getName());
190 }
191 }
192 // listFiles() does not guarantee ordering
193 String[] tmp = devs.toArray(new String[devs.size()]);
194 Arrays.sort(tmp);
195 return tmp;
196 }
197}

Callers 3

createFakeCodeFolderMethod · 0.45
filterPredictionsMethod · 0.45

Calls 7

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

Tested by 1

createFakeCodeFolderMethod · 0.36