Getting Synched

First time after a lot of tries. -Bill
This commit is contained in:
Bill Verplank 2012-12-07 08:15:45 -08:00
parent 0a0e857cea
commit 4c9e2ee748
23 changed files with 1849 additions and 439 deletions

28
GitHowTo.rtf Normal file
View File

@ -0,0 +1,28 @@
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
{\fonttbl\f0\froman\fcharset0 Times-Roman;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\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 wich 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\
}

27
hardware/supplies.rtf Normal file
View File

@ -0,0 +1,27 @@
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww14840\viewh6880\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 list of supplies and suppliers --by bilver 4Nov12\
\
M&M&M board - CiiD Labs\
Cables\
- USB mini\
- 10-conductor ribbon cable with IDC socket and headers\
- audio mini-plug 3.5mm mono (stereo head-phones work)\
Motors\
- disk-drive head-positioner voice-coil motor (scavenged)\
- motorized fader\
mfg:\
Penny & Giles - http://www.pennyandgiles.com/Audio-and-Video-Controllers-pg-27,2,,.php\
Alps - http://www.alps.com/WebObjects/catalog.woa/E/HTML/Potentiometer/SlidePotentiometers/RSN1M/RSN1M_list.html\
Sparkfun - https://www.sparkfun.com/products/10734\
\
distributors:\
Sparkfun - https://www.sparkfun.com/products/10734\
Digi-Key\
Mouser\
Jameco\
Futurelec}

View File

@ -0,0 +1,36 @@
//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()
{
MotorA.torque(100); //is this necessary?
}
void loop()
{
pos = analogRead(A3);
force = k * (512 - pos);
duty = abs(force);
duty = min(511, duty);
MotorA.torque(duty);
if(force < 0) MotorA.direction(FORWARD);
else MotorA.direction(BACKWARD);
}

View File

@ -0,0 +1,36 @@
//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);
}

View File

@ -1,6 +1,6 @@
//Damp - measure velocity then f=Bv //Damp - measure velocity then f=Bv
#import <Motor.h> #import <Motor.h>
int x; //position measured int x; //position measured - then filtered
float v, f, t, xold; //velocity, force, time delta float v, f, t, xold; //velocity, force, time delta
byte c; //for debug print every 256th loop byte c; //for debug print every 256th loop

View File

@ -0,0 +1,28 @@
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

View File

@ -0,0 +1,29 @@
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);
}

View File

