TEI Studio
This commit is contained in:
parent
bae5b3d412
commit
9c4ffb6e7b
28
GitHowTo.rtf
28
GitHowTo.rtf
@ -1,28 +0,0 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
|
|
||||||
{\fonttbl\f0\froman\fcharset0 Times-Roman;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\margl1440\margr1440\vieww5980\viewh11900\viewkind0
|
|
||||||
\deftab720
|
|
||||||
\pard\pardeftab720
|
|
||||||
|
|
||||||
\f0\fs28 \cf0 I'll write it down so we can refer to this "how-to" in the future :-)\
|
|
||||||
\
|
|
||||||
Github is two things (1) an application on your mac, (2) a server on the web (were all the copies are synced)\
|
|
||||||
\
|
|
||||||
In order to get the most recent code, you need to follow these steps:\
|
|
||||||
\
|
|
||||||
A. Open the application on your mac\
|
|
||||||
B. You will be presented with the interface - \'a0click "My Repositories" on the left bar menu\
|
|
||||||
C. You will see a repo called "gauthiier/M-M-M" which you click on the arrow on the right.\
|
|
||||||
D. This will bring you to the "Changes" mode of the repo (ilustrated on right bar).\
|
|
||||||
E. Click on the "Sync Branch" on the top right of the repo window - this will fetch the code from the server.\
|
|
||||||
F. If there is a problem fetching the code, this may be because you have un-commited code (code you worked on since we worked together). If this is the case, you simply need to commit your code by entering a "Commit summary" and by pressing the "Commit" button. After committing you can go to step E and "Sync Branch" again.\
|
|
||||||
G. When the branch is in sync the code will be on your machine. To view which version you have, simply click on "History" button in the right bar. The most recent code I've committed is entitled "Update Motion library and added an example how-to in apps folder".\
|
|
||||||
H. To view where the code is on your computer, go back to "Changes" (button in the right bar) and the folder where the repo is placed on your computer should be displayed in a list (below the "Select All" checkbox)\
|
|
||||||
\
|
|
||||||
Let me know if you are still experiencing problems (and we will skype).\
|
|
||||||
\
|
|
||||||
Hope you are well Bill, and sunshine in Menlo Park! (here it is snowing, which is very nice :-)\
|
|
||||||
\
|
|
||||||
Daviid\
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
// Click within the image to change
|
|
||||||
// the value of the rectangle
|
|
||||||
|
|
||||||
int value = 20;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
size(300,400);
|
|
||||||
stroke(value);
|
|
||||||
background(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
value = mouseX;
|
|
||||||
fill(value);
|
|
||||||
stroke(value-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseReleased() {
|
|
||||||
ellipse(mouseX,mouseY,20,20);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
int[] altitude = { 10, 20, 30, 40, 50, 40, 30, 20, 10, 0 };
|
|
||||||
int i;
|
|
||||||
int s = 80;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
size(800,100);
|
|
||||||
}
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,50,799,50);
|
|
||||||
stroke(0);
|
|
||||||
|
|
||||||
for (i = 0; i < 9; i = i+1) {
|
|
||||||
line(s*i,altitude[i],s*(i+1),altitude[i+1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
line(s*9, altitude[9], s*10-1, 50);
|
|
||||||
|
|
||||||
for (i = 0; i < 9; i = i+1) {
|
|
||||||
ellipse(s*(i+1),altitude[i+1], 10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mousePressed == true) {
|
|
||||||
int pos = (mouseX+40)/s;
|
|
||||||
altitude[pos]=mouseY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseReleased() {
|
|
||||||
int pos = mouseX/s;
|
|
||||||
altitude[pos]=mouseY;
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, ibest;
|
|
||||||
float dist;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=int(random(-100,100));
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY-100;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY-100;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
/*for (i = 0; i<n; i = i+1){
|
|
||||||
line(i*s,0,(i+1)*s,0);
|
|
||||||
}*/
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
inc = 0.001*(F[i+1]-F[i]); // increment used for plotting
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(i*s+j,height,i*s+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
// arrow keys for one-pixel motion
|
|
||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY-100;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
/*for (i = 0; i<n; i = i+1){
|
|
||||||
line(i*s,0,(i+1)*s,0);
|
|
||||||
}*/
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
inc = -0.001*(F[i+1]-F[i]); // increment used for plotting
|
|
||||||
//s = x[i+1] - x[i] + 1; // variable widths!
|
|
||||||
s = x[i+1] - x[i]; // number of increments
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(x[i]+j,height,x[i]+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyPressed() {
|
|
||||||
if (key == CODED) {
|
|
||||||
if (keyCode == UP) --F[ibest];
|
|
||||||
if (keyCode == DOWN) ++F[ibest];
|
|
||||||
if (keyCode == RIGHT) ++x[ibest];
|
|
||||||
if (keyCode == LEFT) --x[ibest];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY - 100;
|
|
||||||
if (mouseY < 0) F[ibest] = -100;
|
|
||||||
if (mouseY > 200) F[ibest] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
s = x[i+1]-x[i]+1; // increment used for plotting
|
|
||||||
inc = 0.01*(F[i+1]-F[i])/s;
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(x[i]+j,height,x[i]+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY - 100;
|
|
||||||
if (mouseY < 0) F[ibest] = -100;
|
|
||||||
if (mouseY > 200) F[ibest] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
s = x[i+1]-x[i]+1; // increment used for plotting
|
|
||||||
inc = 0.01*(F[i+1]-F[i])/s;
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(x[i]+j,height,x[i]+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyPressed() {
|
|
||||||
if (key == CODED) {
|
|
||||||
if (keyCode == UP) --F[ibest];
|
|
||||||
if (keyCode == DOWN) ++F[ibest];
|
|
||||||
if (keyCode == RIGHT) ++x[ibest];
|
|
||||||
if (keyCode == LEFT) --x[ibest];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
// Profile of forces and terrain
|
|
||||||
|
|
||||||
int n = 10; //number of values of F calculated for each s
|
|
||||||
int s = 80; //number of samples for each n
|
|
||||||
int[] F = new int[11]; //course Force values
|
|
||||||
float[] FF = new float[800]; //fine Forces interpolated
|
|
||||||
int i,j;
|
|
||||||
//int s = 80;
|
|
||||||
//int n = 10;
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
size(800,200); // double height to see what interpolation looks like
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void draw() {
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,50,n*s-1,50);
|
|
||||||
stroke(0);
|
|
||||||
|
|
||||||
for (i = 0; i <n; i = i+1 ) {
|
|
||||||
line(s*i, F[i], s*(i+1), F[i+1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// line(s*(n-1), F[n-1], s*n, 0);
|
|
||||||
|
|
||||||
for (i = 0; i <9; i = i+1) {
|
|
||||||
ellipse(s*(i+1),F[i+1], 10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mousePressed == true) {
|
|
||||||
pos = (mouseX+s/2)/s;
|
|
||||||
F[pos]=mouseY;
|
|
||||||
}
|
|
||||||
// plot seg ments of curving terrain (interpolating force?)
|
|
||||||
for (i = 0; i <n; i = i+1) {
|
|
||||||
line(i*s,height-F[i],(i+1)*s,height);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mouseReleased(){
|
|
||||||
for (i = 0; i<n; i = i+1){
|
|
||||||
line(i,height,i+s,height-j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
Ctrl c1, c2, c3;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
size(640, 360);
|
|
||||||
noStroke();
|
|
||||||
c1 = new Ctrl( 100, 100, 0);
|
|
||||||
c2 = new Ctrl( 200, 120, 100);
|
|
||||||
c3 = new Ctrl( 300, 130, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw()
|
|
||||||
{
|
|
||||||
background(250);
|
|
||||||
|
|
||||||
c1.update(mouseX, mouseY);
|
|
||||||
c2.update(mouseX, mouseY);
|
|
||||||
c3.update(mouseX, mouseY);
|
|
||||||
|
|
||||||
c1.display();
|
|
||||||
c2.display();
|
|
||||||
c3.display();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Ctrl {
|
|
||||||
int x, y;
|
|
||||||
int offset;
|
|
||||||
|
|
||||||
Ctrl(int tx, int ty, int to) {
|
|
||||||
x = tx;
|
|
||||||
y = ty;
|
|
||||||
offset = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
void update(int mx, int my) {
|
|
||||||
offset = mouseX;
|
|
||||||
}
|
|
||||||
void display() {
|
|
||||||
pushMatrix();
|
|
||||||
translate(x, y);
|
|
||||||
fill (250);
|
|
||||||
rotate(offset);
|
|
||||||
fill (153);
|
|
||||||
ellipse(offset, 0, offset/2, 2*offset);
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,126 +0,0 @@
|
|||||||
// ProfileFx
|
|
||||||
// receives pos from Arduino
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// int F[],x[i], shown as height F[x] "profile"
|
|
||||||
// then as slope of "terrain" dT = F[x]
|
|
||||||
|
|
||||||
|
|
||||||
// constrains x[i]<x[i+1] -100<F<+100
|
|
||||||
|
|
||||||
int pos; //position from Arduino
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
import processing.serial.*;
|
|
||||||
int lf = 10; // Linefeed in ASCII
|
|
||||||
String myString = null;
|
|
||||||
Serial myPort; // The serial port
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
|
|
||||||
println(Serial.list()); // List all the available serial ports:
|
|
||||||
myPort = new Serial(this, Serial.list()[0], 9600); // Open the port you are using at the rate you want:
|
|
||||||
myPort.clear();
|
|
||||||
// Throw out the first reading, in case we started reading
|
|
||||||
// in the middle of a string from the sender.
|
|
||||||
myString = myPort.readStringUntil(lf);
|
|
||||||
myString = null;
|
|
||||||
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw( ){
|
|
||||||
|
|
||||||
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY - 100;
|
|
||||||
if (mouseY < 0) F[ibest] = -100;
|
|
||||||
if (mouseY > 200) F[ibest] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
s = x[i+1]-x[i]+1; // increment used for plotting
|
|
||||||
inc = 0.01*(F[i+1]-F[i])/s;
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(x[i]+j,height,x[i]+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
//receive pos from Arduino
|
|
||||||
while (myPort.available() > 0) {
|
|
||||||
myString = myPort.readStringUntil(lf);
|
|
||||||
if (myString != null) {
|
|
||||||
myString = trim(myString);
|
|
||||||
pos = int(myString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// draw pos cursor
|
|
||||||
stroke(150);
|
|
||||||
line(pos,200,pos,800);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyPressed() {
|
|
||||||
if (key == CODED) {
|
|
||||||
if (keyCode == UP) --F[ibest];
|
|
||||||
if (keyCode == DOWN) ++F[ibest];
|
|
||||||
if (keyCode == RIGHT) ++x[ibest];
|
|
||||||
if (keyCode == LEFT) --x[ibest];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
//(Arduino) Profile sends pos to (Processing) ProfileFx
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
Serial.println(analogRead(A0));
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, j, ibest;
|
|
||||||
int s = 80;
|
|
||||||
int n = 10;
|
|
||||||
float dist;
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
noFill();
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(200);
|
|
||||||
stroke(150);
|
|
||||||
line(0,100,width,100);
|
|
||||||
line(0,200,width,200);
|
|
||||||
for (i = 1; i < 10; i = i+1){
|
|
||||||
line (i*80,0,i*80,200);
|
|
||||||
}
|
|
||||||
stroke(0);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i]+100,x[i+1],F[i+1]+100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]+100-mouseY)+sq(x[0]-mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]+100-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]+100-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest]+100,20,20);
|
|
||||||
|
|
||||||
text (Integer.toString(ibest), mouseX+10, mouseY-12);
|
|
||||||
text (Integer.toString(F[ibest]), mouseX+10, mouseY);
|
|
||||||
text (Integer.toString(x[ibest]), mouseX+10, mouseY+12);
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
x[ibest] = min(x[ibest+1],max(x[ibest-1],mouseX));
|
|
||||||
F[ibest] = mouseY - 100;
|
|
||||||
if (mouseY < 0) F[ibest] = -100;
|
|
||||||
if (mouseY > 200) F[ibest] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//plot "terrain" assuming 80 point separation of F[]'s
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
s = x[i+1]-x[i]+1; // increment used for plotting
|
|
||||||
inc = 0.01*(F[i+1]-F[i])/s;
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(x[i]+j,height,x[i]+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyPressed() {
|
|
||||||
if (key == CODED) {
|
|
||||||
if (keyCode == UP) --F[ibest];
|
|
||||||
if (keyCode == DOWN) ++F[ibest];
|
|
||||||
if (keyCode == RIGHT) ++x[ibest];
|
|
||||||
if (keyCode == LEFT) --x[ibest];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
// Profile of forces and terrain
|
|
||||||
|
|
||||||
int n = 10; //number of values of F calculated for each s
|
|
||||||
int s = 80; //number of samples for each n
|
|
||||||
int[] F = new int[11]; // Force values [-512 to +511] scaled for plot?
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
int i,j;
|
|
||||||
int pos;
|
|
||||||
int vt = 50; //vertical translation for force curve
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
size(800,800); // double height to see what interpolation looks like
|
|
||||||
for(i=0;i<n+1;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void draw() {
|
|
||||||
background(200);
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,vt); // center force plot at vt
|
|
||||||
stroke(150);
|
|
||||||
line(0,0,n*s-1,0); // the zero force line
|
|
||||||
|
|
||||||
stroke(0); // the force segments
|
|
||||||
for (i = 0; i <n; i = i+1 ) {
|
|
||||||
line(s*i, F[i], s*(i+1), F[i+1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i <9; i = i+1) {
|
|
||||||
ellipse(s*(i+1),F[i+1], 10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mousePressed == true) {
|
|
||||||
pos = (mouseX+s/2)/s;
|
|
||||||
F[pos]=mouseY-vt;
|
|
||||||
}
|
|
||||||
|
|
||||||
popMatrix();
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
/*for (i = 0; i<n; i = i+1){
|
|
||||||
line(i*s,0,(i+1)*s,0);
|
|
||||||
}*/
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
inc = 0.001*(F[i+1]-F[i]); // increment used for plotting
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(i*s+j,height,i*s+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void mouseReleased(){
|
|
||||||
}
|
|
||||||
|
|
||||||
// plot seg ments of curving terrain (interpolating force?)
|
|
||||||
top = 50;
|
|
||||||
for (i = 0; i <n; i = i+1) {
|
|
||||||
inc = (F[i+1]-F[i])/s; // increment used for plotting
|
|
||||||
for (j = 0; j < s; j = j+1){
|
|
||||||
top = top + inc*j; // j increments of inc = F diff.
|
|
||||||
line(i*s,height-top,i*s,height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
// Profile of forces and terrain
|
|
||||||
|
|
||||||
int n = 10; //number of values of F calculated for each s
|
|
||||||
int s = 80; //number of samples for each n
|
|
||||||
int[] F = new int[11]; // Force values [-512 to +511] scaled for plot?
|
|
||||||
float FF; // forces interpolated
|
|
||||||
float top; // terrain value (integral of forces)
|
|
||||||
float inc; // interpolated slope ( F[i+1] - F[i] ) / s
|
|
||||||
int i,j;
|
|
||||||
int pos;
|
|
||||||
int vt = 50; //vertical translation for force curve
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
size(800,800); // double height to see what interpolation looks like
|
|
||||||
for(i=0;i<n+1;i=i+1){
|
|
||||||
F[i]=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void draw() {
|
|
||||||
background(200);
|
|
||||||
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,vt); // center force plot at vt
|
|
||||||
stroke(150);
|
|
||||||
line(0,0,n*s-1,0); // the zero force line
|
|
||||||
|
|
||||||
stroke(0); // the force segments
|
|
||||||
for (i = 0; i <n; i = i+1 ) {
|
|
||||||
line(s*i, F[i], s*(i+1), F[i+1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i <9; i = i+1) {
|
|
||||||
ellipse(s*(i+1),F[i+1], 10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mousePressed == true) {
|
|
||||||
pos = (mouseX+s/2)/s;
|
|
||||||
F[pos]=mouseY-vt;
|
|
||||||
}
|
|
||||||
|
|
||||||
popMatrix();
|
|
||||||
pushMatrix();
|
|
||||||
translate(0,height/2);
|
|
||||||
/*for (i = 0; i<n; i = i+1){
|
|
||||||
line(i*s,0,(i+1)*s,0);
|
|
||||||
}*/
|
|
||||||
top = 0;
|
|
||||||
FF = F[0];
|
|
||||||
for (i = 0; i < n; i = i+1) {
|
|
||||||
inc = 0.001*(F[i+1]-F[i]); // increment used for plotting
|
|
||||||
for (j = 0; j < s; j = j+1) {
|
|
||||||
FF = FF + inc;
|
|
||||||
top = top + FF; // j increments of inc = F diff.
|
|
||||||
line(i*s+j,height,i*s+j,top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
popMatrix();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void mouseReleased(){
|
|
||||||
}
|
|
||||||
|
|
||||||
// plot seg ments of curving terrain (interpolating force?)
|
|
||||||
top = 50;
|
|
||||||
for (i = 0; i <n; i = i+1) {
|
|
||||||
inc = (F[i+1]-F[i])/s; // increment used for plotting
|
|
||||||
for (j = 0; j < s; j = j+1){
|
|
||||||
top = top + inc*j; // j increments of inc = F diff.
|
|
||||||
line(i*s,height-top,i*s,height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
// two-dimensional array?
|
|
||||||
// i = 1, 8;
|
|
||||||
// int F[], // shown an height
|
|
||||||
// x[i], //
|
|
||||||
|
|
||||||
// constrain x[i]<x[i+1]??
|
|
||||||
|
|
||||||
int F[] = {0,0,0,0,0,0,0,0,0,0,0};
|
|
||||||
int x[] = {1,2,3,4,5,6,7,8,9,10,11};
|
|
||||||
int i, ibest;
|
|
||||||
float dist;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
size(800,800);
|
|
||||||
for(i=0;i<11;i=i+1){
|
|
||||||
F[i]=int(random(200));
|
|
||||||
x[i]=80*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(){
|
|
||||||
background(190);
|
|
||||||
for (i = 0; i < 10;i= i+1){
|
|
||||||
line(x[i],F[i],x[i+1],F[i+1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (mousePressed == false){
|
|
||||||
//test every F,x pair to see who is closest call it ibest;
|
|
||||||
ibest = 1;
|
|
||||||
dist = sq(F[0]-mouseY)+sq(x[0]*mouseX);
|
|
||||||
for (i=1;i<10;i=i+1){
|
|
||||||
if(dist > sq(F[i]-mouseY)+sq(x[i]-mouseX)){
|
|
||||||
ibest = i;
|
|
||||||
dist = sq(F[i]-mouseY)+sq(x[i]-mouseX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ellipse(x[ibest],F[ibest],20,20);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (mousePressed == true){
|
|
||||||
//now use ibest to move to mouseX, mouseY
|
|
||||||
F[ibest] = mouseY;
|
|
||||||
x[ibest] = min(x[ibest+1],mouseX);
|
|
||||||
x[ibest] = max(x[ibest-1],mouseX);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
//"Pulse" - small duration positive then negative force
|
|
||||||
// parameters: F1, T1, D1, F2, T2, D2
|
|
||||||
// pitch set from slider (B - A3)
|
|
||||||
|
|
||||||
#define BIT_DEPTH 12
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
#include <Music.h>
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
MotorA.init();
|
|
||||||
Music.init();
|
|
||||||
|
|
||||||
Music.setWaveform(SINE);
|
|
||||||
Music.enableEnvelope();
|
|
||||||
Music.setAttack(10);
|
|
||||||
Music.setDecay(10);
|
|
||||||
Music.setRelease(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
//for (int i; i < 512; i + 100){
|
|
||||||
MotorA.torque(80);
|
|
||||||
Music.noteOn(map(analogRead(A3),0,1023,30,60));
|
|
||||||
delay (40);
|
|
||||||
Music.noteOff();
|
|
||||||
MotorA.torque(0);
|
|
||||||
delay (150);
|
|
||||||
MotorA.torque(-70);
|
|
||||||
Music.noteOn(map(analogRead(A3),0,1023,35,65));
|
|
||||||
delay (40);
|
|
||||||
Music.noteOff();
|
|
||||||
MotorA.torque(0);
|
|
||||||
delay (750);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
// CenterAB - both motors
|
|
||||||
// CenterA at xB, CenterB at xA?
|
|
||||||
// feels like "Slave"
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
#include <Music.h>
|
|
||||||
|
|
||||||
int duty, count, fout;
|
|
||||||
int xA, xB, foutA, foutB;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
Music.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
xA = analogRead(A0);
|
|
||||||
xB = analogRead(A3);
|
|
||||||
|
|
||||||
foutA = 2*(xB-xA);
|
|
||||||
MotorA.torque(foutA);
|
|
||||||
|
|
||||||
foutB = 2*(xA-xB); // this will peak at x=1024/6
|
|
||||||
MotorB.torque(foutB); // 1/4 or 1/2 ?
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
// CenterAB - both motors
|
|
||||||
|
|
||||||
//CenterA at xB, CenterB at xA?
|
|
||||||
//feels like "Double Toggle"
|
|
||||||
//position on A0, pwm:D9, dir:D8,D7
|
|
||||||
//CenterB
|
|
||||||
//position on A3, pwm:D10, dir:D11,D12
|
|
||||||
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int duty, count, fout;
|
|
||||||
int xA, xB, foutA, foutB;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
|
|
||||||
xA = analogRead(A0);
|
|
||||||
xB = analogRead(A3);
|
|
||||||
foutA = 6*(xA-xB); // this will peak at x=1024/6
|
|
||||||
MotorA.torque(foutA); // 1/4 or 1/2 ?
|
|
||||||
|
|
||||||
foutB = 6*(xB-xA); // this will peak at x=1024/6
|
|
||||||
MotorB.torque(foutB); // 1/4 or 1/2 ?
|
|
||||||
|
|
||||||
// print every 1000 cycles
|
|
||||||
if(count++>=0){
|
|
||||||
count=-500;
|
|
||||||
Serial.print(xA,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(foutA,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(xB,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(foutB,DEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
// CenterAB - both motors
|
|
||||||
|
|
||||||
//CenterA
|
|
||||||
//position on A0, pwm:D9, dir:D8,D7
|
|
||||||
//CenterB
|
|
||||||
//position on A3, pwm:D10, dir:D11,D12
|
|
||||||
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int duty, count, fout;
|
|
||||||
int xA, xB, foutA, foutB;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
|
|
||||||
xA = analogRead(A0);
|
|
||||||
foutA = 2*(512 - xA); // this will peak at x=1024/2
|
|
||||||
MotorA.torque(foutA); // 1/4 or 1/2 ?
|
|
||||||
|
|
||||||
xB = analogRead(A3);
|
|
||||||
foutB = (512 - xB); // this will peak at x=1024/6
|
|
||||||
MotorB.torque(foutB); // 1/4 or 1/2 ?
|
|
||||||
|
|
||||||
// print every 1000 cycles
|
|
||||||
if(count++>=0){
|
|
||||||
count=-1000;
|
|
||||||
Serial.print(xA,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(foutA,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(xB,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(foutB,DEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
//plucks - four bumps
|
|
||||||
//three notes (400,500,600hz)
|
|
||||||
//can't get Music.setGain1, etc to work only Music.setGain() starts all of them.
|
|
||||||
//requires FSR attached to A
|
|
||||||
|
|
||||||
#define NUM_OSCILLATORS 3
|
|
||||||
#define BIT_DEPTH 8
|
|
||||||
|
|
||||||
#include <Music.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int x, xold, xt; // input position x, output force F
|
|
||||||
float K = 20; // slope constant
|
|
||||||
byte count; //for print count-down
|
|
||||||
float fin; // scaled to be 0.0 - 1.0
|
|
||||||
float fout; // from FSR
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Music.init();
|
|
||||||
Music.setFrequency1(200);
|
|
||||||
Music.setFrequency2(250);
|
|
||||||
Music.setFrequency3(300);
|
|
||||||
|
|
||||||
//FSR-A
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH); //set pull-up
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
//FSR-B
|
|
||||||
pinMode(A4,INPUT);
|
|
||||||
digitalWrite(A4,HIGH); //set pull-up
|
|
||||||
pinMode(5,OUTPUT);
|
|
||||||
digitalWrite(5,LOW);
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
MotorA.init();
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
x = analogRead(A0); // initialize x
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
xold = x;
|
|
||||||
x = analogRead(A0);
|
|
||||||
|
|
||||||
// did xold - x include 125, 375, 625, 875? or x%250 = 125
|
|
||||||
|
|
||||||
if (((xold <= 125) && (x > 125)) || ((xold >= 125) && (x < 125))){
|
|
||||||
Music.setGain1(fin*fin);
|
|
||||||
Music.setFrequency1(200);
|
|
||||||
}
|
|
||||||
if (((xold <= 375) && (x > 375)) || ((xold >= 375) && (x < 375))){
|
|
||||||
Music.setGain2(fin*fin);
|
|
||||||
//Music.setFrequency(250);
|
|
||||||
}
|
|
||||||
if (((xold <= 625) && (x > 625)) || ((xold >= 625) && (x < 625))){
|
|
||||||
Music.setGain3(fin*fin);
|
|
||||||
//Music.setFrequency(300);
|
|
||||||
}
|
|
||||||
if (((xold <= 875) && (x > 875)) || ((xold >= 875) && (x < 875))){
|
|
||||||
Music.setGain1(fin*fin);
|
|
||||||
Music.setFrequency1(400);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Music.setGain1(0.995f*Music.getGain1());
|
|
||||||
Music.setGain2(0.995f*Music.getGain2());
|
|
||||||
Music.setGain3(0.995f*Music.getGain3());
|
|
||||||
}
|
|
||||||
fin = 1000 - analogRead(A1); // invert and shift
|
|
||||||
fin = max (0, fin); // make sure it's > 0
|
|
||||||
fin = min (1023, fin); // and < 1023
|
|
||||||
fin = fin/1000; // scale 0-1.0
|
|
||||||
fin = fin*fin; //square it for more effect near 1.0.
|
|
||||||
xt = x % 250; //same force for each 250 ranage
|
|
||||||
fout = 0;
|
|
||||||
if (xt > 60) fout = - K * (xt - 60);
|
|
||||||
if (xt > 80) fout = - K * (100 - xt);
|
|
||||||
if (xt > 120) fout = K * (140 - xt);
|
|
||||||
if (xt > 140) fout = 0;
|
|
||||||
fout = fout * fin;
|
|
||||||
MotorA.torque(fout);
|
|
||||||
|
|
||||||
|
|
||||||
// print every 256 cycles
|
|
||||||
if(count++==0){
|
|
||||||
Serial.print(x);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(xt);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(fin);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(fout);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,98 +0,0 @@
|
|||||||
//plucks - four bumps
|
|
||||||
//three notes (400,500,600hz)
|
|
||||||
//can't get Music.setGain1, etc to work only Music.setGain() starts all of them.
|
|
||||||
//requires FSR attached to A
|
|
||||||
|
|
||||||
#define NUM_OSCILLATORS 3
|
|
||||||
#define BIT_DEPTH 8
|
|
||||||
|
|
||||||
#include <Music.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int x, xold, xt; // input position x, output force F
|
|
||||||
float K = 20; // slope constant
|
|
||||||
byte count; //for print count-down
|
|
||||||
float fin; // scaled to be 0.0 - 1.0
|
|
||||||
float fout; // from FSR
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Music.init();
|
|
||||||
Music.setFrequency1(200);
|
|
||||||
Music.setFrequency2(250);
|
|
||||||
Music.setFrequency3(300);
|
|
||||||
|
|
||||||
//FSR-A
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH); //set pull-up
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
//FSR-B
|
|
||||||
pinMode(A4,INPUT);
|
|
||||||
digitalWrite(A4,HIGH); //set pull-up
|
|
||||||
pinMode(5,OUTPUT);
|
|
||||||
digitalWrite(5,LOW);
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
MotorA.init();
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
x = analogRead(A0); // initialize x
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
xold = x;
|
|
||||||
x = analogRead(A0);
|
|
||||||
|
|
||||||
// did xold - x include 125, 375, 625, 875? or x%250 = 125
|
|
||||||
|
|
||||||
if (((xold <= 125) && (x > 125)) || ((xold >= 125) && (x < 125))){
|
|
||||||
Music.setGain1(1.0);//Music.setGain1(fin*fin);
|
|
||||||
Music.setFrequency1(200);
|
|
||||||
}
|
|
||||||
if (((xold <= 375) && (x > 375)) || ((xold >= 375) && (x < 375))){
|
|
||||||
Music.setGain2(1.0);//Music.setGain2(fin*fin);
|
|
||||||
//Music.setFrequency(250);
|
|
||||||
}
|
|
||||||
if (((xold <= 625) && (x > 625)) || ((xold >= 625) && (x < 625))){
|
|
||||||
Music.setGain3(1.0);//Music.setGain3(fin*fin);
|
|
||||||
//Music.setFrequency(300);
|
|
||||||
}
|
|
||||||
if (((xold <= 875) && (x > 875)) || ((xold >= 875) && (x < 875))){
|
|
||||||
Music.setGain1(1.0);//Music.setGain1(fin*fin);
|
|
||||||
Music.setFrequency1(400);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Music.setGain1(0.995f*Music.getGain1());
|
|
||||||
Music.setGain2(0.995f*Music.getGain2());
|
|
||||||
Music.setGain3(0.995f*Music.getGain3());
|
|
||||||
}
|
|
||||||
fin = 1000 - analogRead(A1); // invert and shift
|
|
||||||
fin = max (0, fin); // make sure it's > 0
|
|
||||||
fin = min (1023, fin); // and < 1023
|
|
||||||
fin = fin/1000; // scale 0-1.0
|
|
||||||
fin = fin*fin; //square it for more effect near 1.0.
|
|
||||||
xt = x % 250; //same force for each 250 ranage
|
|
||||||
fout = 0;
|
|
||||||
if (xt > 60) fout = - K * (xt - 60);
|
|
||||||
if (xt > 80) fout = - K * (100 - xt);
|
|
||||||
if (xt > 120) fout = K * (140 - xt);
|
|
||||||
if (xt > 140) fout = 0;
|
|
||||||
//fout = fout * fin;
|
|
||||||
fout = fout;
|
|
||||||
MotorA.torque(fout);
|
|
||||||
|
|
||||||
|
|
||||||
// print every 256 cycles
|
|
||||||
if(count++==0){
|
|
||||||
Serial.print(x);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(xt);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(fin);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(fout);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
// FSR A and B
|
|
||||||
// stick-slip
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
int xA, finA, foutA; //fout gets too big if fout=fin*x;
|
|
||||||
float x, fin, fout;
|
|
||||||
byte c;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
//FSR-A
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH); //set pull-up
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
//FSR-B
|
|
||||||
pinMode(A4,INPUT);
|
|
||||||
digitalWrite(A4,HIGH); //set pull-up
|
|
||||||
pinMode(5,OUTPUT);
|
|
||||||
digitalWrite(5,LOW);
|
|
||||||
|
|
||||||
//Motors
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
void loop(){
|
|
||||||
x = 512 - analogRead(A0); //in:[0,1023] out: [-512,511]
|
|
||||||
fin = 1024 - analogRead(A1); //in:[1023,0] out [0,1023]
|
|
||||||
fout = x*fin/500;
|
|
||||||
MotorA.torque(fout);
|
|
||||||
|
|
||||||
x = 512 - analogRead(A3); //in:[0,1023] out: [-512,511]
|
|
||||||
fin = 1024 - analogRead(A4); //in:[1023,0] out [0,1023]
|
|
||||||
fout = x*fin/500;
|
|
||||||
MotorB.torque(fout);
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
// FSR A and B test
|
|
||||||
void setup(){
|
|
||||||
//FSR-A
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH); //set pull-up
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
//FSR-B
|
|
||||||
pinMode(A4,INPUT);
|
|
||||||
digitalWrite(A4,HIGH); //set pull-up
|
|
||||||
pinMode(5,OUTPUT);
|
|
||||||
digitalWrite(5,LOW);
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
void loop(){
|
|
||||||
Serial.print(analogRead(A1));
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(analogRead(A4));
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
void setup(){
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW); //sets ground
|
|
||||||
digitalWrite(A1,HIGH); //sets pull-up
|
|
||||||
}
|
|
||||||
void loop(){
|
|
||||||
digitalWrite(A1,LOW);
|
|
||||||
digitalWrite(4,HIGH);
|
|
||||||
delay(1000);
|
|
||||||
digitalWrite(A1,HIGH);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
delay(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
//does D4 actually go 5v to GND?
|
|
||||||
//yes, if D4 is OUTPUT.
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
//HumpFSR-A
|
|
||||||
//same as CenterFSR-A with sign reversal
|
|
||||||
//position on A0, pwm:D9, dir:D8,D7
|
|
||||||
//FSR on A1 and D4
|
|
||||||
|
|
||||||
// BUZZ! (float vs int?)
|
|
||||||
#include "Motor.h"
|
|
||||||
|
|
||||||
int x, duty, fin;
|
|
||||||
float fout;
|
|
||||||
byte count; // used as counter
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
MotorA.init();
|
|
||||||
//for FSR
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
fin = 1024 - analogRead(A1);
|
|
||||||
x = analogRead(A0)-512;
|
|
||||||
fout = .004*(float(fin)*float(x));
|
|
||||||
duty = min(1023,fout);
|
|
||||||
MotorA.torque(fout);
|
|
||||||
if(count++ == 0){
|
|
||||||
Serial.print(x,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(fin,DEC);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(fout,DEC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
#include "Motor.h"
|
|
||||||
|
|
||||||
int x; //position
|
|
||||||
float fin; //from hall-sensor [ wired GND to A1 ]
|
|
||||||
float fout; //force
|
|
||||||
int duty; // max 1024
|
|
||||||
byte c; // counter to send data every 256 cycles
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
MotorA.init();
|
|
||||||
pinMode(A1,INPUT); //used for FSR [A1 to D4]
|
|
||||||
pinMode(4,OUTPUT); //used for FSR as GND
|
|
||||||
digitalWrite(A1,HIGH); //enable pull-up resistor
|
|
||||||
digitalWrite(4,LOW); //GND for FSR
|
|
||||||
//TimerOne
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
fin = analogRead(A1) - 1000;
|
|
||||||
//fout = random(fin);
|
|
||||||
fout = 2*fin + random(fin); // range [0,4096];
|
|
||||||
fout = fout/3;
|
|
||||||
MotorA.torque(fout);
|
|
||||||
// Timer1.pwm(9,duty); //output force
|
|
||||||
|
|
||||||
if(c++==0){
|
|
||||||
Serial.print(fin);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(fout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Binary file not shown.
@ -1,13 +0,0 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
|
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
|
||||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
|
|
||||||
|
|
||||||
\f0\fs24 \cf0 32K flash program memory 8-bit bytes\
|
|
||||||
8K/sec = 4 seconds\
|
|
||||||
\
|
|
||||||
use 20K ?\
|
|
||||||
\
|
|
||||||
granular synthesis is like wave-table synthesis but with playing only a selection and windowing it\
|
|
||||||
the stored wave-table could be a piece of bird-call and you could play a piece by feeling it - i.e. create a "haptic-landscape" that let's you feel what part of the wave you are on.}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
//"Pulse" - small duration positive then negative force
|
|
||||||
// parameters: F1, T1, D1, F2, T2, D2
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
MotorB.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
//for (int i; i < 512; i + 100){
|
|
||||||
MotorB.torque(10);
|
|
||||||
delay (20);
|
|
||||||
MotorB.torque(0);
|
|
||||||
delay (150);
|
|
||||||
MotorB.torque(-50);
|
|
||||||
delay (40);
|
|
||||||
MotorB.torque(0);
|
|
||||||
delay (750);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
//"Pulse" - small duration positive then negative force
|
|
||||||
// parameters: F1, T1, D1, F2, T2, D2
|
|
||||||
|
|
||||||
#define BIT_DEPTH 12
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
#include <Music.h>
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
MotorB.init();
|
|
||||||
Music.init();
|
|
||||||
|
|
||||||
Music.setWaveform(SINE);
|
|
||||||
Music.enableEnvelope();
|
|
||||||
Music.setAttack(10);
|
|
||||||
Music.setDecay(10);
|
|
||||||
Music.setRelease(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
//for (int i; i < 512; i + 100){
|
|
||||||
MotorB.torque(40);
|
|
||||||
Music.noteOn(map(analogRead(A3),0,1023,30,60));
|
|
||||||
delay (20);
|
|
||||||
Music.noteOff();
|
|
||||||
MotorB.torque(0);
|
|
||||||
delay (150);
|
|
||||||
MotorB.torque(-70);
|
|
||||||
Music.noteOn(map(analogRead(A3),0,1023,35,65));
|
|
||||||
delay (40);
|
|
||||||
Music.noteOff();
|
|
||||||
MotorB.torque(0);
|
|
||||||
delay (750);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
//read position A0 FSR A1
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
pinMode(A0,INPUT);
|
|
||||||
//for FSR
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
digitalWrite(A1,HIGH);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
Serial.print(analogRead(A0));
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(analogRead(A1));
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
//slider test
|
|
||||||
#include <Motor.h>
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
MotorA.init();
|
|
||||||
}
|
|
||||||
void loop(){
|
|
||||||
MotorA.torque(analogRead(A0));
|
|
||||||
Serial.println(analogRead(A0));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,148 +0,0 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
|
|
||||||
{\fonttbl\f0\fmodern\fcharset0 Courier;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
|
||||||
\deftab720
|
|
||||||
\pard\pardeftab720
|
|
||||||
|
|
||||||
\f0\fs24 \cf0 /* fscale\
|
|
||||||
Floating Point Autoscale Function V0.1\
|
|
||||||
Paul Badger 2007\
|
|
||||||
Modified from code by Greg Shakar\
|
|
||||||
\
|
|
||||||
This function will scale one set of floating point numbers (range) to another set of floating point numbers (range)\
|
|
||||||
It has a "curve" parameter so that it can be made to favor either the end of the output. (Logarithmic mapping)\
|
|
||||||
\
|
|
||||||
It takes 6 parameters\
|
|
||||||
\
|
|
||||||
originalMin - the minimum value of the original range - this MUST be less than origninalMax\
|
|
||||||
originalMax - the maximum value of the original range - this MUST be greater than orginalMin\
|
|
||||||
\
|
|
||||||
newBegin - the end of the new range which maps to orginalMin - it can be smaller, or larger, than newEnd, to facilitate inverting the ranges\
|
|
||||||
newEnd - the end of the new range which maps to originalMax - it can be larger, or smaller, than newBegin, to facilitate inverting the ranges\
|
|
||||||
\
|
|
||||||
inputValue - the variable for input that will mapped to the given ranges, this variable is constrained to originaMin <= inputValue <= originalMax\
|
|
||||||
curve - curve is the curve which can be made to favor either end of the output scale in the mapping. Parameters are from -10 to 10 with 0 being\
|
|
||||||
a linear mapping (which basically takes curve out of the equation)\
|
|
||||||
\
|
|
||||||
To understand the curve parameter do something like this: \
|
|
||||||
\
|
|
||||||
void loop()\{\
|
|
||||||
for ( j=0; j < 200; j++)\{\
|
|
||||||
scaledResult = fscale( 0, 200, 0, 200, j, -1.5);\
|
|
||||||
\
|
|
||||||
Serial.print(j, DEC); \
|
|
||||||
Serial.print(" "); \
|
|
||||||
Serial.println(scaledResult, DEC); \
|
|
||||||
\} \
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
And try some different values for the curve function - remember 0 is a neutral, linear mapping\
|
|
||||||
\
|
|
||||||
To understand the inverting ranges, do something like this:\
|
|
||||||
\
|
|
||||||
void loop()\{\
|
|
||||||
for ( j=0; j < 200; j++)\{\
|
|
||||||
scaledResult = fscale( 0, 200, 200, 0, j, 0);\
|
|
||||||
\
|
|
||||||
// Serial.print lines as above\
|
|
||||||
\
|
|
||||||
\} \
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
*/\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
#include <math.h>\
|
|
||||||
\
|
|
||||||
int j;\
|
|
||||||
float scaledResult; \
|
|
||||||
\
|
|
||||||
void setup() \{\
|
|
||||||
Serial.begin(9600);\
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
void loop()\{\
|
|
||||||
for ( j=0; j < 200; j++)\{\
|
|
||||||
scaledResult = fscale( 0, 200, 0, 200, j, -1.5);\
|
|
||||||
\
|
|
||||||
Serial.print(j, DEC); \
|
|
||||||
Serial.print(" "); \
|
|
||||||
Serial.println(scaledResult , DEC); \
|
|
||||||
\} \
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
float fscale( float originalMin, float originalMax, float newBegin, float\
|
|
||||||
newEnd, float inputValue, float curve)\{\
|
|
||||||
\
|
|
||||||
float OriginalRange = 0;\
|
|
||||||
float NewRange = 0;\
|
|
||||||
float zeroRefCurVal = 0;\
|
|
||||||
float normalizedCurVal = 0;\
|
|
||||||
float rangedValue = 0;\
|
|
||||||
boolean invFlag = 0;\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
// condition curve parameter\
|
|
||||||
// limit range\
|
|
||||||
\
|
|
||||||
if (curve > 10) curve = 10;\
|
|
||||||
if (curve < -10) curve = -10;\
|
|
||||||
\
|
|
||||||
curve = (curve * -.1) ; // - invert and scale - this seems more intuitive - postive numbers give more weight to high end on output \
|
|
||||||
curve = pow(10, curve); // convert linear scale into lograthimic exponent for other pow function\
|
|
||||||
\
|
|
||||||
/*\
|
|
||||||
Serial.println(curve * 100, DEC); // multply by 100 to preserve resolution \
|
|
||||||
Serial.println(); \
|
|
||||||
*/\
|
|
||||||
\
|
|
||||||
// Check for out of range inputValues\
|
|
||||||
if (inputValue < originalMin) \{\
|
|
||||||
inputValue = originalMin;\
|
|
||||||
\}\
|
|
||||||
if (inputValue > originalMax) \{\
|
|
||||||
inputValue = originalMax;\
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
// Zero Refference the values\
|
|
||||||
OriginalRange = originalMax - originalMin;\
|
|
||||||
\
|
|
||||||
if (newEnd > newBegin)\{ \
|
|
||||||
NewRange = newEnd - newBegin;\
|
|
||||||
\}\
|
|
||||||
else\
|
|
||||||
\{\
|
|
||||||
NewRange = newBegin - newEnd; \
|
|
||||||
invFlag = 1;\
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
zeroRefCurVal = inputValue - originalMin;\
|
|
||||||
normalizedCurVal = zeroRefCurVal / OriginalRange; // normalize to 0 - 1 float\
|
|
||||||
\
|
|
||||||
/*\
|
|
||||||
Serial.print(OriginalRange, DEC); \
|
|
||||||
Serial.print(" "); \
|
|
||||||
Serial.print(NewRange, DEC); \
|
|
||||||
Serial.print(" "); \
|
|
||||||
Serial.println(zeroRefCurVal, DEC); \
|
|
||||||
Serial.println(); \
|
|
||||||
*/\
|
|
||||||
\
|
|
||||||
// Check for originalMin > originalMax - the math for all other cases i.e. negative numbers seems to work out fine \
|
|
||||||
if (originalMin > originalMax ) \{\
|
|
||||||
return 0;\
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
if (invFlag == 0)\{\
|
|
||||||
rangedValue = (pow(normalizedCurVal, curve) * NewRange) + newBegin;\
|
|
||||||
\
|
|
||||||
\}\
|
|
||||||
else // invert the ranges\
|
|
||||||
\{ \
|
|
||||||
rangedValue = newBegin - (pow(normalizedCurVal, curve) * NewRange); \
|
|
||||||
\}\
|
|
||||||
\
|
|
||||||
return rangedValue;\
|
|
||||||
\}\
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
//motortest
|
|
||||||
//.5 sec forward, .5 sec back
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
MotorA.torque(40); // small force for Plank
|
|
||||||
MotorB.torque(200); // need 200 for Fader
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
MotorA.direction(FORWARD);
|
|
||||||
MotorB.direction(FORWARD);
|
|
||||||
delay(500);
|
|
||||||
MotorA.direction(BACKWARD);
|
|
||||||
MotorB.direction(BACKWARD);
|
|
||||||
delay(500);
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
// step response of second order system
|
|
||||||
// m mass, k spring, b damping
|
|
||||||
|
|
||||||
float xPos = 0.0;
|
|
||||||
float yPos = 0.0;
|
|
||||||
float xVel = 0.0;
|
|
||||||
float T = 0.1;
|
|
||||||
float koverm = 0.1;
|
|
||||||
float boverm = 0.01;
|
|
||||||
|
|
||||||
int x, y; // variables at mouse- and screen-resolution
|
|
||||||
|
|
||||||
void setup() { // setup() runs once
|
|
||||||
size(800, 500);
|
|
||||||
frameRate(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw() { // draw() loops forever, until stopped
|
|
||||||
xPos = width/2;
|
|
||||||
xVel = 0.0;
|
|
||||||
background(204);
|
|
||||||
for(int y=0; y < height; y = y +1) {
|
|
||||||
xVel += koverm * (mouseX - xPos) * T - boverm * xVel; //a=F/m
|
|
||||||
xPos += xVel * T;
|
|
||||||
point(xPos, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
//Center
|
|
||||||
//uses a variable force (pwm duty)
|
|
||||||
//If it feels like a mountain - pushing away from center, then
|
|
||||||
//reverse the motor leads
|
|
||||||
//or for a quick fix in the code: change if(f < 0) to if (f > 0)
|
|
||||||
|
|
||||||
#include "Motor.h"
|
|
||||||
#include "Music.h"
|
|
||||||
|
|
||||||
int posA, posB; // position from analogRead
|
|
||||||
int forceA, forceB; // computed from pos and k
|
|
||||||
int kA, kB = 2; // spring constant
|
|
||||||
//int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
MotorB.init();
|
|
||||||
Music.init();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
posA = analogRead(A0);
|
|
||||||
posB = analogRead(A3);
|
|
||||||
|
|
||||||
Music.setFrequency1(posA);
|
|
||||||
Music.setFrequency2(posB);
|
|
||||||
|
|
||||||
forceA = - kA * (512 - posA);
|
|
||||||
forceB = - kB * (512 - posB);
|
|
||||||
//duty = abs(force);
|
|
||||||
//duty = min(512, duty);
|
|
||||||
|
|
||||||
MotorA.torque(forceA); //force can be -512 to +511
|
|
||||||
MotorB.torque(forceB); //force can be -512 to +511
|
|
||||||
|
|
||||||
//if(force < 0) MotorA.direction(FORWARD);
|
|
||||||
//else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
//Center
|
|
||||||
//uses a variable force (pwm duty)
|
|
||||||
//If it feels like a "mountain" - pushing away from center, then
|
|
||||||
//reverse the motor leads to make it feel like a "valley"
|
|
||||||
//or for a quick fix in the code: change if(f < 0) to if (f > 0)
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int pos; // position from analogRead
|
|
||||||
int force; // computed from pos and k
|
|
||||||
int k = 10; // spring constant
|
|
||||||
int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
pos = analogRead(A0);
|
|
||||||
|
|
||||||
force = k * (512 - pos);
|
|
||||||
duty = abs(force);
|
|
||||||
duty = min(511, duty);
|
|
||||||
|
|
||||||
MotorA.torque(duty);
|
|
||||||
|
|
||||||
if(force < 0) MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
//Center
|
|
||||||
//uses a variable force (pwm duty)
|
|
||||||
//If it feels like a "mountain" - pushing away from center, then
|
|
||||||
//reverse the motor leads to make it feel like a "valley"
|
|
||||||
//or for a quick fix in the code: change if(f < 0) to if (f > 0)
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int pos; // position from analogRead
|
|
||||||
int force; // computed from pos and k
|
|
||||||
int k = 1; // spring constant
|
|
||||||
int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
|
|
||||||
MotorB.torque(100); //is this necessary?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
pos = analogRead(A3);
|
|
||||||
|
|
||||||
force = k * (512 - pos);
|
|
||||||
duty = abs(force);
|
|
||||||
duty = min(1023, duty);
|
|
||||||
|
|
||||||
MotorB.torque(duty);
|
|
||||||
|
|
||||||
if(force < 0) MotorB.direction(FORWARD);
|
|
||||||
else MotorB.direction(BACKWARD);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
//Center two motors control two frequencies. (jb&bv 25Jan13)
|
|
||||||
//uses a variable force (pwm duty)
|
|
||||||
//If it feels like a mountain - pushing away from center, then
|
|
||||||
//reverse the motor leads or the sign of forceA or forceB
|
|
||||||
//or for a quick fix in the code: change if(f < 0) to if (f > 0)
|
|
||||||
|
|
||||||
// notes to me (bv)
|
|
||||||
|
|
||||||
#include "Motor.h"
|
|
||||||
#include "Music.h"
|
|
||||||
|
|
||||||
int posA, posB; // position from analogRead
|
|
||||||
int forceA, forceB; // computed from pos and k
|
|
||||||
int kA = 2; // spring constant
|
|
||||||
int kB = 2; // spring constant
|
|
||||||
//int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
Music.init(); // 12-bit sine default (see .cpp file)
|
|
||||||
//Music.setWaveform(0); // only works with 8bit waveforms
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
posA = analogRead(A0);
|
|
||||||
posB = analogRead(A3);
|
|
||||||
|
|
||||||
Music.setFrequency1(posA);
|
|
||||||
Music.setFrequency2(posB);
|
|
||||||
|
|
||||||
forceA = - kA * (512 - posA); // check wiring???
|
|
||||||
forceB = kB * (512 - posB);
|
|
||||||
|
|
||||||
MotorA.torque(forceA); // forceA [-512 to +511] ???
|
|
||||||
MotorB.torque(forceB);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
//Damp - measure velocity then f=Bv
|
|
||||||
#import <Motor.h>
|
|
||||||
int x; //position measured - then filtered
|
|
||||||
float v, f, t, xold; //velocity, force, time delta
|
|
||||||
byte c; //for debug print every 256th loop
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
xold = analogRead(A0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
x = analogRead(A0);
|
|
||||||
v = x - xold; //lag v, too?
|
|
||||||
xold += 0.1*(x-xold); //slide xold with lag
|
|
||||||
|
|
||||||
if(c++==0){
|
|
||||||
//Serial.print(xold);
|
|
||||||
//Serial.print(" ");
|
|
||||||
Serial.println(100*v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
//Damp 2 with running average position
|
|
||||||
|
|
||||||
#define n 10 //number in buffer
|
|
||||||
int x; //position measured
|
|
||||||
float xf; // running average on n samples
|
|
||||||
int buff[n];
|
|
||||||
int index = 0;
|
|
||||||
float v, oldavg; // estimate of velocity
|
|
||||||
byte c;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
buff[index] = analogRead(A0);
|
|
||||||
index++;
|
|
||||||
if(index > n-1) index = 0;
|
|
||||||
int acc = 0;
|
|
||||||
for(int i=0; i<n; i++)acc+=buff[i];
|
|
||||||
float avg = acc/n;
|
|
||||||
v = avg - oldavg;
|
|
||||||
oldavg = avg;
|
|
||||||
if(c++==0)Serial.println(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
//Damp3 trying integration to get velocity
|
|
||||||
// ala Kalman filtering?
|
|
||||||
|
|
||||||
int x; //position measured [0-1023]
|
|
||||||
float af, vf //acceleration, velocity estimates
|
|
||||||
float ff // force out
|
|
||||||
float K = 1.0 //spring
|
|
||||||
float B = 10.0 //damping (dominant)
|
|
||||||
float M = 1.0 //mass
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(115200);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
x = analogRead(A0);
|
|
||||||
ff = K*(xf-x) - B*vf; // the spring K
|
|
||||||
af = ff/M;
|
|
||||||
vf += af*T; //T is cycle time
|
|
||||||
xf += vf*T;
|
|
||||||
@ -1,783 +0,0 @@
|
|||||||
{
|
|
||||||
"patcher" : {
|
|
||||||
"fileversion" : 1,
|
|
||||||
"appversion" : {
|
|
||||||
"major" : 6,
|
|
||||||
"minor" : 0,
|
|
||||||
"revision" : 5
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"rect" : [ 25.0, 82.0, 1184.0, 641.0 ],
|
|
||||||
"bglocked" : 0,
|
|
||||||
"openinpresentation" : 0,
|
|
||||||
"default_fontsize" : 12.0,
|
|
||||||
"default_fontface" : 0,
|
|
||||||
"default_fontname" : "Arial",
|
|
||||||
"gridonopen" : 0,
|
|
||||||
"gridsize" : [ 15.0, 15.0 ],
|
|
||||||
"gridsnaponopen" : 0,
|
|
||||||
"statusbarvisible" : 2,
|
|
||||||
"toolbarvisible" : 1,
|
|
||||||
"boxanimatetime" : 200,
|
|
||||||
"imprint" : 0,
|
|
||||||
"enablehscroll" : 1,
|
|
||||||
"enablevscroll" : 1,
|
|
||||||
"devicewidth" : 0.0,
|
|
||||||
"description" : "",
|
|
||||||
"digest" : "",
|
|
||||||
"tags" : "",
|
|
||||||
"boxes" : [ {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-36",
|
|
||||||
"maxclass" : "flonum",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "float", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 360.0, 393.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-34",
|
|
||||||
"maxclass" : "number",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 229.0, 421.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-32",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "int" ],
|
|
||||||
"patching_rect" : [ 289.0, 421.0, 32.5, 20.0 ],
|
|
||||||
"text" : "* 1"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-31",
|
|
||||||
"maxclass" : "flonum",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "float", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 289.0, 452.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-29",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "int" ],
|
|
||||||
"patching_rect" : [ 289.0, 387.0, 32.5, 20.0 ],
|
|
||||||
"text" : "-"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-28",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 709.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "76"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-26",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 649.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "74"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-25",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 589.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "71"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-24",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 529.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "68"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-13",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 469.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "66"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-3",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 409.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "63"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-23",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 349.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "61"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-1",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 289.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "58"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-37",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 229.0, 345.0, 50.0, 18.0 ],
|
|
||||||
"text" : "57"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-27",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 10,
|
|
||||||
"outlettype" : [ "int", "bang", "bang", "bang", "bang", "bang", "bang", "bang", "bang", "bang" ],
|
|
||||||
"patching_rect" : [ 206.25, 306.0, 519.5, 20.0 ],
|
|
||||||
"text" : "t i b b b b b b b b b"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-22",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 5,
|
|
||||||
"outlettype" : [ "int", "bang", "bang", "bang", "bang" ],
|
|
||||||
"patching_rect" : [ 879.0, 313.0, 73.0, 20.0 ],
|
|
||||||
"text" : "t i b b b b"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"id" : "obj-21",
|
|
||||||
"maxclass" : "button",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "bang" ],
|
|
||||||
"patching_rect" : [ 310.0, 6.0, 20.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-20",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 3,
|
|
||||||
"outlettype" : [ "bang", "bang", "int" ],
|
|
||||||
"patching_rect" : [ 325.0, 37.0, 56.0, 20.0 ],
|
|
||||||
"text" : "uzi 1024"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-19",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 41.0, 370.0, 37.0, 18.0 ],
|
|
||||||
"text" : "clear"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"id" : "obj-17",
|
|
||||||
"maxclass" : "button",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "bang" ],
|
|
||||||
"patching_rect" : [ 292.0, 58.0, 20.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"hint" : "x 82 y -44",
|
|
||||||
"id" : "obj-15",
|
|
||||||
"maxclass" : "itable",
|
|
||||||
"name" : "",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 150.0, 488.0, 1000.0, 145.0 ],
|
|
||||||
"range" : 128,
|
|
||||||
"signed" : 1,
|
|
||||||
"size" : 1024,
|
|
||||||
"table_data" : [ 0, 80, 4, 4, -32, -34, -36, -40, -40, -42, -50, -50, -18, -18, -22, -20, -20, -20, -16, -20, -20, -18, -14, -14, -16, -18, -22, -20, -18, -20, -18, -18, -18, -16, -14, -12, -6, -2, -2, 0, 4, 6, 8, 10, 6, 6, 6, 8, 6, 8, 8, 8, 10, 8, 8, 8, 8, 6, 8, 6, 6, 8, 8, 6, 6, 8, 6, 8, 6, 6, 6, 8, 8, 6, 8, 6, 6, 6, 6, 6, 6, 8, 6, 8, 8, 8, 8, 6, 8, 6, 8, 10, 10, 10, 10, 12, 12, 12, 10, 6, 8, 10, 10, 10, 8, 10, 12, 14, 14, 10, 10, 10, 10, 10, 8, 6, 6, 10, 10, 10, 12, 12, 12, 14, 12, 10, 10, 10, 10, 8, 8, 8, 8, 10, 10, 10, 8, 10, 12, 10, 10, 6, 8, 6, 8, 8, 6, 6, 8, 8, 8, 10, 8, 6, 8, 8, 6, 8, 10, 8, 10, 10, 10, 10, 12, 12, 10, 10, 10, 10, 10, 10, 8, 10, 8, 10, 10, 12, 12, 12, 14, 10, 12, 10, 8, 6, 6, 8, 6, 6, 6, 6, 8, 8, 8, 6, 6, 6, 6, 6, 4, 6, 6, 6, 6, 8, 6, 6, 6, 4, 0, -2, -4, -8, -10, -14, -18, -20, -20, -20, -20, -24, -22, -32, -36, -38, -44, -46, -50, -48, -50, -40, -32, -36, -32, -34, -34, -32, -38, -36, -38, -32, -30, -32, -32, -32, -24, -26, -26, -26, -26, -22, -22, -22, -24, -22, -22, -20, -18, -14, -8, -6, -4, -2, 0, 0, 2, 2, 4, 4, 4, 4, 4, 4, 2, 2, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 6, 2, 4, 4, 6, 6, 6, 6, 4, 4, 2, 2, 0, 0, 0, 0, 2, 2, 2, 4, 6, 146, 140, 134, 126, 116, 104, 102, 100, -38, -30, -24, -16, -4, 10, 12, 12, 12, 12, 12, 14, 12, 18, 22, 24, 22, 18, 14, 8, 2, -12, -20, -24, -28, -28, -26, -26, -22, -18, -22, -22, -18, -18, -14, -10, -4, 0, 10, -2, -14, -28, -38, -48, -54, -56, -66, -54, -50, -36, -32, -28, -26, -28, -22, -22, -14, -12, -6, -2, -2, 6, 6, 10, 10, 12, 12, 12, 12, 8, 10, 10, 10, 8, 6, 6, 6, 4, 2, 0, 0, 2, 2, 4, 6, 10, 18, 22, 26, 34, 36, 40, 40, 38, 28, 20, 12, 2, 0, -6, -8, -10, -8, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 4, 6, 4, 4, 4, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -4, -4, -4, -4, -4, -6, -6, -4, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -4, -6, -4, -6, -8, -10, -12, -14, -16, -18, -26, -30, -34, -34, -34, -34, -34, -32, -24, -20, -18, -18, -18, -18, -14, -8, -6, 2, 8, 12, 26, 30, 40, 38, 40, 40, 40, 44, 34, 34, 26, 26, 24, 20, 20, 16, 16, 18, 18, 24, 26, 26, 34, 36, 46, 46, 44, 38, 36, 36, 26, 22, 10, 4, 0, -8, -12, -16, -26, -30, -34, -34, -30, -26, -30, -32, -26, -26, -26, -26, -28, -30, -26, -24, -22, -20, -20, -20, -20, -18, -20, -20, -22, -24, -22, -24, -28, -32, -28, -30, -30, -30, -30, -26, -20, -12, -8, 4, 16, 22, 26, 32, 38, 38, 36, 36, 30, 32, 32, 30, 34, 34, 34, 30, 32, 32, 40, 38, 30, 32, 36, 36, 40, 40, 30, 32, 34, 32, 28, 28, 20, 14, 12, 4, -4, -10, -20, -28, -38, -46, -48, -48, -46, -42, -38, -38, -34, -26, -26, -28, -32, -36, -38, -38, -38, -38, -42, -42, -36, -36, -32, -30, -26, -38, -32, -28, -36, -34, -32, -32, -30, -18, -18, -18, -12, -10, -12, -10, -10, -8, -6, -2, 2, 6, 10, 12, 16, 18, 20, 22, 24, 24, 26, 28, 28, 30, 32, 28, 28, 32, 30, 34, 32, 28, 24, 24, 20, 12, 10, 2, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, 0, 2, 4, 4, 6, 6, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2, 4, 4, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 4, 4, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-14",
|
|
||||||
"maxclass" : "number",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 150.0, 337.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-12",
|
|
||||||
"maxclass" : "number",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 451.0, 92.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"id" : "obj-11",
|
|
||||||
"maxclass" : "toggle",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "int" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 451.0, -4.0, 20.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-9",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "bang" ],
|
|
||||||
"patching_rect" : [ 451.0, 27.0, 51.0, 20.0 ],
|
|
||||||
"text" : "metro 1"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-8",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 5,
|
|
||||||
"numoutlets" : 4,
|
|
||||||
"outlettype" : [ "int", "", "", "int" ],
|
|
||||||
"patching_rect" : [ 451.0, 60.0, 101.0, 20.0 ],
|
|
||||||
"text" : "counter 0 1 1024"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-7",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 0,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 310.0, 96.0, 100.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-6",
|
|
||||||
"maxclass" : "number",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 150.0, 85.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"hint" : "x 79 y 127",
|
|
||||||
"id" : "obj-4",
|
|
||||||
"maxclass" : "itable",
|
|
||||||
"name" : "",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 150.0, 153.0, 1000.0, 145.0 ],
|
|
||||||
"range" : 128,
|
|
||||||
"size" : 1024,
|
|
||||||
"table_data" : [ 0, 56, 55, 54, 53, 51, 51, 50, 48, 48, 46, 45, 42, 41, 41, 40, 40, 38, 36, 36, 35, 34, 33, 31, 29, 28, 27, 26, 26, 25, 24, 23, 22, 22, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 36, 36, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 50, 50, 51, 51, 52, 53, 53, 53, 53, 54, 56, 56, 57, 57, 58, 59, 60, 61, 61, 61, 62, 62, 63, 63, 63, 64, 66, 66, 67, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 73, 74, 74, 76, 76, 77, 77, 78, 79, 79, 79, 79, 80, 80, 81, 82, 82, 82, 83, 83, 84, 85, 85, 85, 86, 86, 86, 87, 89, 89, 90, 90, 91, 91, 92, 93, 94, 94, 95, 95, 96, 96, 96, 98, 98, 99, 100, 101, 102, 102, 103, 103, 104, 104, 104, 104, 105, 106, 106, 106, 107, 107, 108, 108, 109, 109, 109, 109, 110, 110, 110, 111, 112, 112, 112, 113, 113, 113, 113, 113, 112, 111, 110, 109, 108, 106, 104, 103, 102, 101, 100, 97, 97, 90, 86, 84, 80, 78, 75, 73, 72, 70, 70, 66, 64, 61, 58, 57, 53, 52, 51, 50, 49, 45, 42, 41, 41, 39, 38, 37, 36, 34, 31, 30, 29, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 29, 29, 29, 29, 29, 29, 29, 30, 30, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 34, 35, 105, 102, 99, 96, 91, 85, 85, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 93, 95, 95, 99, 102, 103, 103, 102, 100, 99, 96, 93, 92, 91, 89, 88, 87, 86, 85, 84, 81, 80, 80, 79, 80, 81, 83, 84, 86, 79, 73, 65, 61, 57, 56, 56, 53, 52, 48, 47, 45, 43, 43, 42, 42, 41, 41, 41, 42, 42, 42, 45, 45, 46, 46, 47, 48, 48, 48, 49, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 53, 54, 56, 60, 62, 64, 69, 70, 73, 74, 75, 74, 72, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 73, 73, 73, 73, 72, 71, 71, 70, 69, 68, 67, 66, 64, 62, 58, 55, 52, 51, 50, 49, 47, 46, 46, 45, 43, 42, 41, 40, 40, 42, 43, 46, 47, 48, 54, 55, 60, 61, 63, 66, 67, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 86, 88, 89, 94, 96, 102, 104, 104, 105, 106, 107, 107, 107, 107, 106, 104, 101, 100, 99, 94, 92, 90, 89, 89, 88, 85, 83, 81, 79, 77, 76, 75, 73, 72, 71, 70, 69, 67, 66, 65, 64, 62, 61, 59, 57, 56, 54, 51, 48, 48, 46, 44, 42, 41, 41, 41, 42, 44, 48, 52, 53, 54, 57, 60, 61, 62, 66, 67, 69, 70, 72, 77, 78, 79, 81, 83, 85, 90, 91, 92, 94, 97, 99, 103, 105, 105, 107, 109, 110, 111, 113, 113, 112, 111, 109, 107, 105, 101, 99, 94, 89, 87, 85, 84, 84, 82, 80, 77, 76, 74, 71, 68, 66, 63, 61, 58, 57, 53, 50, 50, 48, 47, 46, 45, 38, 37, 36, 32, 31, 31, 30, 30, 29, 28, 27, 26, 26, 25, 25, 25, 25, 25, 26, 27, 29, 30, 31, 33, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 51, 53, 57, 58, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 66, 66, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 73 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-2",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 63.0, 39.0, 150.0, 20.0 ],
|
|
||||||
"text" : "Plot Velocity from Position"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lines" : [ {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-23", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-1", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-9", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-11", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-15", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-12", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-4", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-12", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-24", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-13", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-8", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-17", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-15", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-19", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-8", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-20", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-20", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-21", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-3", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-23", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-25", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-24", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-26", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-25", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-28", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-26", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-1", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 2 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-13", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 5 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-23", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 3 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-24", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 6 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-25", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 7 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-26", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 8 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-28", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 9 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-3", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 4 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-37", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 1 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-37", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-27", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-29", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-28", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-32", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-29", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-34", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-29", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-13", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-3", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-15", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-31", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-31", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-32", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-32", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-36", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-1", 1 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-37", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-29", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-37", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-14", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-4", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-27", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-4", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-4", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-6", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-12", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-8", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-8", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-9", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependency_cache" : [ ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
int x, v, t; //position velocity time
|
|
||||||
#define n 10
|
|
||||||
int xtab[n]; //table of x
|
|
||||||
int i; // index for table
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// start serial port at 9600 bps:
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// if we get a valid byte, read analog ins:
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
x = analogRead(A0)/4; //just for this test
|
|
||||||
xtab[i] = x; //put it in array of x
|
|
||||||
i = i + 1; //index to last x (9 times ago)
|
|
||||||
if(i>9)i=0; //increment index
|
|
||||||
v = x - xtab[i]; //difference x vs old x
|
|
||||||
t = (t+1)%256;
|
|
||||||
// send sensor values:
|
|
||||||
Serial.write(x); // sends one byte [0-255]
|
|
||||||
Serial.write(v+128);
|
|
||||||
Serial.write(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,29 +0,0 @@
|
|||||||
int x, v, t; //position velocity time
|
|
||||||
#define n 10
|
|
||||||
int xtab[n]; //table of x
|
|
||||||
int i; // index for table
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// start serial port at 9600 bps:
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// if we get a valid byte, read analog ins:
|
|
||||||
//if (Serial.available() > 0) {
|
|
||||||
x = analogRead(A0)/4; //just for this test
|
|
||||||
xtab[i] = x; //put it in array of x
|
|
||||||
i = i + 1; //index to last x (9 times ago)
|
|
||||||
if(i>9)i=0; //increment index
|
|
||||||
v = x - xtab[i]; //difference x vs old x
|
|
||||||
t = (t+1)%256;
|
|
||||||
// send sensor values:
|
|
||||||
Serial.print(x); // sends one byte [0-255]
|
|
||||||
Serial.print(",");
|
|
||||||
Serial.print(v+128);
|
|
||||||
Serial.print(",");
|
|
||||||
Serial.println(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
|||||||
// Velosity sends only one byte values
|
|
||||||
|
|
||||||
int x, v, t; //position velocity time
|
|
||||||
|
|
||||||
#define n 10
|
|
||||||
int xtab[n]; //table of x
|
|
||||||
int i; // index for table
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// start serial port at 9600 bps:
|
|
||||||
Serial.begin(9600);
|
|
||||||
establishContact(); // send a byte to establish contact until receiver responds
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// if we get a valid byte, read analog ins:
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
x = analogRead(A0)/4;
|
|
||||||
xtab[i] = x; //put it in array of x
|
|
||||||
i = i + 1; //index to last x (9 times ago)
|
|
||||||
if(i>9)i=0; //increment index
|
|
||||||
v = x - xtab[i]; //difference x vs old x
|
|
||||||
t = (t+1)%256;
|
|
||||||
// send sensor values:
|
|
||||||
Serial.write(x);
|
|
||||||
Serial.write(",");
|
|
||||||
Serial.write(v+128);
|
|
||||||
Serial.write(",");
|
|
||||||
Serial.write(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void establishContact() {
|
|
||||||
while (Serial.available() <= 0) {
|
|
||||||
Serial.println("0,0,0"); // send an initial string
|
|
||||||
delay(300);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@
|
|||||||
int x, v, t; //position velocity time
|
|
||||||
#define n 10
|
|
||||||
int xtab[n]; //table of x
|
|
||||||
int i; // index for table
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// start serial port at 9600 bps:
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// if we get a valid byte, read analog ins:
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
x = analogRead(A0)/4; //just for this test
|
|
||||||
xtab[i] = x; //put it in array of x
|
|
||||||
i = i + 1; //index to last x (9 times ago)
|
|
||||||
if(i>9)i=0; //increment index
|
|
||||||
v = x - xtab[i]; //difference x vs old x
|
|
||||||
t = (t+1)%256;
|
|
||||||
// send sensor values:
|
|
||||||
Serial.write(x); // sends one byte [0-255]
|
|
||||||
Serial.write(v+128);
|
|
||||||
Serial.write(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,576 +0,0 @@
|
|||||||
{
|
|
||||||
"patcher" : {
|
|
||||||
"fileversion" : 1,
|
|
||||||
"appversion" : {
|
|
||||||
"major" : 6,
|
|
||||||
"minor" : 0,
|
|
||||||
"revision" : 5
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"rect" : [ 50.0, 94.0, 693.0, 652.0 ],
|
|
||||||
"bglocked" : 0,
|
|
||||||
"openinpresentation" : 0,
|
|
||||||
"default_fontsize" : 12.0,
|
|
||||||
"default_fontface" : 0,
|
|
||||||
"default_fontname" : "Arial",
|
|
||||||
"gridonopen" : 0,
|
|
||||||
"gridsize" : [ 15.0, 15.0 ],
|
|
||||||
"gridsnaponopen" : 0,
|
|
||||||
"statusbarvisible" : 2,
|
|
||||||
"toolbarvisible" : 1,
|
|
||||||
"boxanimatetime" : 200,
|
|
||||||
"imprint" : 0,
|
|
||||||
"enablehscroll" : 1,
|
|
||||||
"enablevscroll" : 1,
|
|
||||||
"devicewidth" : 0.0,
|
|
||||||
"description" : "",
|
|
||||||
"digest" : "",
|
|
||||||
"tags" : "",
|
|
||||||
"boxes" : [ {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-23",
|
|
||||||
"maxclass" : "flonum",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "float", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 561.0, 378.0, 50.0, 20.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-20",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "float" ],
|
|
||||||
"patching_rect" : [ 519.0, 429.0, 44.0, 20.0 ],
|
|
||||||
"text" : "+ 500."
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-18",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "float" ],
|
|
||||||
"patching_rect" : [ 418.0, 414.0, 42.0, 20.0 ],
|
|
||||||
"text" : "* 100."
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-32",
|
|
||||||
"linecount" : 10,
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 479.0, 6.0, 344.0, 145.0 ],
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-30",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 3,
|
|
||||||
"numoutlets" : 3,
|
|
||||||
"outlettype" : [ "bang", "bang", "" ],
|
|
||||||
"patching_rect" : [ 327.0, 80.0, 62.0, 20.0 ],
|
|
||||||
"text" : "select 0 1"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-26",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 412.0, 231.0, 206.0, 20.0 ],
|
|
||||||
"text" : "click here to close the serial port"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-27",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 412.0, 205.0, 206.0, 20.0 ],
|
|
||||||
"text" : "click here to open the serial port"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-21",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 327.0, 231.0, 39.0, 18.0 ],
|
|
||||||
"text" : "close"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-19",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 349.0, 205.0, 41.0, 18.0 ],
|
|
||||||
"text" : "port a"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"bgcolor" : [ 0.231373, 0.713726, 1.0, 1.0 ],
|
|
||||||
"candicane2" : [ 0.145098, 0.203922, 0.356863, 1.0 ],
|
|
||||||
"candicane3" : [ 0.290196, 0.411765, 0.713726, 1.0 ],
|
|
||||||
"candicane4" : [ 0.439216, 0.619608, 0.070588, 1.0 ],
|
|
||||||
"candicane5" : [ 0.584314, 0.827451, 0.431373, 1.0 ],
|
|
||||||
"candicane6" : [ 0.733333, 0.035294, 0.788235, 1.0 ],
|
|
||||||
"candicane7" : [ 0.878431, 0.243137, 0.145098, 1.0 ],
|
|
||||||
"candicane8" : [ 0.027451, 0.447059, 0.501961, 1.0 ],
|
|
||||||
"contdata" : 1,
|
|
||||||
"id" : "obj-1",
|
|
||||||
"maxclass" : "multislider",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "", "" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 302.0, 450.0, 246.0, 167.0 ],
|
|
||||||
"peakcolor" : [ 0.498039, 0.498039, 0.498039, 1.0 ],
|
|
||||||
"setminmax" : [ 0.0, 1023.0 ],
|
|
||||||
"setstyle" : 3,
|
|
||||||
"settype" : 0,
|
|
||||||
"slidercolor" : [ 0.066667, 0.058824, 0.776471, 1.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-2",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 412.0, 179.0, 207.0, 20.0 ],
|
|
||||||
"text" : "Click here to get a list of serial ports"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-3",
|
|
||||||
"linecount" : 2,
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 153.0, 409.0, 138.0, 34.0 ],
|
|
||||||
"text" : "Here's the number from Arduino's analog input"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-4",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 379.0, 378.0, 147.0, 20.0 ],
|
|
||||||
"text" : "Convert ASCII to symbol"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-5",
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 379.0, 355.0, 147.0, 20.0 ],
|
|
||||||
"text" : "Convert integer to ASCII"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
|
|
||||||
"id" : "obj-6",
|
|
||||||
"maxclass" : "number",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "bang" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 302.0, 414.0, 37.0, 20.0 ],
|
|
||||||
"triscale" : 0.9
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-7",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 302.0, 378.0, 74.0, 20.0 ],
|
|
||||||
"text" : "fromsymbol"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"color" : [ 1.0, 0.890196, 0.090196, 1.0 ],
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-8",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 3,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "int" ],
|
|
||||||
"patching_rect" : [ 302.0, 355.0, 46.0, 20.0 ],
|
|
||||||
"text" : "itoa"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-9",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "", "" ],
|
|
||||||
"patching_rect" : [ 302.0, 332.0, 64.0, 20.0 ],
|
|
||||||
"text" : "zl group 4"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-10",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 3,
|
|
||||||
"numoutlets" : 3,
|
|
||||||
"outlettype" : [ "bang", "bang", "" ],
|
|
||||||
"patching_rect" : [ 244.0, 281.0, 77.0, 20.0 ],
|
|
||||||
"text" : "select 10 13"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"id" : "obj-11",
|
|
||||||
"maxclass" : "toggle",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "int" ],
|
|
||||||
"parameter_enable" : 0,
|
|
||||||
"patching_rect" : [ 244.0, 43.0, 15.0, 15.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-12",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "bang" ],
|
|
||||||
"patching_rect" : [ 244.0, 80.0, 65.0, 20.0 ],
|
|
||||||
"text" : "qmetro 10"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-13",
|
|
||||||
"maxclass" : "message",
|
|
||||||
"numinlets" : 2,
|
|
||||||
"numoutlets" : 1,
|
|
||||||
"outlettype" : [ "" ],
|
|
||||||
"patching_rect" : [ 369.0, 179.0, 36.0, 18.0 ],
|
|
||||||
"text" : "print"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-14",
|
|
||||||
"maxclass" : "newobj",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 2,
|
|
||||||
"outlettype" : [ "int", "" ],
|
|
||||||
"patching_rect" : [ 244.0, 255.0, 84.0, 20.0 ],
|
|
||||||
"text" : "serial a 9600"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-15",
|
|
||||||
"linecount" : 2,
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 53.0, 72.0, 185.0, 34.0 ],
|
|
||||||
"text" : "Read serial input buffer every 10 milliseconds"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-16",
|
|
||||||
"linecount" : 3,
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 332.0, 269.0, 320.0, 48.0 ],
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"box" : {
|
|
||||||
"fontname" : "Arial",
|
|
||||||
"fontsize" : 12.0,
|
|
||||||
"id" : "obj-17",
|
|
||||||
"linecount" : 2,
|
|
||||||
"maxclass" : "comment",
|
|
||||||
"numinlets" : 1,
|
|
||||||
"numoutlets" : 0,
|
|
||||||
"patching_rect" : [ 271.0, 32.0, 199.0, 34.0 ],
|
|
||||||
"text" : "Click to open/close serial port and start/stop patch"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lines" : [ {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-9", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 311.5, 320.0, 311.5, 320.0 ],
|
|
||||||
"source" : [ "obj-10", 2 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-9", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 253.5, 308.0, 311.5, 308.0 ],
|
|
||||||
"source" : [ "obj-10", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-12", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-11", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-30", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 253.0, 71.0, 336.5, 71.0 ],
|
|
||||||
"source" : [ "obj-11", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-14", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-12", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-14", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 378.5, 200.5, 253.5, 200.5 ],
|
|
||||||
"source" : [ "obj-13", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-10", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-14", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-20", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-18", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-14", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 358.5, 228.5, 253.5, 228.5 ],
|
|
||||||
"source" : [ "obj-19", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-23", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-20", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-14", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"midpoints" : [ 336.5, 251.5, 253.5, 251.5 ],
|
|
||||||
"source" : [ "obj-21", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-1", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-23", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-19", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-30", 1 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-21", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-30", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-1", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-6", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-18", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-7", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-7", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-8", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
"patchline" : {
|
|
||||||
"destination" : [ "obj-8", 0 ],
|
|
||||||
"disabled" : 0,
|
|
||||||
"hidden" : 0,
|
|
||||||
"source" : [ "obj-9", 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependency_cache" : [ ]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
|
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
|
||||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
|
|
||||||
|
|
||||||
\f0\fs24 \cf0 "Hello, World" Apps\
|
|
||||||
\
|
|
||||||
Wall (spring with and without damping) - how stiff without instability? - does damping help?\
|
|
||||||
Center (full range of force and position) - \
|
|
||||||
\
|
|
||||||
Music -\
|
|
||||||
position -> pitch (linear, non-linear)\
|
|
||||||
gain -> FSR (second device?)\
|
|
||||||
\
|
|
||||||
Motor -\
|
|
||||||
timed (open-loop) - "tick" "rumble" "\
|
|
||||||
ramp - up,stay,dn,stay, etc.\
|
|
||||||
rhythm - march, waltz, \'85\
|
|
||||||
position - table/function (no time dependence) [ is this part of Motion?]\
|
|
||||||
\
|
|
||||||
Motion - \
|
|
||||||
spring (position)\
|
|
||||||
damping (velocity)\
|
|
||||||
inertia (acceleration)\
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
#include <Motion.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Two motion objects are available from the MMM Motions library
|
|
||||||
(1) MotionA
|
|
||||||
(2) MotionB
|
|
||||||
|
|
||||||
MOTION {
|
|
||||||
MOTIONA ,
|
|
||||||
MOTIONB1
|
|
||||||
};
|
|
||||||
|
|
||||||
Each objects needs intialisation with a specific input
|
|
||||||
from which ADC reading will be performed.
|
|
||||||
|
|
||||||
Users may choose and identify inputs aa INPUT[A0, ... ,A7].
|
|
||||||
ex: MotionA.init(INPOUTA5);
|
|
||||||
|
|
||||||
INPUT {
|
|
||||||
INPUTA0,
|
|
||||||
INPUTA1,
|
|
||||||
INPUTA2,
|
|
||||||
INPUTA3,
|
|
||||||
INPUTA4,
|
|
||||||
INPUTA5,
|
|
||||||
INPUTA6,
|
|
||||||
INPUTA7
|
|
||||||
}
|
|
||||||
|
|
||||||
All calculation of physics (position, velocity and acceleration)
|
|
||||||
are computed internally usign interrupts and timers. To access
|
|
||||||
such information, user may call getPosition(), getVelocity()
|
|
||||||
and getAcceleration() respectively on a initialised Motion object.
|
|
||||||
|
|
||||||
int getPosition();
|
|
||||||
float getVelocity();
|
|
||||||
float getAcceleration();
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
MotionA.init(INPUTA0);
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Serial.print("position: "); Serial.println(MotionA.getPosition());
|
|
||||||
Serial.print("velocity: "); Serial.println(MotionA.getVelocity());
|
|
||||||
Serial.print("accel: "); Serial.println(MotionA.getAcceleration());
|
|
||||||
Serial.println("-------");
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
// "Pendulum" - spring-mass oscillator
|
|
||||||
#include <Motion.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
byte incomingByte;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// init MotionA & MotorA
|
|
||||||
MotionA.init(INPUTA0);
|
|
||||||
MotorA.init();
|
|
||||||
|
|
||||||
// provide MotionA with initial physics constants
|
|
||||||
MotionA.k = 0.2f; // spring
|
|
||||||
MotionA.m = 0.3f; // mass
|
|
||||||
MotionA.d = 0.02f; // damping
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
|
|
||||||
if(MotionA.F < 0) MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
float t = abs(MotionA.F);
|
|
||||||
MotorA.torque(t);
|
|
||||||
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
incomingByte = Serial.read();
|
|
||||||
if(incomingByte == '1'){
|
|
||||||
MotionA.m = MotionA.m * 1.1;
|
|
||||||
Serial.print("m: ");
|
|
||||||
Serial.println(MotionA.m);
|
|
||||||
}
|
|
||||||
else if(incomingByte == '!'){
|
|
||||||
MotionA.m = MotionA.m / 1.1;
|
|
||||||
Serial.print("m: ");
|
|
||||||
Serial.println(MotionA.m);
|
|
||||||
}
|
|
||||||
else if(incomingByte == '2'){
|
|
||||||
MotionA.k = MotionA.k * 1.1;
|
|
||||||
Serial.print("k: ");
|
|
||||||
Serial.println(MotionA.k);
|
|
||||||
}
|
|
||||||
else if(incomingByte == '@'){
|
|
||||||
MotionA.k = MotionA.k / 1.1;
|
|
||||||
Serial.print("k: ");
|
|
||||||
Serial.println(MotionA.k);
|
|
||||||
}
|
|
||||||
else if(incomingByte == '3'){
|
|
||||||
MotionA.d = MotionA.d * 1.1;
|
|
||||||
Serial.print("d: ");
|
|
||||||
Serial.println(MotionA.d);
|
|
||||||
}
|
|
||||||
else if(incomingByte == '#'){
|
|
||||||
MotionA.d = MotionA.d / 1.1;
|
|
||||||
Serial.print("d: ");
|
|
||||||
Serial.println(MotionA.d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
// "Pendulum" - spring-mass oscillator
|
|
||||||
// Spring-Mass oscillator (no damping)
|
|
||||||
|
|
||||||
//#include <TimerOne.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
float dt = .005; //time per cycle
|
|
||||||
float m = 4.0; //time constant was .002
|
|
||||||
float k = 1.0; // spring constant was .15
|
|
||||||
float xf,vf,ff; // floating point versions of pendulum x and v and force
|
|
||||||
int x; // input from analogRead();
|
|
||||||
int f; // integer version of force
|
|
||||||
int duty; // abs(f)
|
|
||||||
byte c=0; //counts up until 0 then prints
|
|
||||||
|
|
||||||
byte incomingByte;
|
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init(); //initializes Timer1, pinModes
|
|
||||||
Serial.begin(9600);
|
|
||||||
//initialize position (xf), velocity (vf), force (ff)
|
|
||||||
x = analogRead(A0) - 512; //middle of 0-1-23 range
|
|
||||||
xf = x;
|
|
||||||
vf = 0.0;
|
|
||||||
ff = 0.0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
x = analogRead(0) - 512; // position [0-1024]
|
|
||||||
ff = k*(x - xf); // spring
|
|
||||||
vf = vf + (ff/m)*dt; // integrate F/m to get velocity
|
|
||||||
xf = xf + vf*dt; // integrate velocity to get position
|
|
||||||
|
|
||||||
duty = abs(ff);
|
|
||||||
duty = min(duty,512); //Motor has max torque of 512
|
|
||||||
|
|
||||||
|
|
||||||
MotorA.torque(duty);
|
|
||||||
if(ff>0)MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
if (c++ == 0){
|
|
||||||
Serial.println(xf);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
incomingByte = Serial.read();
|
|
||||||
if(incomingByte == '\''){
|
|
||||||
tf = tf * 1.1;
|
|
||||||
Serial.println(tf);
|
|
||||||
}
|
|
||||||
if(incomingByte == ';'){
|
|
||||||
tf = tf / 1.1;
|
|
||||||
Serial.println(tf);
|
|
||||||
}
|
|
||||||
if(incomingByte == '.'){
|
|
||||||
kf = kf / 1.1;
|
|
||||||
Serial.println(tf);
|
|
||||||
}
|
|
||||||
if(incomingByte == '/'){
|
|
||||||
kf = kf * 1.1;
|
|
||||||
Serial.println(tf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
// Damped Spring-Mass Oscillator
|
|
||||||
// BV 24Jan13
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
int Fout, Xin, duty;
|
|
||||||
|
|
||||||
// mass sring damper model
|
|
||||||
float m = 4.0;
|
|
||||||
float k = 1.0;
|
|
||||||
float b = 0.0;
|
|
||||||
float dT = .005;
|
|
||||||
float X, V, F; // model parameters (2nd-order oscil)
|
|
||||||
|
|
||||||
byte c=0; //counts up until 0 then prints
|
|
||||||
|
|
||||||
byte incomingByte;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
MotorA.init(); // initializes Timer1, pinModes
|
|
||||||
Xin = analogRead(A0) - 512; //middle of 0-1023 range
|
|
||||||
// initialize model variables
|
|
||||||
X = Xin;
|
|
||||||
V = 0.0;
|
|
||||||
F = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
Xin = analogRead(A0) - 512;
|
|
||||||
F = k*(Xin - X) - b*V; //spring and damper
|
|
||||||
V += (F/m) * dT;
|
|
||||||
X += V * dT;
|
|
||||||
|
|
||||||
duty = abs(Fout);
|
|
||||||
duty = min(duty,512);
|
|
||||||
|
|
||||||
MotorA.torque(duty);
|
|
||||||
if(Fout>0)MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
if (c++ == 0){
|
|
||||||
Serial.println(X);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
incomingByte = Serial.read();
|
|
||||||
if(incomingByte == '}''){
|
|
||||||
dT = dT * 1.1;
|
|
||||||
Serial.println(dT);
|
|
||||||
}
|
|
||||||
if(incomingByte == '\'){ shift \
|
|
||||||
dT = dT / 1.1;
|
|
||||||
Serial.println(dT);
|
|
||||||
}
|
|
||||||
if(incomingByte == '|'){
|
|
||||||
k = k / 1.1;
|
|
||||||
Serial.println(k);
|
|
||||||
}
|
|
||||||
if(incomingByte == '}'){ //shift ]
|
|
||||||
k = k * 1.1;
|
|
||||||
Serial.println(k);
|
|
||||||
}
|
|
||||||
if(incomingByte == '['){
|
|
||||||
b = b / 1.1;
|
|
||||||
Serial.println(b);
|
|
||||||
}
|
|
||||||
if(incomingByte == '{'){ //shift [
|
|
||||||
b = b * 1.1;
|
|
||||||
Serial.println(b);
|
|
||||||
}
|
|
||||||
if(incomingByte == '['){
|
|
||||||
m = m / 1.1;
|
|
||||||
Serial.println(m);
|
|
||||||
}
|
|
||||||
if(incomingBmyte == '{'){ //shift [
|
|
||||||
m = m * 1.1;
|
|
||||||
Serial.println(m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
// "Pendulum" - spring-mass oscillator
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <TimerOne.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
float tf = 0.002; //time constant was .002
|
|
||||||
float kf = 0.2; // spring constant was .15
|
|
||||||
float xf,vf,ff; // floating point versions of pendulum x and v and force
|
|
||||||
int x, f; //int versions of position (from a/d) and force (to Pwm)
|
|
||||||
int duty; // abs(f)
|
|
||||||
byte c=0; //counts up until 0 then prints
|
|
||||||
|
|
||||||
float m = 0.3;
|
|
||||||
float k = 0.01;
|
|
||||||
|
|
||||||
float damp = 0.09;
|
|
||||||
|
|
||||||
byte incomingByte;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
//Timer1.initialize(64); //64 microsecond period
|
|
||||||
MotorA.torque(100); //initializes Timer1, pinModes
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
x = analogRead(0); // position [0-1024]
|
|
||||||
ff = kf*(x - xf); // spring
|
|
||||||
f = max(ff,-1024);
|
|
||||||
f = min(f,1024);
|
|
||||||
// if(f>0)digitalWrite(DIRA,HIGH);
|
|
||||||
// else digitalWrite(DIRA,LOW);
|
|
||||||
duty = abs(f);
|
|
||||||
// Timer1.pwm(9,duty);
|
|
||||||
MotorA.torque(duty);
|
|
||||||
if(f>0)MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
|
|
||||||
// update (integrate) floating versions of xf and vf
|
|
||||||
//integrate twice tf is deltaT/mass;
|
|
||||||
vf += ff*tf;
|
|
||||||
xf += vf*tf;
|
|
||||||
|
|
||||||
if(c++==0) // when c gets to 255 it's next == 0 and sends data
|
|
||||||
{
|
|
||||||
Serial.print(x);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(xf);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c++ == 0)Serial.println(x); //
|
|
||||||
if (Serial.available() > 0) {
|
|
||||||
//Serial.print(v);
|
|
||||||
//Serial.print(" ");
|
|
||||||
//Serial.println(x);
|
|
||||||
incomingByte = Serial.read();
|
|
||||||
//Serial.write(incomingByte);
|
|
||||||
if(incomingByte == '\''){
|
|
||||||
m = m * 1.1;
|
|
||||||
Serial.println(m);
|
|
||||||
}
|
|
||||||
if(incomingByte == ';'){
|
|
||||||
m = m / 1.1;
|
|
||||||
Serial.println(m);
|
|
||||||
}
|
|
||||||
if(incomingByte == '.'){
|
|
||||||
k = k / 1.1;
|
|
||||||
Serial.println(k);
|
|
||||||
}
|
|
||||||
if(incomingByte == '/'){
|
|
||||||
k = k * 1.1;
|
|
||||||
Serial.println(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
#include <Motion.h>
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
char buf[16] = "";
|
|
||||||
|
|
||||||
char b = 'x';
|
|
||||||
String inputString = "";
|
|
||||||
boolean stringComplete = false;
|
|
||||||
|
|
||||||
float k, m, d;
|
|
||||||
int duty;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
|
|
||||||
MotorA.init();
|
|
||||||
|
|
||||||
MotionA.init(INPUTA0);
|
|
||||||
|
|
||||||
MotionA.k = 0.2f; // spring
|
|
||||||
MotionA.m = 1.0f; // mass
|
|
||||||
MotionA.d = 0.02f; // damping
|
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
//send force out
|
|
||||||
if (MotionA.F > 0) MotorA.direction(FORWARD);
|
|
||||||
else MotorA.direction(BACKWARD);
|
|
||||||
duty = abs(MotionA.F);
|
|
||||||
duty = min(512,duty);
|
|
||||||
MotorA.torque(duty);
|
|
||||||
|
|
||||||
//send data to be plotted by Processing "plotter"
|
|
||||||
sprintf(buf, "%d %d %d %d", (int)MotionA.F, (int)MotionA.A, (int)MotionA.V, (int)MotionA.X);
|
|
||||||
Serial.println(buf);
|
|
||||||
|
|
||||||
delay(10);
|
|
||||||
|
|
||||||
if(stringComplete) {
|
|
||||||
if(b == 'k') {
|
|
||||||
MotionA.k = convertToFloat(inputString);
|
|
||||||
} else if(b == 'm') {
|
|
||||||
MotionA.m = convertToFloat(inputString);
|
|
||||||
} else if(b == 'd') {
|
|
||||||
MotionA.d = convertToFloat(inputString);
|
|
||||||
}
|
|
||||||
b = 'x';
|
|
||||||
stringComplete = false;
|
|
||||||
inputString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialEvent() {
|
|
||||||
while (Serial.available()) {
|
|
||||||
char inChar = (char)Serial.read();
|
|
||||||
if(inChar == 'k' || inChar == 'm' || inChar == 'd') {
|
|
||||||
b = inChar;
|
|
||||||
} else {
|
|
||||||
if (inChar == ';') {
|
|
||||||
stringComplete = true;
|
|
||||||
} else
|
|
||||||
inputString += inChar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float convertToFloat(String str) {
|
|
||||||
char buf[16] = "";
|
|
||||||
str.toCharArray(buf, str.length() + 1);
|
|
||||||
return atof(buf);
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
float pos, fin, finmax, fout;
|
|
||||||
byte c; // used as a counter from 0 to 255
|
|
||||||
int duty;
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
digitalWrite(A4,HIGH);
|
|
||||||
digitalWrite(A5,LOW);
|
|
||||||
pinMode(A4, INPUT);
|
|
||||||
pinMode(A5, OUTPUT);
|
|
||||||
//MotorB._period(32);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
fin += .01*(analogRead(A4)-fin);
|
|
||||||
fout = 0.5*fin*(1024+random(1024));
|
|
||||||
duty = min(1024,fout);
|
|
||||||
duty = abs(duty);
|
|
||||||
//duty = min(duty,1024);
|
|
||||||
MotorB.torque(duty);
|
|
||||||
if(fout<0)MotorB.direction(FORWARD);
|
|
||||||
else MotorB.direction(BACKWARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
//position and force reporting
|
|
||||||
//sends A0 (MotorA), A1 (ForceA)
|
|
||||||
//sends A3 (MotorB), A4 (ForceB)
|
|
||||||
// to Serial Monitor
|
|
||||||
|
|
||||||
// should FSR set-up be in MMM lib?
|
|
||||||
// Bill Verplank 24Jan13
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
|
||||||
//set up for FSR A1 to D4
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
digitalWrite(A1,HIGH); //internal pull-up
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
Serial.print(analogRead(A0)); //positionA
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(analogRead(A1)); //forceA
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
//#include <TimerOne.h>
|
|
||||||
//BV 24Jan13
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
MotorA.torque(500); //512 is max torque
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
MotorA.direction(FORWARD);
|
|
||||||
delay(1000);
|
|
||||||
MotorA.direction(BACKWARD);
|
|
||||||
delay(1000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
//motortest
|
|
||||||
//.5 sec forward, .5 sec back
|
|
||||||
|
|
||||||
#include <Motor.h>
|
|
||||||
|
|
||||||
int led = 13;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
MotorA.init();
|
|
||||||
MotorA.torque(511); //what is max torque?
|
|
||||||
pinMode(13, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
MotorA.direction(FORWARD);
|
|
||||||
digitalWrite(led,HIGH);
|
|
||||||
delay(500);
|
|
||||||
MotorA.direction(BACKWARD);
|
|
||||||
digitalWrite(led,LOW);
|
|
||||||
delay(500);
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
//position and force reporting
|
|
||||||
//sends A0 (MotorA), A1 (ForceA)
|
|
||||||
//sends A3 (MotorB), A4 (ForceB)
|
|
||||||
// to Serial Monitor
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
|
||||||
//set up for FSR A1 to D4
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
digitalWrite(A1,HIGH); //internal pull-up
|
|
||||||
//set up for FSR A4 to D5
|
|
||||||
pinMode(A4,INPUT);
|
|
||||||
pinMode(5,OUTPUT);
|
|
||||||
digitalWrite(5,LOW);
|
|
||||||
digitalWrite(A4,HIGH); //internal pull-up
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
Serial.print(analogRead(A0)); //positionA
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(analogRead(A1)); //positionA
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(analogRead(A3)); //positionA
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(analogRead(A4)); //forceA
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
//position and force reporting
|
|
||||||
//sends A0 (MotorA), A1 (ForceA)
|
|
||||||
//sends A3 (MotorB), A4 (ForceB)
|
|
||||||
// to Serial Monitor
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600);
|
|
||||||
//set up for FSR A1 to D4
|
|
||||||
pinMode(A1,INPUT);
|
|
||||||
pinMode(4,OUTPUT);
|
|
||||||
digitalWrite(4,LOW);
|
|
||||||
digitalWrite(A1,HIGH); //internal pull-up
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
Serial.print(analogRead(A0)); //positionA
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(analogRead(A1)); //forceA
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user