Skip to content

Instantly share code, notes, and snippets.

@bureibusan
Created July 13, 2014 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bureibusan/289d639cf237ba9a4854 to your computer and use it in GitHub Desktop.
Save bureibusan/289d639cf237ba9a4854 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.println(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(){
delay(100);
receive = port.read();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment