add arduino-0018-linux (32 bit)
This commit is contained in:
parent
7fa52a235a
commit
297de2a227
425 changed files with 64818 additions and 0 deletions
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
ASCII table
|
||||
|
||||
Prints out byte values in all possible formats:
|
||||
* as raw binary values
|
||||
* as ASCII-encoded decimal, hex, octal, and binary values
|
||||
|
||||
For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
|
||||
|
||||
The circuit: No external hardware needed.
|
||||
|
||||
created 2006
|
||||
by Nicholas Zambetti
|
||||
modified 18 Jan 2009
|
||||
by Tom Igoe
|
||||
|
||||
<http://www.zambetti.com>
|
||||
*/
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
|
||||
// prints title with ending line break
|
||||
Serial.println("ASCII Table ~ Character Map");
|
||||
}
|
||||
|
||||
// first visible ASCIIcharacter '!' is number 33:
|
||||
int thisByte = 33;
|
||||
// you can also write ASCII characters in single quotes.
|
||||
// for example. '!' is the same as 33, so you could also use this:
|
||||
//int thisByte = '!';
|
||||
|
||||
void loop()
|
||||
{
|
||||
// prints value unaltered, i.e. the raw binary version of the
|
||||
// byte. The serial monitor interprets all bytes as
|
||||
// ASCII, so 33, the first number, will show up as '!'
|
||||
Serial.print(thisByte, BYTE);
|
||||
|
||||
Serial.print(", dec: ");
|
||||
// prints value as string as an ASCII-encoded decimal (base 10).
|
||||
// Decimal is the default format for Serial.print() and Serial.println(),
|
||||
// so no modifier is needed:
|
||||
Serial.print(thisByte);
|
||||
// But you can declare the modifier for decimal if you want to.
|
||||
//this also works if you uncomment it:
|
||||
|
||||
// Serial.print(thisByte, DEC);
|
||||
|
||||
|
||||
Serial.print(", hex: ");
|
||||
// prints value as string in hexadecimal (base 16):
|
||||
Serial.print(thisByte, HEX);
|
||||
|
||||
Serial.print(", oct: ");
|
||||
// prints value as string in octal (base 8);
|
||||
Serial.print(thisByte, OCT);
|
||||
|
||||
Serial.print(", bin: ");
|
||||
// prints value as string in binary (base 2)
|
||||
// also prints ending line break:
|
||||
Serial.println(thisByte, BIN);
|
||||
|
||||
// if printed last visible character '~' or 126, stop:
|
||||
if(thisByte == 126) { // you could also use if (thisByte == '~') {
|
||||
// This loop loops forever and does nothing
|
||||
while(true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// go on to the next character
|
||||
thisByte++;
|
||||
}
|
360
arduino-0018-linux/examples/Communication/Dimmer/Dimmer.pde
Normal file
360
arduino-0018-linux/examples/Communication/Dimmer/Dimmer.pde
Normal file
|
@ -0,0 +1,360 @@
|
|||
/*
|
||||
Dimmer
|
||||
|
||||
Demonstrates the sending data from the computer to the Arduino board,
|
||||
in this case to control the brightness of an LED. The data is sent
|
||||
in individual bytes, each of which ranges from 0 to 255. Arduino
|
||||
reads these bytes and uses them to set the brightness of the LED.
|
||||
|
||||
The circuit:
|
||||
LED attached from digital pin 9 to ground.
|
||||
Serial connection to Processing, Max/MSP, or another serial application
|
||||
|
||||
created 2006
|
||||
by David A. Mellis
|
||||
modified 14 Apr 2009
|
||||
by Tom Igoe and Scott Fitzgerald
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/Dimmer
|
||||
*/
|
||||
|
||||
const int ledPin = 9; // the pin that the LED is attached to
|
||||
|
||||
void setup()
|
||||
{
|
||||
// initialize the serial communication:
|
||||
Serial.begin(9600);
|
||||
// initialize the ledPin as an output:
|
||||
pinMode(ledPin, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
byte brightness;
|
||||
|
||||
// check if data has been sent from the computer:
|
||||
if (Serial.available()) {
|
||||
// read the most recent byte (which will be from 0 to 255):
|
||||
brightness = Serial.read();
|
||||
// set the brightness of the LED:
|
||||
analogWrite(ledPin, brightness);
|
||||
}
|
||||
}
|
||||
|
||||
/* Processing code for this example
|
||||
// Dimmer - sends bytes over a serial port
|
||||
// by David A. Mellis
|
||||
|
||||
import processing.serial.*;
|
||||
Serial port;
|
||||
|
||||
void setup() {
|
||||
size(256, 150);
|
||||
|
||||
println("Available serial ports:");
|
||||
println(Serial.list());
|
||||
|
||||
// Uses the first port in this list (number 0). Change this to
|
||||
// select the port corresponding to your Arduino board. The last
|
||||
// parameter (e.g. 9600) is the speed of the communication. It
|
||||
// has to correspond to the value passed to Serial.begin() in your
|
||||
// Arduino sketch.
|
||||
port = new Serial(this, Serial.list()[0], 9600);
|
||||
|
||||
// If you know the name of the port used by the Arduino board, you
|
||||
// can specify it directly like this.
|
||||
//port = new Serial(this, "COM1", 9600);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
// draw a gradient from black to white
|
||||
for (int i = 0; i < 256; i++) {
|
||||
stroke(i);
|
||||
line(i, 0, i, 150);
|
||||
}
|
||||
|
||||
// write the current X-position of the mouse to the serial port as
|
||||
// a single byte
|
||||
port.write(mouseX);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Max/MSP v5 patch for this example
|
||||
|
||||
{
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Dimmer\n\nThis patch sends a binary number from 0 to 255 out the serial port to an Arduino connected to the port. It dims an LED attached to the Arduino.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
|
||||
"linecount" : 10,
|
||||
"patching_rect" : [ 209.0, 55.0, 344.0, 144.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-32",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "change the slider to alter the brightness of the LED",
|
||||
"linecount" : 3,
|
||||
"patching_rect" : [ 90.0, 235.0, 117.0, 48.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-7",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "number",
|
||||
"patching_rect" : [ 215.0, 385.0, 50.0, 19.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int", "bang" ],
|
||||
"id" : "obj-6",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "slider",
|
||||
"patching_rect" : [ 215.0, 235.0, 20.0, 140.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "" ],
|
||||
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
|
||||
"id" : "obj-1",
|
||||
"size" : 256.0,
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 0 1",
|
||||
"patching_rect" : [ 342.0, 305.0, 62.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-30",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to close the serial port",
|
||||
"patching_rect" : [ 390.0, 396.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-26",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to open the serial port",
|
||||
"patching_rect" : [ 415.0, 370.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-27",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "close",
|
||||
"patching_rect" : [ 342.0, 396.0, 39.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-21",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "port a",
|
||||
"patching_rect" : [ 364.0, 370.0, 41.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-19",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click here to get a list of serial ports",
|
||||
"patching_rect" : [ 435.0, 344.0, 207.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-2",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 342.0, 268.0, 15.0, 15.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-11",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "print",
|
||||
"patching_rect" : [ 384.0, 344.0, 36.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-13",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "serial a 9600",
|
||||
"patching_rect" : [ 259.0, 420.0, 84.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int", "" ],
|
||||
"id" : "obj-14",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to start",
|
||||
"patching_rect" : [ 369.0, 268.0, 117.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-17",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "panel",
|
||||
"patching_rect" : [ 215.0, 235.0, 21.0, 139.0 ],
|
||||
"numoutlets" : 0,
|
||||
"mode" : 1,
|
||||
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
|
||||
"id" : "obj-8",
|
||||
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
|
||||
"numinlets" : 1,
|
||||
"angle" : 270.0
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-30", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 351.0, 296.0, 351.5, 296.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 1 ],
|
||||
"destination" : [ "obj-19", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 0 ],
|
||||
"destination" : [ "obj-21", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-21", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 351.5, 416.5, 268.5, 416.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-19", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 373.5, 393.5, 268.5, 393.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-13", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 393.5, 365.5, 268.5, 365.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-1", 0 ],
|
||||
"destination" : [ "obj-6", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-6", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 224.5, 411.5, 268.5, 411.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
578
arduino-0018-linux/examples/Communication/Graph/Graph.pde
Normal file
578
arduino-0018-linux/examples/Communication/Graph/Graph.pde
Normal file
|
@ -0,0 +1,578 @@
|
|||
/*
|
||||
Graph
|
||||
|
||||
A simple example of communication from the Arduino board to the computer:
|
||||
the value of analog input 0 is sent out the serial port. We call this "serial"
|
||||
communication because the connection appears to both the Arduino and the
|
||||
computer as a serial port, even though it may actually use
|
||||
a USB cable. Bytes are sent one after another (serially) from the Arduino
|
||||
to the computer.
|
||||
|
||||
You can use the Arduino serial monitor to view the sent data, or it can
|
||||
be read by Processing, PD, Max/MSP, or any other program capable of reading
|
||||
data from a serial port. The Processing code below graphs the data received
|
||||
so you can see the value of the analog input changing over time.
|
||||
|
||||
The circuit:
|
||||
Any analog input sensor is attached to analog in pin 0.
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/Graph
|
||||
|
||||
created 2006
|
||||
by David A. Mellis
|
||||
modified 14 Apr 2009
|
||||
by Tom Igoe and Scott Fitzgerald
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/Graph
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the serial communication:
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// send the value of analog input 0:
|
||||
Serial.println(analogRead(0));
|
||||
// wait a bit for the analog-to-digital converter
|
||||
// to stabilize after the last reading:
|
||||
delay(10);
|
||||
}
|
||||
|
||||
/* Processing code for this example
|
||||
|
||||
// Graphing sketch
|
||||
|
||||
|
||||
// This program takes ASCII-encoded strings
|
||||
// from the serial port at 9600 baud and graphs them. It expects values in the
|
||||
// range 0 to 1023, followed by a newline, or newline and carriage return
|
||||
|
||||
// Created 20 Apr 2005
|
||||
// Updated 18 Jan 2008
|
||||
// by Tom Igoe
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
Serial myPort; // The serial port
|
||||
int xPos = 1; // horizontal position of the graph
|
||||
|
||||
void setup () {
|
||||
// set the window size:
|
||||
size(400, 300);
|
||||
|
||||
// List all the available serial ports
|
||||
println(Serial.list());
|
||||
// I know that the first port in the serial list on my mac
|
||||
// is always my Arduino, so I open Serial.list()[0].
|
||||
// Open whatever port is the one you're using.
|
||||
myPort = new Serial(this, Serial.list()[0], 9600);
|
||||
// don't generate a serialEvent() unless you get a newline character:
|
||||
myPort.bufferUntil('\n');
|
||||
// set inital background:
|
||||
background(0);
|
||||
}
|
||||
void draw () {
|
||||
// everything happens in the serialEvent()
|
||||
}
|
||||
|
||||
void serialEvent (Serial myPort) {
|
||||
// get the ASCII string:
|
||||
String inString = myPort.readStringUntil('\n');
|
||||
|
||||
if (inString != null) {
|
||||
// trim off any whitespace:
|
||||
inString = trim(inString);
|
||||
// convert to an int and map to the screen height:
|
||||
float inByte = float(inString);
|
||||
inByte = map(inByte, 0, 1023, 0, height);
|
||||
|
||||
// draw the line:
|
||||
stroke(127,34,255);
|
||||
line(xPos, height, xPos, height - inByte);
|
||||
|
||||
// at the edge of the screen, go back to the beginning:
|
||||
if (xPos >= width) {
|
||||
xPos = 0;
|
||||
background(0);
|
||||
}
|
||||
else {
|
||||
// increment the horizontal position:
|
||||
xPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* Max/MSP v5 patch for this example
|
||||
{
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Graph\n\nThis patch takes a string, containing ASCII formatted number from 0 to 1023, with a carriage return and linefeed at the end. It converts the string to an integer and graphs it.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
|
||||
"linecount" : 10,
|
||||
"patching_rect" : [ 479.0, 6.0, 344.0, 144.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-32",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 0 1",
|
||||
"patching_rect" : [ 327.0, 80.0, 62.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-30",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to close the serial port",
|
||||
"patching_rect" : [ 412.0, 231.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-26",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to open the serial port",
|
||||
"patching_rect" : [ 412.0, 205.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-27",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "close",
|
||||
"patching_rect" : [ 327.0, 231.0, 39.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-21",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "port a",
|
||||
"patching_rect" : [ 349.0, 205.0, 41.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-19",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "multislider",
|
||||
"candicane7" : [ 0.878431, 0.243137, 0.145098, 1.0 ],
|
||||
"patching_rect" : [ 302.0, 450.0, 246.0, 167.0 ],
|
||||
"contdata" : 1,
|
||||
"numoutlets" : 2,
|
||||
"peakcolor" : [ 0.498039, 0.498039, 0.498039, 1.0 ],
|
||||
"slidercolor" : [ 0.066667, 0.058824, 0.776471, 1.0 ],
|
||||
"candicane8" : [ 0.027451, 0.447059, 0.501961, 1.0 ],
|
||||
"outlettype" : [ "", "" ],
|
||||
"setminmax" : [ 0.0, 1023.0 ],
|
||||
"settype" : 0,
|
||||
"candicane6" : [ 0.733333, 0.035294, 0.788235, 1.0 ],
|
||||
"setstyle" : 3,
|
||||
"bgcolor" : [ 0.231373, 0.713726, 1.0, 1.0 ],
|
||||
"id" : "obj-1",
|
||||
"candicane4" : [ 0.439216, 0.619608, 0.070588, 1.0 ],
|
||||
"candicane5" : [ 0.584314, 0.827451, 0.431373, 1.0 ],
|
||||
"candicane2" : [ 0.145098, 0.203922, 0.356863, 1.0 ],
|
||||
"candicane3" : [ 0.290196, 0.411765, 0.713726, 1.0 ],
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click here to get a list of serial ports",
|
||||
"patching_rect" : [ 412.0, 179.0, 207.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-2",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Here's the number from Arduino's analog input",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 153.0, 409.0, 138.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-3",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Convert ASCII to symbol",
|
||||
"patching_rect" : [ 379.0, 378.0, 147.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-4",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Convert integer to ASCII",
|
||||
"patching_rect" : [ 379.0, 355.0, 147.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-5",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "number",
|
||||
"patching_rect" : [ 302.0, 414.0, 37.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int", "bang" ],
|
||||
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
|
||||
"id" : "obj-6",
|
||||
"triscale" : 0.9,
|
||||
"fontname" : "Arial",
|
||||
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "fromsymbol",
|
||||
"patching_rect" : [ 302.0, 378.0, 74.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-7",
|
||||
"fontname" : "Arial",
|
||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "itoa",
|
||||
"patching_rect" : [ 302.0, 355.0, 46.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-8",
|
||||
"fontname" : "Arial",
|
||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
||||
"numinlets" : 3
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "zl group 4",
|
||||
"patching_rect" : [ 302.0, 332.0, 64.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "", "" ],
|
||||
"id" : "obj-9",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 10 13",
|
||||
"patching_rect" : [ 244.0, 281.0, 77.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-10",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 244.0, 43.0, 15.0, 15.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-11",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "qmetro 10",
|
||||
"patching_rect" : [ 244.0, 80.0, 65.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang" ],
|
||||
"id" : "obj-12",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "print",
|
||||
"patching_rect" : [ 369.0, 179.0, 36.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-13",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "serial a 9600",
|
||||
"patching_rect" : [ 244.0, 255.0, 84.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int", "" ],
|
||||
"id" : "obj-14",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Read serial input buffer every 10 milliseconds",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 53.0, 72.0, 185.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-15",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "If you get newline (ASCII 10), send the list. If you get return (ASCII 13) do nothing. Any other value, add to the list",
|
||||
"linecount" : 3,
|
||||
"patching_rect" : [ 332.0, 269.0, 320.0, 48.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-16",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to open/close serial port and start/stop patch",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 271.0, 32.0, 199.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-17",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-6", 0 ],
|
||||
"destination" : [ "obj-1", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-7", 0 ],
|
||||
"destination" : [ "obj-6", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-8", 0 ],
|
||||
"destination" : [ "obj-7", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-9", 0 ],
|
||||
"destination" : [ "obj-8", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-10", 0 ],
|
||||
"destination" : [ "obj-9", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 253.5, 308.0, 311.5, 308.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-10", 2 ],
|
||||
"destination" : [ "obj-9", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 311.5, 320.0, 311.5, 320.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-14", 0 ],
|
||||
"destination" : [ "obj-10", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-12", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-12", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-13", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 378.5, 200.5, 253.5, 200.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-19", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 358.5, 228.5, 253.5, 228.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-21", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 336.5, 251.5, 253.5, 251.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 0 ],
|
||||
"destination" : [ "obj-21", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 1 ],
|
||||
"destination" : [ "obj-19", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-30", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 253.0, 71.0, 336.5, 71.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
*/
|
47
arduino-0018-linux/examples/Communication/MIDI/Midi.pde
Normal file
47
arduino-0018-linux/examples/Communication/MIDI/Midi.pde
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
MIDI note player
|
||||
|
||||
This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
|
||||
If this circuit is connected to a MIDI synth, it will play
|
||||
the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.
|
||||
|
||||
|
||||
The circuit:
|
||||
* digital in 1 connected to MIDI jack pin 5
|
||||
* MIDI jack pin 2 connected to ground
|
||||
* MIDI jack pin 4 connected to +5V through 220-ohm resistor
|
||||
Attach a MIDI cable to the jack, then to a MIDI synth, and play music.
|
||||
|
||||
created 13 Jun 2006
|
||||
modified 2 Jul 2009
|
||||
by Tom Igoe
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/MIDI
|
||||
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// Set MIDI baud rate:
|
||||
Serial.begin(31250);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// play notes from F#-0 (0x1E) to F#-5 (0x5A):
|
||||
for (intnote = 0x1E; note < 0x5A; note ++) {
|
||||
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
|
||||
noteOn(0x90, note, 0x45);
|
||||
delay(100);
|
||||
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
|
||||
noteOn(0x90, note, 0x00);
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
// plays a MIDI note. Doesn't check to see that
|
||||
// cmd is greater than 127, or that data values are less than 127:
|
||||
void noteOn(int cmd, int pitch, int velocity) {
|
||||
Serial.print(cmd, BYTE);
|
||||
Serial.print(pitch, BYTE);
|
||||
Serial.print(velocity, BYTE);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Mega multple serial test
|
||||
|
||||
Receives from the main serial port, sends to the others.
|
||||
Receives from serial port 1, sends to the main serial (Serial 0).
|
||||
|
||||
This example works only on the Arduino Mega
|
||||
|
||||
The circuit:
|
||||
* Any serial device attached to Serial port 1
|
||||
* Serial monitor open on Serial port 0:
|
||||
|
||||
created 30 Dec. 2008
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void setup() {
|
||||
// initialize both serial ports:
|
||||
Serial.begin(9600);
|
||||
Serial1.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read from port 1, send to port 0:
|
||||
if (Serial1.available()) {
|
||||
int inByte = Serial1.read();
|
||||
Serial.print(inByte, BYTE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,707 @@
|
|||
/*
|
||||
Physical Pixel
|
||||
|
||||
An example of using the Arduino board to receive data from the
|
||||
computer. In this case, the Arduino boards turns on an LED when
|
||||
it receives the character 'H', and turns off the LED when it
|
||||
receives the character 'L'.
|
||||
|
||||
The data can be sent from the Arduino serial monitor, or another
|
||||
program like Processing (see code below), Flash (via a serial-net
|
||||
proxy), PD, or Max/MSP.
|
||||
|
||||
The circuit:
|
||||
* LED connected from digital pin 13 to ground
|
||||
|
||||
created 2006
|
||||
by David A. Mellis
|
||||
modified 14 Apr 2009
|
||||
by Tom Igoe and Scott Fitzgerald
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/PhysicalPixel
|
||||
*/
|
||||
|
||||
const int ledPin = 13; // the pin that the LED is attached to
|
||||
int incomingByte; // a variable to read incoming serial data into
|
||||
|
||||
void setup() {
|
||||
// initialize serial communication:
|
||||
Serial.begin(9600);
|
||||
// initialize the LED pin as an output:
|
||||
pinMode(ledPin, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// see if there's incoming serial data:
|
||||
if (Serial.available() > 0) {
|
||||
// read the oldest byte in the serial buffer:
|
||||
incomingByte = Serial.read();
|
||||
// if it's a capital H (ASCII 72), turn on the LED:
|
||||
if (incomingByte == 'H') {
|
||||
digitalWrite(ledPin, HIGH);
|
||||
}
|
||||
// if it's an L (ASCII 76) turn off the LED:
|
||||
if (incomingByte == 'L') {
|
||||
digitalWrite(ledPin, LOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Processing code for this example
|
||||
|
||||
// mouseover serial
|
||||
|
||||
// Demonstrates how to send data to the Arduino I/O board, in order to
|
||||
// turn ON a light if the mouse is over a square and turn it off
|
||||
// if the mouse is not.
|
||||
|
||||
// created 2003-4
|
||||
// based on examples by Casey Reas and Hernando Barragan
|
||||
// modified 18 Jan 2009
|
||||
// by Tom Igoe
|
||||
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
float boxX;
|
||||
float boxY;
|
||||
int boxSize = 20;
|
||||
boolean mouseOverBox = false;
|
||||
|
||||
Serial port;
|
||||
|
||||
void setup() {
|
||||
size(200, 200);
|
||||
boxX = width/2.0;
|
||||
boxY = height/2.0;
|
||||
rectMode(RADIUS);
|
||||
|
||||
// List all the available serial ports in the output pane.
|
||||
// You will need to choose the port that the Arduino board is
|
||||
// connected to from this list. The first port in the list is
|
||||
// port #0 and the third port in the list is port #2.
|
||||
println(Serial.list());
|
||||
|
||||
// Open the port that the Arduino board is connected to (in this case #0)
|
||||
// Make sure to open the port at the same speed Arduino is using (9600bps)
|
||||
port = new Serial(this, Serial.list()[0], 9600);
|
||||
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(0);
|
||||
|
||||
// Test if the cursor is over the box
|
||||
if (mouseX > boxX-boxSize && mouseX < boxX+boxSize &&
|
||||
mouseY > boxY-boxSize && mouseY < boxY+boxSize) {
|
||||
mouseOverBox = true;
|
||||
// draw a line around the box and change its color:
|
||||
stroke(255);
|
||||
fill(153);
|
||||
// send an 'H' to indicate mouse is over square:
|
||||
port.write('H');
|
||||
}
|
||||
else {
|
||||
// return the box to it's inactive state:
|
||||
stroke(153);
|
||||
fill(153);
|
||||
// send an 'L' to turn the LED off:
|
||||
port.write('L');
|
||||
mouseOverBox = false;
|
||||
}
|
||||
|
||||
// Draw the box
|
||||
rect(boxX, boxY, boxSize, boxSize);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
{
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Physical Pixel\n\nThis patch sends an ASCII H or an ASCII L out the serial port to turn on an LED attached to an Arduino board. It can also send alternating H and L characters once every second to make the LED blink.\n\ncreated 2006\nby David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
|
||||
"linecount" : 11,
|
||||
"patching_rect" : [ 14.0, 35.0, 354.0, 158.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-1",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to blink every second",
|
||||
"patching_rect" : [ 99.0, 251.0, 161.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-38",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 74.0, 251.0, 21.0, 21.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-39",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "p blink",
|
||||
"patching_rect" : [ 74.0, 286.0, 45.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-37",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2,
|
||||
"patcher" : {
|
||||
"fileversion" : 1,
|
||||
"rect" : [ 54.0, 94.0, 640.0, 480.0 ],
|
||||
"bglocked" : 0,
|
||||
"defrect" : [ 54.0, 94.0, 640.0, 480.0 ],
|
||||
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
|
||||
"openinpresentation" : 0,
|
||||
"default_fontsize" : 10.0,
|
||||
"default_fontface" : 0,
|
||||
"default_fontname" : "Verdana",
|
||||
"gridonopen" : 0,
|
||||
"gridsize" : [ 25.0, 25.0 ],
|
||||
"gridsnaponopen" : 0,
|
||||
"toolbarvisible" : 1,
|
||||
"boxanimatetime" : 200,
|
||||
"imprint" : 0,
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "* 1000",
|
||||
"patching_rect" : [ 200.0, 150.0, 46.0, 19.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-12",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "inlet",
|
||||
"patching_rect" : [ 200.0, 75.0, 25.0, 25.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-11",
|
||||
"numinlets" : 0,
|
||||
"comment" : ""
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 125.0, 250.0, 20.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-10",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "metro 1000",
|
||||
"patching_rect" : [ 115.0, 190.0, 69.0, 19.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "bang" ],
|
||||
"id" : "obj-3",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "outlet",
|
||||
"patching_rect" : [ 125.0, 400.0, 25.0, 25.0 ],
|
||||
"numoutlets" : 0,
|
||||
"id" : "obj-2",
|
||||
"numinlets" : 1,
|
||||
"comment" : ""
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "inlet",
|
||||
"patching_rect" : [ 100.0, 25.0, 25.0, 25.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-1",
|
||||
"numinlets" : 0,
|
||||
"comment" : ""
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-12", 0 ],
|
||||
"destination" : [ "obj-3", 1 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-12", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-1", 0 ],
|
||||
"destination" : [ "obj-3", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-10", 0 ],
|
||||
"destination" : [ "obj-2", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-3", 0 ],
|
||||
"destination" : [ "obj-10", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
"saved_object_attributes" : {
|
||||
"fontface" : 0,
|
||||
"fontsize" : 10.0,
|
||||
"default_fontface" : 0,
|
||||
"default_fontname" : "Verdana",
|
||||
"default_fontsize" : 10.0,
|
||||
"fontname" : "Verdana",
|
||||
"globalpatchername" : ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "convert to int",
|
||||
"patching_rect" : [ 154.0, 386.0, 104.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-36",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "send L if 0, H if 1",
|
||||
"patching_rect" : [ 154.0, 361.0, 104.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-35",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "is it on or off?",
|
||||
"patching_rect" : [ 179.0, 336.0, 95.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-34",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "atoi",
|
||||
"patching_rect" : [ 279.0, 386.0, 46.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "list" ],
|
||||
"id" : "obj-33",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 3
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "H",
|
||||
"patching_rect" : [ 329.0, 361.0, 32.5, 17.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-32",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "L",
|
||||
"patching_rect" : [ 279.0, 361.0, 32.5, 17.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-31",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 0 1",
|
||||
"patching_rect" : [ 279.0, 336.0, 62.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-25",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to turn the LED on and off",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 130.0, 205.0, 143.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-24",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 279.0, 211.0, 24.0, 24.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-23",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 0 1",
|
||||
"patching_rect" : [ 381.0, 331.0, 62.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-30",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to close the serial port",
|
||||
"patching_rect" : [ 429.0, 422.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-26",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to open the serial port",
|
||||
"patching_rect" : [ 454.0, 396.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-27",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "close",
|
||||
"patching_rect" : [ 381.0, 422.0, 39.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-21",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "port a",
|
||||
"patching_rect" : [ 403.0, 396.0, 41.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-19",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click here to get a list of serial ports",
|
||||
"patching_rect" : [ 474.0, 370.0, 207.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-2",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 381.0, 181.0, 21.0, 21.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-11",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "print",
|
||||
"patching_rect" : [ 423.0, 370.0, 36.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-13",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "serial a 9600",
|
||||
"patching_rect" : [ 279.0, 461.0, 84.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int", "" ],
|
||||
"id" : "obj-14",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to start",
|
||||
"patching_rect" : [ 408.0, 181.0, 117.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-17",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-39", 0 ],
|
||||
"destination" : [ "obj-37", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-37", 0 ],
|
||||
"destination" : [ "obj-25", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 83.5, 320.5, 288.5, 320.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-33", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-32", 0 ],
|
||||
"destination" : [ "obj-33", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 338.5, 381.5, 288.5, 381.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-31", 0 ],
|
||||
"destination" : [ "obj-33", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-25", 0 ],
|
||||
"destination" : [ "obj-31", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-25", 1 ],
|
||||
"destination" : [ "obj-32", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 310.0, 358.0, 338.5, 358.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-23", 0 ],
|
||||
"destination" : [ "obj-25", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-13", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 432.5, 389.0, 367.0, 389.0, 367.0, 411.0, 288.5, 411.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-19", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 412.5, 417.0, 288.5, 417.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-21", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 390.5, 450.0, 288.5, 450.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 0 ],
|
||||
"destination" : [ "obj-21", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 1 ],
|
||||
"destination" : [ "obj-19", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-30", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 390.5, 322.0, 390.5, 322.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
*/
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,697 @@
|
|||
/*
|
||||
This example reads three analog sensors (potentiometers are easiest)
|
||||
and sends their values serially. The Processing and Max/MSP programs at the bottom
|
||||
take those three values and use them to change the background color of the screen.
|
||||
|
||||
The circuit:
|
||||
* potentiometers attached to analog inputs 0, 1, and 2
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/VirtualColorMixer
|
||||
|
||||
created 2 Dec 2006
|
||||
by David A. Mellis
|
||||
modified 14 Apr 2009
|
||||
by Tom Igoe and Scott Fitzgerald
|
||||
|
||||
*/
|
||||
|
||||
const int redPin = 0; // sensor to control red color
|
||||
const int greenPin = 1; // sensor to control green color
|
||||
const int bluePin = 2; // sensor to control blue color
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Serial.print(analogRead(redPin));
|
||||
Serial.print(",");
|
||||
Serial.print(analogRead(greenPin));
|
||||
Serial.print(",");
|
||||
Serial.println(analogRead(bluePin));
|
||||
}
|
||||
|
||||
/* Processing code for this example
|
||||
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
float redValue = 0; // red value
|
||||
float greenValue = 0; // green value
|
||||
float blueValue = 0; // blue value
|
||||
|
||||
Serial myPort;
|
||||
|
||||
void setup() {
|
||||
size(200, 200);
|
||||
|
||||
// List all the available serial ports
|
||||
println(Serial.list());
|
||||
// I know that the first port in the serial list on my mac
|
||||
// is always my Arduino, so I open Serial.list()[0].
|
||||
// Open whatever port is the one you're using.
|
||||
myPort = new Serial(this, Serial.list()[0], 9600);
|
||||
// don't generate a serialEvent() unless you get a newline character:
|
||||
myPort.bufferUntil('\n');
|
||||
}
|
||||
|
||||
void draw() {
|
||||
// set the background color with the color values:
|
||||
background(redValue, greenValue, blueValue);
|
||||
}
|
||||
|
||||
void serialEvent(Serial myPort) {
|
||||
// get the ASCII string:
|
||||
String inString = myPort.readStringUntil('\n');
|
||||
|
||||
if (inString != null) {
|
||||
// trim off any whitespace:
|
||||
inString = trim(inString);
|
||||
// split the string on the commas and convert the
|
||||
// resulting substrings into an integer array:
|
||||
float[] colors = float(split(inString, ","));
|
||||
// if the array has at least three elements, you know
|
||||
// you got the whole thing. Put the numbers in the
|
||||
// color variables:
|
||||
if (colors.length >=3) {
|
||||
// map them to the range 0-255:
|
||||
redValue = map(colors[0], 0, 1023, 0, 255);
|
||||
greenValue = map(colors[1], 0, 1023, 0, 255);
|
||||
blueValue = map(colors[2], 0, 1023, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* Max/MSP patch for this example
|
||||
{
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "/ 4",
|
||||
"patching_rect" : [ 448.0, 502.0, 32.5, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-25",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "/ 4",
|
||||
"patching_rect" : [ 398.0, 502.0, 32.5, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-24",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "/ 4",
|
||||
"patching_rect" : [ 348.0, 502.0, 32.5, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-23",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Virtual color mixer\n\nThis patch takes a string, containing three comma-separated ASCII formatted numbers from 0 to 1023, with a carriage return and linefeed at the end. It converts the string to three integers and uses them to set the background color.\n\n created 2 Dec 2006\n by David A. Mellis\nmodified 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe",
|
||||
"linecount" : 11,
|
||||
"patching_rect" : [ 524.0, 51.0, 398.0, 158.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-32",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 0 1",
|
||||
"patching_rect" : [ 372.0, 125.0, 62.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-30",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to close the serial port",
|
||||
"patching_rect" : [ 457.0, 276.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-26",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "click here to open the serial port",
|
||||
"patching_rect" : [ 457.0, 250.0, 206.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-27",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "close",
|
||||
"patching_rect" : [ 372.0, 276.0, 39.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-21",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "port a",
|
||||
"patching_rect" : [ 394.0, 250.0, 41.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-19",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click here to get a list of serial ports",
|
||||
"patching_rect" : [ 457.0, 224.0, 207.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-2",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Convert ASCII to symbol",
|
||||
"patching_rect" : [ 424.0, 423.0, 147.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-4",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Convert integer to ASCII",
|
||||
"patching_rect" : [ 424.0, 400.0, 147.0, 20.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-5",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "fromsymbol",
|
||||
"patching_rect" : [ 347.0, 423.0, 74.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-7",
|
||||
"fontname" : "Arial",
|
||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "itoa",
|
||||
"patching_rect" : [ 347.0, 400.0, 46.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-8",
|
||||
"fontname" : "Arial",
|
||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
||||
"numinlets" : 3
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "zl group",
|
||||
"patching_rect" : [ 347.0, 377.0, 53.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "", "" ],
|
||||
"id" : "obj-9",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "select 10 13",
|
||||
"patching_rect" : [ 289.0, 326.0, 77.0, 20.0 ],
|
||||
"numoutlets" : 3,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang", "bang", "" ],
|
||||
"id" : "obj-10",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "toggle",
|
||||
"patching_rect" : [ 289.0, 88.0, 15.0, 15.0 ],
|
||||
"numoutlets" : 1,
|
||||
"outlettype" : [ "int" ],
|
||||
"id" : "obj-11",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "qmetro 10",
|
||||
"patching_rect" : [ 289.0, 125.0, 65.0, 20.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "bang" ],
|
||||
"id" : "obj-12",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "message",
|
||||
"text" : "print",
|
||||
"patching_rect" : [ 414.0, 224.0, 36.0, 18.0 ],
|
||||
"numoutlets" : 1,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "" ],
|
||||
"id" : "obj-13",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 2
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "serial a 9600",
|
||||
"patching_rect" : [ 289.0, 300.0, 84.0, 20.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 12.0,
|
||||
"outlettype" : [ "int", "" ],
|
||||
"id" : "obj-14",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Read serial input buffer every 10 milliseconds",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 98.0, 117.0, 185.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-15",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "If you get newline (ASCII 10), send the list. If you get return (ASCII 13) do nothing. Any other value, add to the list",
|
||||
"linecount" : 3,
|
||||
"patching_rect" : [ 377.0, 314.0, 320.0, 48.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-16",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Click to open/close serial port and start/stop patch",
|
||||
"linecount" : 2,
|
||||
"patching_rect" : [ 316.0, 77.0, 199.0, 34.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-17",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "bgcolor 0 0 0",
|
||||
"patching_rect" : [ 348.0, 585.0, 169.0, 19.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 10.0,
|
||||
"id" : "obj-6",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 4
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "newobj",
|
||||
"text" : "unpack 0 0 0 0 0",
|
||||
"patching_rect" : [ 347.0, 470.0, 119.0, 19.0 ],
|
||||
"numoutlets" : 5,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int", "int", "int", "int", "int" ],
|
||||
"id" : "obj-20",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "number",
|
||||
"patching_rect" : [ 448.0, 535.0, 50.0, 19.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int", "bang" ],
|
||||
"id" : "obj-18",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "number",
|
||||
"patching_rect" : [ 398.0, 535.0, 50.0, 19.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int", "bang" ],
|
||||
"id" : "obj-1",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "number",
|
||||
"patching_rect" : [ 348.0, 535.0, 50.0, 19.0 ],
|
||||
"numoutlets" : 2,
|
||||
"fontsize" : 10.0,
|
||||
"outlettype" : [ "int", "bang" ],
|
||||
"id" : "obj-22",
|
||||
"fontname" : "Verdana",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"box" : {
|
||||
"maxclass" : "comment",
|
||||
"text" : "Here's the numbers from Arduino's analog input",
|
||||
"linecount" : 3,
|
||||
"patching_rect" : [ 198.0, 484.0, 138.0, 48.0 ],
|
||||
"numoutlets" : 0,
|
||||
"fontsize" : 12.0,
|
||||
"id" : "obj-3",
|
||||
"fontname" : "Arial",
|
||||
"numinlets" : 1
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-18", 0 ],
|
||||
"destination" : [ "obj-6", 2 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-1", 0 ],
|
||||
"destination" : [ "obj-6", 1 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-22", 0 ],
|
||||
"destination" : [ "obj-6", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-25", 0 ],
|
||||
"destination" : [ "obj-18", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-20", 4 ],
|
||||
"destination" : [ "obj-25", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-20", 2 ],
|
||||
"destination" : [ "obj-24", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-24", 0 ],
|
||||
"destination" : [ "obj-1", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-23", 0 ],
|
||||
"destination" : [ "obj-22", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-20", 0 ],
|
||||
"destination" : [ "obj-23", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-8", 0 ],
|
||||
"destination" : [ "obj-7", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-14", 0 ],
|
||||
"destination" : [ "obj-10", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-12", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-12", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-13", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 423.5, 245.5, 298.5, 245.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-19", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 403.5, 273.5, 298.5, 273.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-21", 0 ],
|
||||
"destination" : [ "obj-14", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 381.5, 296.5, 298.5, 296.5 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 0 ],
|
||||
"destination" : [ "obj-21", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-30", 1 ],
|
||||
"destination" : [ "obj-19", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-11", 0 ],
|
||||
"destination" : [ "obj-30", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 298.0, 116.0, 381.5, 116.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-7", 0 ],
|
||||
"destination" : [ "obj-20", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-9", 0 ],
|
||||
"destination" : [ "obj-8", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-10", 0 ],
|
||||
"destination" : [ "obj-9", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 298.5, 353.0, 356.5, 353.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
, {
|
||||
"patchline" : {
|
||||
"source" : [ "obj-10", 2 ],
|
||||
"destination" : [ "obj-9", 0 ],
|
||||
"hidden" : 0,
|
||||
"midpoints" : [ 356.5, 365.0, 356.5, 365.0 ]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
*/
|
Reference in a new issue