@ -7,7 +7,7 @@
"revision" : 5 "revision" : 5
} }
, ,
"rect" : [ 0.0, 44.0, 1280.0, 706.0 ], "rect" : [ 350.0, 44.0, 901.0, 670.0 ],
"bglocked" : 0, "bglocked" : 0,
"openinpresentation" : 0, "openinpresentation" : 0,
"default_fontsize" : 12.0, "default_fontsize" : 12.0,
@ -27,6 +27,55 @@
"digest" : "", "digest" : "",
"tags" : "", "tags" : "",
"boxes" : [ { "boxes" : [ {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-42",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 826.0, 620.0, 38.0, 20.0 ],
"text" : "- 127"
}
}
, {
"box" : {
"hint" : "x 186 y 210",
"id" : "obj-40",
"maxclass" : "itable",
"name" : "",
"numinlets" : 2,
"numoutlets" : 2,
"outlettype" : [ "int", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 128.0, 762.0, 706.0, 121.0 ],
"range" : 128,
"signed" : 1,
"size" : 255,
"table_data" : [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 1, 2, 0, 1, 1, 1, 2, 1, 1, 1, 0, 2, 1, 1, 1, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 0, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
}
}
, {
"box" : {
"hint" : "x 0 y 236",
"id" : "obj-41",
"maxclass" : "itable",
"name" : "",
"numinlets" : 2,
"numoutlets" : 2,
"outlettype" : [ "int", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 128.0, 663.0, 706.0, 114.0 ],
"range" : 255,
"size" : 255,
"table_data" : [ 0, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 116, 116, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 116, 115, 115, 116, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115 ]
}
}
, {
"box" : { "box" : {
"fontname" : "Arial", "fontname" : "Arial",
"fontsize" : 12.0, "fontsize" : 12.0,
@ -114,7 +163,7 @@
"fontname" : "Arial", "fontname" : "Arial",
"fontsize" : 12.0, "fontsize" : 12.0,
"id" : "obj-31", "id" : "obj-31",
"items" : [ "usbserial-AH01D7PO", ",", "Bluetooth-PDA-Sync", ",", "Bluetooth-Modem" ], "items" : [ "usbserial-AH01D7PK", ",", "Bluetooth-PDA-Sync", ",", "Bluetooth-Modem" ],
"maxclass" : "umenu", "maxclass" : "umenu",
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 3, "numoutlets" : 3,
@ -265,20 +314,6 @@
"text" : "sel 1" "text" : "sel 1"
} }
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-5",
"linecount" : 13,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 411.0, 686.0, 540.0, 186.0 ],
"text" : "Serial Call-Response ASCII \n\nSends a byte out the serial port, and reads 3 ASCII enoded, comma separated in, truncated by a linefeed. It then sets foregound color, xpos, and ypos of a circle using the values returned from the serial port. \n\nNote: This patch assumes that the device on the other end of the serial port is going to send a single byte of value 65 (ASCII A) on startup. The sketch waits for that byte, then sends an ASCII A whenever it wants more data. \n\ncreated 14 Apr 2009\nby Scott Fitzgerald and Tom Igoe\nupdated 31 October 2011"
}
} }
, { , {
"box" : { "box" : {
@ -321,327 +356,6 @@
"text" : "checks for the ascii value of newline to begin communication. After initial communication is made, this block shuts down. A byte is sent back to the Arduino, indicating the patch is ready to receive information." "text" : "checks for the ascii value of newline to begin communication. After initial communication is made, this block shuts down. A byte is sent back to the Arduino, indicating the patch is ready to receive information."
} }
}
, {
"box" : {
"fontname" : "Verdana",
"fontsize" : 10.0,
"id" : "obj-62",
"maxclass" : "newobj",
"numinlets" : 3,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 0,
"revision" : 5
}
,
"rect" : [ 54.0, 94.0, 640.0, 480.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 10.0,
"default_fontface" : 0,
"default_fontname" : "Verdana",
"gridonopen" : 0,
"gridsize" : [ 25.0, 25.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" : 11.595187,
"id" : "obj-47",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 375.0, 150.0, 98.0, 18.0 ],
"text" : "frgb 255 255 255"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 11.595187,
"id" : "obj-46",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 275.0, 125.0, 59.0, 18.0 ],
"text" : "frgb 0 0 0"
}
}
, {
"box" : {
"fontname" : "Verdana",
"fontsize" : 12.0,
"id" : "obj-45",
"maxclass" : "newobj",
"numinlets" : 3,
"numoutlets" : 3,
"outlettype" : [ "bang", "bang", "" ],
"patching_rect" : [ 300.0, 100.0, 66.0, 21.0 ],
"text" : "sel 255 0"
}
}
, {
"box" : {
"fontname" : "Verdana",
"fontsize" : 12.0,
"id" : "obj-43",
"maxclass" : "newobj",
"numinlets" : 4,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 50.0, 125.0, 180.0, 21.0 ],
"text" : "pack 0 0 0 0"
}
}
, {
"box" : {
"fontname" : "Verdana",
"fontsize" : 12.0,
"id" : "obj-42",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 200.0, 100.0, 40.0, 21.0 ],
"text" : "+ 10"
}
}
, {
"box" : {
"fontname" : "Verdana",
"fontsize" : 12.0,
"id" : "obj-41",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 75.0, 100.0, 40.0, 21.0 ],
"text" : "+ 10"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 11.595187,
"id" : "obj-40",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 50.0, 150.0, 152.0, 18.0 ],
"text" : "clear, paintoval $1 $2 $3 $4"
}
}
, {
"box" : {
"comment" : "",
"id" : "obj-58",
"maxclass" : "inlet",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 57.5, 40.0, 25.0, 25.0 ]
}
}
, {
"box" : {
"comment" : "",
"id" : "obj-59",
"maxclass" : "inlet",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 120.0, 40.0, 25.0, 25.0 ]
}
}
, {
"box" : {
"comment" : "",
"id" : "obj-60",
"maxclass" : "inlet",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 300.0, 40.0, 25.0, 25.0 ]
}
}
, {
"box" : {
"comment" : "",
"id" : "obj-61",
"maxclass" : "outlet",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 228.333344, 228.0, 25.0, 25.0 ]
}
}
],
"lines" : [ {
"patchline" : {
"destination" : [ "obj-61", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-40", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-43", 2 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-41", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-43", 3 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-42", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-40", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-43", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-46", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-45", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-47", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-45", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-61", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-46", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-61", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-47", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-41", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-58", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-43", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-58", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-42", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-59", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-43", 1 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-59", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-45", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-60", 0 ]
}
}
],
"dependency_cache" : [ ]
}
,
"patching_rect" : [ 128.0, 636.0, 269.0, 19.0 ],
"saved_object_attributes" : {
"fontface" : 0,
"fontsize" : 10.0,
"default_fontface" : 0,
"digest" : "",
"default_fontname" : "Verdana",
"fontname" : "Verdana",
"tags" : "",
"default_fontsize" : 10.0,
"description" : "",
"globalpatchername" : ""
}
,
"text" : "p \"draw the circle\""
}
} }
, { , {
"box" : { "box" : {
@ -724,17 +438,6 @@
"text" : "sel 10" "text" : "sel 10"
} }
}
, {
"box" : {
"id" : "obj-39",
"maxclass" : "lcd",
"numinlets" : 1,
"numoutlets" : 4,
"outlettype" : [ "list", "list", "int", "" ],
"patching_rect" : [ 128.0, 673.0, 1000.0, 1000.0 ]
}
} }
, { , {
"box" : { "box" : {
@ -759,7 +462,7 @@
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 449.0, 596.0, 37.0, 21.0 ], "patching_rect" : [ 449.0, 596.0, 37.0, 21.0 ],
"text" : "val3" "text" : "t"
} }
} }
@ -786,7 +489,7 @@
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 321.0, 596.0, 37.0, 21.0 ], "patching_rect" : [ 321.0, 596.0, 37.0, 21.0 ],
"text" : "val2" "text" : "v"
} }
} }
@ -799,7 +502,7 @@
"numinlets" : 1, "numinlets" : 1,
"numoutlets" : 0, "numoutlets" : 0,
"patching_rect" : [ 193.0, 596.0, 37.0, 21.0 ], "patching_rect" : [ 193.0, 596.0, 37.0, 21.0 ],
"text" : "val1" "text" : "x"
} }
} }
@ -1182,7 +885,7 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-62", 1 ], "destination" : [ "obj-42", 0 ],
"disabled" : 0, "disabled" : 0,
"hidden" : 0, "hidden" : 0,
"source" : [ "obj-22", 0 ] "source" : [ "obj-22", 0 ]
@ -1191,7 +894,7 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-62", 0 ], "destination" : [ "obj-41", 1 ],
"disabled" : 0, "disabled" : 0,
"hidden" : 0, "hidden" : 0,
"source" : [ "obj-23", 0 ] "source" : [ "obj-23", 0 ]
@ -1249,7 +952,16 @@
} }
, { , {
"patchline" : { "patchline" : {
"destination" : [ "obj-62", 2 ], "destination" : [ "obj-40", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-3", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-41", 0 ],
"disabled" : 0, "disabled" : 0,
"hidden" : 0, "hidden" : 0,
"source" : [ "obj-3", 0 ] "source" : [ "obj-3", 0 ]
@ -1371,6 +1083,15 @@
"source" : [ "obj-4", 0 ] "source" : [ "obj-4", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-40", 1 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-42", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {
@ -1456,15 +1177,6 @@
"source" : [ "obj-6", 0 ] "source" : [ "obj-6", 0 ]
} }
}
, {
"patchline" : {
"destination" : [ "obj-39", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-62", 0 ]
}
} }
, { , {
"patchline" : { "patchline" : {

View File

@ -0,0 +1,41 @@
// 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);
}
}

View File

@ -1,48 +0,0 @@
int firstSensor = 0; // first analog sensor
int secondSensor = 0; // second analog sensor
int thirdSensor = 0; // digital sensor
int inByte = 0; // incoming serial byte
void setup()
{
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(2, INPUT); // digital sensor is on digital pin 2
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) {
// get incoming byte:
inByte = Serial.read();
// read first analog input:
firstSensor = analogRead(A0);
// read second analog input:
secondSensor = analogRead(A1);
// read switch, map it to 0 or 255L
thirdSensor = map(digitalRead(2), 0, 1, 0, 255);
// send sensor values:
Serial.print(firstSensor);
Serial.print(",");
Serial.print(secondSensor);
Serial.print(",");
Serial.println(thirdSensor);
}
}
void establishContact() {
while (Serial.available() <= 0) {
Serial.println("0,0,0"); // send an initial string
delay(300);
}
}

View File

@ -1,24 +0,0 @@
//Damp Euler
#define n 10 //number in buffer "window size"
// finite difference with n samples between x(i)
int x[n]; //last n samples of position
int index = 0;
float v; // estimate of velocity
byte c;
void setup(){
Serial.begin(9600);
for(int i=0; i<n; i++) x[i]=analogRead(A0);
}
void loop(){
x[index] = analogRead(A0); //position measured
v = (x[index] - x[index++%n])/n;
if(index > n-1) index = 0;
v = buff[index] - buff[(index-n)%n];
if(c++==0)Serial.println(v);
}

View File

@ -1 +0,0 @@
//DampMass

View File

@ -0,0 +1,26 @@
{\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)\
}

View File

@ -44,7 +44,7 @@ void loop(){
vf += ff*tf; vf += ff*tf;
xf += vf*tf; xf += vf*tf;
if(c++==0) // when c gets to 255 it next == 0 and send data if(c++==0) // when c gets to 255 it's next == 0 and sends data
{ {
Serial.print(x); Serial.print(x);
Serial.print(" "); Serial.print(" ");

View File

@ -0,0 +1,26 @@
#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);
}

View File

@ -0,0 +1,20 @@
//motortest
//.5 sec forward, .5 sec back
#include <Motor.h>
int led = 13;
void setup()
{
MotorA.torque(511); //what is max torque?
pinMode(13, OUTPUT);
}
void loop()
{
MotorA.direction(FORWARD);
delay(500);
MotorA.direction(BACKWARD);
delay(500);
}

View File

@ -0,0 +1,14 @@
//position
//sends A0 (MotorA), A3 (MotorB) to Serial Monitor
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(analogRead(A3));
Serial.print(" ");
Serial.println(analogRead(A0));
}

View File

@ -11,7 +11,7 @@ void setup() {
// We initialise the sound engine by calling Music.init() which outputs a tone // We initialise the sound engine by calling Music.init() which outputs a tone
Music.init(); Music.init();
Music.setSquare(); Music.setSine();
} }