Más contenido relacionado
ProcessingとArduinoの連携
- 5. Processing
void setup(){
size( 255, 255 ); //
}
void draw() { //
background( 255 ); //
noStroke(); //
color cl = color( 255, 255, 0, 127 ); // R,G,B,α
fill( cl ); //
ellipse( 100, 100, 50, 50 ); // ( x, y, w, h );
}
- 6. Arduino
• Arduino
– シリアルポートに可変抵抗の値をバイト値で送信
– port.print( val, BYTE );
• Processing
– シリアルポートからバイト値を受信
– int val = port.read();
•
- 7. Arduino
int val = 0;
void setup(){
Serial.begin( 9600 );
}
void loop(){
val = analogRead( 0 ) / 4; // 4 1byte
Serial.print( val, BYTE ); //
delay( 50 ); //
}
- 9. Processing
• 2008: Processing
– http://kousaku-
kousaku.blogspot.com/2008/07/processing_10.html
• Processing
– http://yoppa.jpn.org/presen.php?itemid=169
• yasushi noguchi class » Processing
– http://r-dimension.xsrv.jp/classes_j/processing/
- 10. C#(.NET)
• SerialPort
•
– 浅草ギ研 Visual C# 2005 のシリアル通信機
能を使ってみる
http://www.robotsfx.com/robot/robohow/R
oboHow60/RoboHow60.html
- 11. C#(.NET)
• SerialPort Form
• BaudRate 9600
• PortName ”COM4”
• Form serialPort1.Open()
• Form serialPort1.Close()
• DataReceived ReadByte
• Write
– var byteArray = new byte[] = { 1, 2, 3, 4, 5 };
– serialPort1.Write( byteArray, 0, 5 ); // 配列の0番から5個送信
- 12. Flash/AIR
•
•
•
• Funnel
• Flash(AIR)
TECH Matari
– http://tech.ironhearts.com/blog/archives/39