2-20This Processing code is a quick way to test if your Xport can connect to a server.
import processing.serial.*;
Serial myPort;
void setup() {
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
//nothing
}
void keyReleased() {
println(key);
switch (key) {
case 'c':
myPort.write("C128.122.253.189/80\n");
break;
case 's':
myPort.write("GET /~tqi6023/scraper2.php HTTP/1.1\n");
myPort.write("HOST: itp.nyu.edu\n\n");
break;
}
}
void serialEvent(Serial myPort) {
if (myPort.available() > 0) {
print(char(myPort.read()));
}
}
|