Skip to content

Instantly share code, notes, and snippets.

@mactkg
Forked from bureibusan/gist:289d639cf237ba9a4854
Last active August 29, 2015 14:03
Show Gist options
  • Save mactkg/cf8f1554174951aafede to your computer and use it in GitHub Desktop.
Save mactkg/cf8f1554174951aafede to your computer and use it in GitHub Desktop.
//===============================
// arduino
//===============================
void setup(){
Serial.begin(9600);
pinMode(13,INPUT);
}
void loop(){
int val=digitalRead(13);
Serial.write(val);
}
//===============================
// processing
//===============================
import processing.serial.*;
Serial port;
void setup(){
size(200,200);
port = new Serial(this,"COM3",9600);
}
void draw(){
delay(100);
println(receive);
}
int receive;
void serialEvent(Serial p){
delay(100);
receive = p.read();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment