Created
November 26, 2015 14:41
-
-
Save starlightme/a786b4282a20b3e69eab to your computer and use it in GitHub Desktop.
receive serial data and plot
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
int i; | |
void setup(){ | |
Serial.begin(9600); | |
} | |
void loop(){ | |
i++; | |
Serial.write(150 + i); | |
delay(1000); | |
} |
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
import processing.serial.*; | |
Serial myPort; // The serial port | |
void setup() { | |
size(400,400); | |
smooth(); | |
// List all the available serial ports | |
printArray(Serial.list()); | |
// Open the port you are using at the rate you want: | |
myPort = new Serial(this, Serial.list()[0], 9600); | |
} | |
void draw() { | |
while (myPort.available() > 0) { | |
int inByte = myPort.read(); | |
println(inByte); | |
ellipse(200,inByte,100,100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment