示例#1
0
文件: FadeRgb.java 项目: koert/gpio
 private void fade(Color from, Color to) throws IOException {
   for (int i = 0; i <= 1000; i++) {
     float r = from.red + i * (to.red - from.red) / 1000;
     float g = from.green + i * (to.green - from.green) / 1000;
     float b = from.blue + i * (to.blue - from.blue) / 1000;
     System.out.printf("rgb %1.3f  %1.3f  %1.3f\r", r, g, b);
     red.dutyCycle(r);
     green.dutyCycle(g);
     blue.dutyCycle(b);
     try {
       Thread.sleep(10);
     } catch (InterruptedException e) {
     }
   }
 }
示例#2
0
文件: FadeRgb.java 项目: koert/gpio
 public void close() throws IOException {
   red.close();
   green.close();
   blue.close();
 }