Last active
December 11, 2015 07:48
-
-
Save shinnn/4568892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ArduinoなどのUSBデバイスを繋いでいる状態でこれを実行すると、 | |
デバイス名がクリップボードにコピーされる | |
そのまま Quartz Composer の、Kineme Serial Inputの Device 欄にペーストすると | |
Quartz Composerでのシリアル通信が始まる | |
*/ | |
import java.awt.datatransfer.Clipboard; | |
import java.awt.datatransfer.StringSelection; | |
import processing.serial.Serial; | |
void setup(){ | |
String portName = Serial.list()[0]; | |
//参考 http://www.ne.jp/asahi/hishidama/home/tech/java/clipboard.html | |
Clipboard clip = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); | |
StringSelection ss = new StringSelection(portName); | |
clip.setContents(ss, ss); | |
println( | |
"\n\"" + portName + "\"\n" | |
+ "をクリップボードにコピーしました。\n" | |
+ "目的の場所にペーストしてください。" | |
); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment