-
-
Save mactkg/cf8f1554174951aafede 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 | |
//=============================== | |
void setup(){ | |
Serial.begin(9600); | |
pinMode(13,INPUT); | |
} | |
void loop(){ | |
int val=digitalRead(13); | |
Serial.write(val); | |
} |
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
//=============================== | |
// 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