Calibrate works?
This commit is contained in:
parent
26e34f7671
commit
cc711c6343
1104 changed files with 636510 additions and 75 deletions
50
lib/serial/examples/SerialDuplex/SerialDuplex.pde
Normal file
50
lib/serial/examples/SerialDuplex/SerialDuplex.pde
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Serial Duplex
|
||||
* by Tom Igoe.
|
||||
*
|
||||
* Sends a byte out the serial port when you type a key
|
||||
* listens for bytes received, and displays their value.
|
||||
* This is just a quick application for testing serial data
|
||||
* in both directions.
|
||||
*/
|
||||
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
Serial myPort; // The serial port
|
||||
int whichKey = -1; // Variable to hold keystoke values
|
||||
int inByte = -1; // Incoming serial data
|
||||
|
||||
void setup() {
|
||||
size(400, 300);
|
||||
// create a font with the third font available to the system:
|
||||
PFont myFont = createFont(PFont.list()[2], 14);
|
||||
textFont(myFont);
|
||||
|
||||
// List all the available serial ports:
|
||||
printArray(Serial.list());
|
||||
|
||||
// I know that the first port in the serial list on my mac
|
||||
// is always my FTDI adaptor, so I open Serial.list()[0].
|
||||
// In Windows, this usually opens COM1.
|
||||
// Open whatever port is the one you're using.
|
||||
String portName = Serial.list()[0];
|
||||
myPort = new Serial(this, portName, 9600);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
text("Last Received: " + inByte, 10, 130);
|
||||
text("Last Sent: " + whichKey, 10, 100);
|
||||
}
|
||||
|
||||
void serialEvent(Serial myPort) {
|
||||
inByte = myPort.read();
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
// Send the keystroke out:
|
||||
myPort.write(key);
|
||||
whichKey = key;
|
||||
}
|
||||
|
||||
BIN
lib/serial/examples/SerialDuplex/data/CourierNewPSMT-24.vlw
Normal file
BIN
lib/serial/examples/SerialDuplex/data/CourierNewPSMT-24.vlw
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue