<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Crafting Material Interfaces &#187; Lecture Notes</title>
	<atom:link href="https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;cat=6" rel="self" type="application/rss+xml" />
	<link>https://courses.media.mit.edu/2011fall/mass62</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 08 Aug 2012 20:28:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Arduino Piano code</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=2115</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=2115#comments</comments>
		<pubDate>Tue, 10 Jan 2012 16:48:31 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=2115</guid>
		<description><![CDATA[Code for the capacitive sensing piano shown in this video: Arduino Code #include const int NUMBER_OF_SENSORS = 10; CapSense* sensorDefinitions [NUMBER_OF_SENSORS]; #define ARRAYX 1 #define ARRAYY NUMBER_OF_SENSORS int sensorArray [ARRAYX][ARRAYY]; CapSense note1 = CapSense(3,2); CapSense note2 = CapSense(3,4); CapSense note3 = CapSense(6,5); CapSense note4 = CapSense(6,7); CapSense note5 = CapSense(9,8); CapSense note6 = CapSense(9,10); CapSense [...]]]></description>
			<content:encoded><![CDATA[<p>Code for the capacitive sensing piano shown in this video:</p>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/GarBZhZnFQs" frameborder="0" allowfullscreen></iframe><span id="more-2115"></span></p>
<p><strong>Arduino Code</strong><br />
<code>#include </code><<code>CapSense.h</code>><code></p>
<p>const int NUMBER_OF_SENSORS = 10;<br />
CapSense* sensorDefinitions [NUMBER_OF_SENSORS];</p>
<p>#define ARRAYX 1<br />
#define ARRAYY NUMBER_OF_SENSORS<br />
int sensorArray [ARRAYX][ARRAYY];</p>
<p>CapSense   note1 = CapSense(3,2);<br />
CapSense   note2 = CapSense(3,4);<br />
CapSense   note3 = CapSense(6,5);<br />
CapSense   note4 = CapSense(6,7);<br />
CapSense   note5 = CapSense(9,8);<br />
CapSense   note6 = CapSense(9,10);<br />
CapSense   note7 = CapSense(12,11);<br />
CapSense   note8 = CapSense(A1,A0);<br />
CapSense   note9 = CapSense(A1,A2);<br />
CapSense   note10 = CapSense(A4,A3);      </p>
<p>long start, sensor;<br />
int i, j;</p>
<p>void setup()<br />
{<br />
  sensorDefinitions[0] = </code>&#038;note1<code>;<br />
  sensorDefinitions[1] = </code>&#038;note2<code>;<br />
  sensorDefinitions[2] = </code>&#038;note3<code>;<br />
  sensorDefinitions[3] = </code>&#038;note4<code>;<br />
  sensorDefinitions[4] = </code>&#038;note5<code>;<br />
  sensorDefinitions[5] = </code>&#038;note6<code>;<br />
  sensorDefinitions[6] = </code>&#038;note7<code>;<br />
  sensorDefinitions[7] = </code>&#038;note8<code>;<br />
  sensorDefinitions[8] = </code>&#038;note9<code>;<br />
  sensorDefinitions[9] = </code>&#038;note10<code>;<br />
  Serial.begin(9600);<br />
}</p>
<p>void loop()<br />
{<br />
    start = millis();<br />
    for (i=0;i</code><<code>NUMBER_OF_SENSORS;i++)<br />
    {<br />
      sensor = (*sensorDefinitions[i]).capSense(10);<br />
      if (sensor </code>><code> 100)<br />
        sensorArray[0][i]=1;<br />
      else<br />
        sensorArray[0][i]=0;<br />
    }<br />
    sendArray();<br />
}</p>
<p>void sendArray ()<br />
{<br />
  for (i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    for (j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      Serial.print(sensorArray[i][j]);<br />
      Serial.print('\t');    //tab character<br />
    }<br />
    Serial.print('\n');    //new line c<br />
  }<br />
  Serial.print('!');<br />
}</code></p>
<p><strong>Processing Code</strong><br />
<code><br />
/**<br />
  * Adopted by High-Low Tech from SinePiano by Dan Ellis, dpwe@ee.columbia.edu<br />
  */</p>
<p>import ddf.minim.analysis.*;<br />
import ddf.minim.*;<br />
import ddf.minim.signals.*;<br />
import processing.serial.*;</p>
<p>Minim minim;<br />
AudioOutput out;</p>
<p>Serial myPort;      </p>
<p>int ARRAYX = 1;<br />
int ARRAYY = 10;<br />
int [][] sensorArray = new int[ARRAYX][ARRAYY];<br />
int [][] sensorArrayOld = new int[ARRAYX][ARRAYY];<br />
int [][] noteArray = new int[ARRAYX][ARRAYY];</p>
<p>//note definitions<br />
int C4= 262;<br />
int D4= 294;<br />
int E4= 330;<br />
int F4= 349;<br />
int G4= 392;<br />
int A4= 440;<br />
int B4= 494;<br />
int C5= 523;<br />
int D5= 587;</p>
<p>SineWave mySine;<br />
MyNote newNote;</p>
<p>void setup()<br />
{<br />
  size(512, 200, P3D);</p>
<p>  println(Serial.list());<br />
  myPort = new Serial(this, Serial.list()[0], 9600);<br />
  myPort.bufferUntil('!');</p>
<p>  minim = new Minim(this);<br />
  out = minim.getLineOut(Minim.STEREO);</p>
<p>  noteArray[0][0]=C4;  //z<br />
  noteArray[0][1]=D4;  //x<br />
  noteArray[0][2]=E4;  //c<br />
  noteArray[0][3]=F4;  //v<br />
  noteArray[0][4]=G4;  //b<br />
  noteArray[0][6]=A4;  //n<br />
  noteArray[0][7]=B4;  //m<br />
  noteArray[0][8]=C5;  //,<br />
  noteArray[0][9]=D5;  //.<br />
}</p>
<p>void draw()<br />
{<br />
  background(0);<br />
  stroke(255);<br />
  // draw the output waveforms, so there's something to look at<br />
  for(int i = 0; i </code><<code> out.bufferSize() - 1; i++)<br />
  {<br />
    float x1 = map(i, 0, out.bufferSize(), 0, width);<br />
    float x2 = map(i+1, 0, out.bufferSize(), 0, width);<br />
    line(x1, 50 + out.left.get(i)*50, x2, 50 + out.left.get(i+1)*50);<br />
    line(x1, 150 + out.right.get(i)*50, x2, 150 + out.right.get(i+1)*50);<br />
  }<br />
}</p>
<p>void serialEvent (Serial myPort) {<br />
  String inString = myPort.readStringUntil('!');<br />
  String[] incomingArrayRows = splitTokens(inString, "\n");<br />
  for (int i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    String[] incomingArrayEntries = splitTokens(incomingArrayRows[i], "\t");<br />
    for (int j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      sensorArrayOld[i][j] = sensorArray[i][j];<br />
      sensorArray[i][j]=int(incomingArrayEntries[j]);<br />
    }<br />
  }<br />
  float pitch = 0;<br />
  for (int i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    for (int j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      if (sensorArray[i][j]>0 &#038; (sensorArray[i][j]!=sensorArrayOld[i][j]))<br />
      {<br />
        pitch = noteArray[i][j];<br />
        newNote = new MyNote(pitch, 0.3);<br />
      }<br />
    }<br />
  }<br />
}</p>
<p>void stop()<br />
{<br />
  out.close();<br />
  minim.stop();</p>
<p>  super.stop();<br />
}</p>
<p>class MyNote implements AudioSignal<br />
{<br />
     private float freq;<br />
     private float level;<br />
     private float alph;<br />
     private SineWave sine;</p>
<p>     MyNote(float pitch, float amplitude)<br />
     {<br />
         freq = pitch;<br />
         level = amplitude;<br />
         sine = new SineWave(freq, level, out.sampleRate());<br />
         alph = .9;  // Decay constant for the envelope<br />
         out.addSignal(this);<br />
     }</p>
<p>     void updateLevel()<br />
     {<br />
         // Called once per buffer to decay the amplitude away<br />
         level = level * alph;<br />
         sine.setAmp(level);</p>
<p>         // This also handles stopping this oscillator when its level is very low.<br />
         if (level </code><<code> 0.01) {<br />
             out.removeSignal(this);<br />
         }<br />
         // this will lead to destruction of the object, since the only active<br />
         // reference to it is from the LineOut<br />
     }</p>
<p>     void generate(float [] samp)<br />
     {<br />
         // generate the next buffer's worth of sinusoid<br />
         sine.generate(samp);<br />
         // decay the amplitude a little bit more<br />
         updateLevel();<br />
     }</p>
<p>    // AudioSignal requires both mono and stereo generate functions<br />
    void generate(float [] sampL, float [] sampR)<br />
    {<br />
        sine.generate(sampL, sampR);<br />
        updateLevel();<br />
    }</p>
<p>}</code></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=2115</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides from Guest Lecture on Jamming</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=1682</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=1682#comments</comments>
		<pubDate>Wed, 30 Nov 2011 13:18:00 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=1682</guid>
		<description><![CDATA[Nadia Cheng and Steven Keating&#8217;s presentation on jammed granular systems]]></description>
			<content:encoded><![CDATA[<p><a href="http://hlt.media.mit.edu/cmi_readings/cheng_jamming.pdf">Nadia Cheng and Steven Keating&#8217;s presentation on jammed granular systems</a></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=1682</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code to transmit and receive an array of values</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=882</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=882#comments</comments>
		<pubDate>Sun, 30 Oct 2011 20:01:56 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=882</guid>
		<description><![CDATA[Arduino code //define the size of array #define ARRAYX 2 #define ARRAYY 2 //create the array int sensorArray [ARRAYX][ARRAYY]; int i,j,x; void setup() { // initialize the serial communication: Serial.begin(9600); } void loop() { if (x>255) { x=0; } for (i=0;i]]></description>
			<content:encoded><![CDATA[<p><strong>Arduino code</strong><br />
<span id="more-882"></span><br />
<code><br />
//define the size of array<br />
#define ARRAYX 2<br />
#define ARRAYY 2<br />
//create the array<br />
int sensorArray [ARRAYX][ARRAYY];<br />
int i,j,x;</p>
<p>void setup()<br />
{<br />
  // initialize the serial communication:<br />
  Serial.begin(9600);<br />
}</p>
<p>void loop() {<br />
  if (x>255)<br />
  {<br />
    x=0;<br />
  }<br />
  for (i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    for (j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      sensorArray[i][j]=x;<br />
      x++;<br />
    }<br />
  }<br />
  sendArray();<br />
  delay(500);<br />
}</p>
<p>void sendArray ()<br />
{<br />
  for (i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    for (j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      Serial.print(sensorArray[i][j]);<br />
      Serial.print('\t');    //tab character<br />
    }<br />
    Serial.print('\n');    //new line c<br />
  }<br />
  Serial.print('!');<br />
}<br />
</code></p>
<p><strong>Processing code</strong><br />
import processing.serial.*;<br />
Serial myPort;        // The serial port</p>
<p>//variables for collecting and storing information<br />
int ARRAYX = 2;<br />
int ARRAYY = 2;<br />
int [][] sensorArray = new int[ARRAYX][ARRAYY];</p>
<p>//variables for drawing information on the screen<br />
int spacing = 100;<br />
PFont font;</p>
<p>void setup () {<br />
  //set the window size:<br />
  size(400, 400);<br />
  //initialize the font variables<br />
  font = loadFont("SansSerif-20.vlw");<br />
  textFont(font); </p>
<p>  // list all the available serial ports<br />
  println(Serial.list());<br />
  // open the appropriate port<br />
  myPort = new Serial(this, Serial.list()[0], 9600);<br />
  // don't generate a serialEvent() until you get an exclamation mark character<br />
  myPort.bufferUntil('!');<br />
  // set inital background:<br />
  background(0);<br />
}</p>
<p>void draw () {<br />
  background(40,90,0);<br />
  //loop through the array<br />
  for (int i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    for (int j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      //calculate the position for each entry so that print out is approximately centered onscreen<br />
      int xPosition = width/2-((ARRAYX-1)*spacing/2)+j*spacing;<br />
      int yPosition = height/2-((ARRAYY-1)*spacing/2)+i*spacing;<br />
      //draw the array entries on the screen<br />
      text(sensorArray[i][j], xPosition, yPosition);<br />
    }<br />
  }<br />
}</p>
<p>void serialEvent (Serial myPort) {<br />
  //store a batch of data into variable "inString"<br />
  //batches are separated by exclamation mark characters<br />
  String inString = myPort.readStringUntil('!');<br />
  //split the data into rows (rows separated by new line characters)<br />
  String[] incomingArrayRows = splitTokens(inString, "\n");<br />
  //loop through all of the rows<br />
  for (int i=0;i</code><<code>ARRAYX;i++)<br />
  {<br />
    //split each row into entries (entries separated by tab characters)<br />
    String[] incomingArrayEntries = splitTokens(incomingArrayRows[i], "\t");<br />
    //loop through all of these entries<br />
    for (int j=0;j</code><<code>ARRAYY;j++)<br />
    {<br />
      //store entries in the "sensorArray" variable<br />
      sensorArray[i][j]=int(incomingArrayEntries[j]);<br />
      //print the entries to the terminal, separated by tab characters<br />
      print(sensorArray[i][j]);<br />
      print('\t');<br />
    }<br />
    //print a new line after each row<br />
    println();<br />
  }<br />
  //print a new line after each batch of data<br />
  println();<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=882</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ModKit</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=874</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=874#comments</comments>
		<pubDate>Thu, 27 Oct 2011 22:17:53 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=874</guid>
		<description><![CDATA[ModKit is a graphical, blocks-based programming language for Arduinos developed by a team led by Ed Baafi. Download a version for Macs here and a version for PCs here. Installation instructions, Mac OS Unzip and open the ModKitMac folder. You should see a single icon that looks like this: Double click on the Modkit.app file [...]]]></description>
			<content:encoded><![CDATA[<p><a ref="http://modk.it">ModKit </a> is a graphical, blocks-based programming language for Arduinos developed by a team led by Ed Baafi.  Download a version for Macs <a href="http://hlt.media.mit.edu/ModKitMac.zip">here</a> and a version for PCs <a href="http://hlt.media.mit.edu/ModkitPC.zip">here</a>.</p>
<p><strong>Installation instructions, Mac OS</strong><br />
Unzip and open the ModKitMac folder.  You should see a single icon that looks like this:<br />
<img src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/icon.png" alt="" title="icon" width="169" height="136" class="alignnone size-full wp-image-1563" /><br />
Double click on the Modkit.app file to open the application.  The opening screen of the application should look like this:</p>
<p><img src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/openingScreen.jpg" alt="" title="openingScreen" width="652" height="461" class="alignnone size-full wp-image-1565" /></p>
<p>If it does, you&#8217;re all set!</p>
<p><strong>Installation instructions, PC</strong></p>
<p>Decompress and open the ModKitPC folder.  You will see a long list of items.  Double click on the file titled &#8220;ModKit&#8221;.  The opening screen of the application should look like this:</p>
<p><img src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/openingScreen.jpg" alt="" title="openingScreen" width="652" height="461" class="alignnone size-full wp-image-1565" /></p>
<p>If it does, you&#8217;re all set!</p>
<p>You can find more information about ModKit <a href="http://modk.it">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=874</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graph + Sound code</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=779</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=779#comments</comments>
		<pubDate>Tue, 25 Oct 2011 17:18:33 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=779</guid>
		<description><![CDATA[Libraries you&#8217;ll need: Sonia JSyn Arduino code: int sensorPin = A2; int sensorValue; void setup() { Serial.begin(9600); pinMode(sensorPin, INPUT); digitalWrite(sensorPin,HIGH); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); delay(10); } Processing code: Download code + example sound file import processing.serial.*; import pitaru.sonia_v2_9.*; Serial myPort; // The serial port int xPos = 1; // horizontal position [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Libraries you&#8217;ll need:</strong><span id="more-779"></span><br />
<a href="http://sonia.pitaru.com/">Sonia</a><br />
<a href="http://www.softsynth.com/jsyn/developers/download.php">JSyn</a></p>
<p><strong>Arduino code:</strong><br />
<code><br />
int sensorPin = A2;<br />
int sensorValue;</p>
<p>void setup()<br />
{<br />
  Serial.begin(9600);<br />
  pinMode(sensorPin, INPUT);<br />
  digitalWrite(sensorPin,HIGH);<br />
}</p>
<p>void loop()<br />
{<br />
  sensorValue = analogRead(sensorPin);<br />
  Serial.println(sensorValue);<br />
  delay(10);<br />
}</code></p>
<p><strong>Processing code:</strong><br />
<a href='https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/Graph_Sound.zip'>Download code + example sound file</a></p>
<p><code> import processing.serial.*;<br />
 import pitaru.sonia_v2_9.*;</p>
<p> Serial myPort;        // The serial port<br />
 int xPos = 1;         // horizontal position of the graph<br />
 Sample tone;</p>
<p>void setup () {<br />
 // set the window size:<br />
 size(400, 300);        </p>
<p> // List all the available serial ports<br />
 println(Serial.list());<br />
 // I know that the first port in the serial list on my mac<br />
 // is always my  Arduino, so I open Serial.list()[0].<br />
 // Open whatever port is the one you're using.<br />
 myPort = new Serial(this, Serial.list()[0], 9600);<br />
 // don't generate a serialEvent() unless you get a newline character:<br />
 myPort.bufferUntil('\n');<br />
 // set inital background:<br />
 background(0);</p>
<p>   Sonia.start(this); </p>
<p>  // Create a new sample object.<br />
  tone = new Sample( "tone.wav" );</p>
<p>  // Loop the sound forever<br />
  // (well, at least until stop() is called)<br />
  tone.repeat();<br />
  tone.setVolume(1);<br />
  smooth();<br />
 }</p>
<p> void draw () {<br />
 // everything happens in the serialEvent()<br />
 }</p>
<p> void serialEvent (Serial myPort) {<br />
 // get the ASCII string:<br />
 String inString = myPort.readStringUntil('\n');</p>
<p> if (inString != null) {<br />
 // trim off any whitespace:<br />
 inString = trim(inString);<br />
 // convert to an int and map to the screen height:<br />
 float inByte = float(inString);<br />
 inByte = map(inByte, 0, 1023, 0, height);</p>
<p> // draw the line:<br />
 stroke(127,34,255);<br />
 line(xPos, height, xPos, height - inByte);</p>
<p>// change the playback speed using the incoming data<br />
  float ratio = (float) inByte/height;<br />
  //println(ratio);<br />
  tone.setRate(ratio*88200, 0);<br />
  //tone.setVolume(ratio);</p>
<p> // at the edge of the screen, go back to the beginning:<br />
 if (xPos >= width) {<br />
 xPos = 0;<br />
 background(0);<br />
 }<br />
 else {<br />
 // increment the horizontal position:<br />
 xPos++;<br />
 }<br />
 }</p>
<p> }</p>
<p> // Pressing the mouse stops and starts the sound<br />
void mousePressed() {<br />
  if (tone.isPlaying()) {<br />
    tone.stop(); //   The sound can be stopped with the function stop().<br />
  } else {<br />
    tone.repeat();<br />
  }<br />
}</p>
<p>// Close the sound engine<br />
public void stop() {<br />
  Sonia.stop();<br />
  super.stop();<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=779</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing Code to Graph Arduino Sensor Data</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=724</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=724#comments</comments>
		<pubDate>Tue, 18 Oct 2011 17:02:39 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=724</guid>
		<description><![CDATA[import processing.serial.*; Serial myPort; // The serial port int xPos = 1; // horizontal position of the graph void setup () { // set the window size: size(400, 300); // List all the available serial ports println(Serial.list()); // I know that the first port in the serial list on my mac // is always my [...]]]></description>
			<content:encoded><![CDATA[<p><span id="more-724"></span><code> import processing.serial.*;</p>
<p> Serial myPort;        // The serial port<br />
 int xPos = 1;         // horizontal position of the graph</p>
<p> void setup () {<br />
 // set the window size:<br />
 size(400, 300);        </p>
<p> // List all the available serial ports<br />
 println(Serial.list());<br />
 // I know that the first port in the serial list on my mac<br />
 // is always my  Arduino, so I open Serial.list()[0].<br />
 // Open whatever port is the one you're using.<br />
 myPort = new Serial(this, Serial.list()[0], 9600);<br />
 // don't generate a serialEvent() unless you get a newline character:<br />
 myPort.bufferUntil('\n');<br />
 // set inital background:<br />
 background(0);<br />
 }<br />
 void draw () {<br />
 // everything happens in the serialEvent()<br />
 }</p>
<p> void serialEvent (Serial myPort) {<br />
 // get the ASCII string:<br />
 String inString = myPort.readStringUntil('\n');</p>
<p> if (inString != null) {<br />
 // trim off any whitespace:<br />
 inString = trim(inString);<br />
 // convert to an int and map to the screen height:<br />
 float inByte = float(inString);<br />
 inByte = map(inByte, 0, 1023, 0, height);</p>
<p> // draw the line:<br />
 stroke(127,34,255);<br />
 line(xPos, height, xPos, height - inByte);</p>
<p> // at the edge of the screen, go back to the beginning:<br />
 if (xPos >= width) {<br />
 xPos = 0;<br />
 background(0);<br />
 }<br />
 else {<br />
 // increment the horizontal position:<br />
 xPos++;<br />
 }<br />
 }<br />
 }</code></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=724</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sensors: Slides and Helpful Material</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=712</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=712#comments</comments>
		<pubDate>Tue, 18 Oct 2011 16:57:18 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>
		<category><![CDATA[Sensors]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=712</guid>
		<description><![CDATA[Leah&#8217;s slides NanWei&#8217;s slides Arduino Processing Switch Example from Class Resistive Sensor Example from Class Arduino code: int sensorPin = A2; int sensorValue; void setup() { Serial.begin(9600); pinMode(A2, INPUT); digitalWrite(A2,HIGH); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); delay(10); } Processing Code Hannah Perner-Wilson&#8217;s library of textile sensors Capacitive Sensor Example from Class Download and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://courses.media.mit.edu/2011fall/mass62/lectureNotes/craftingMaterialInterfacesSensors.pdf">Leah&#8217;s slides</a><br />
<a href="http://simonetti.media.mit.edu/MASS62/sensorIntroOct18_fin.ppt">NanWei&#8217;s slides</a><br />
<span id="more-712"></span></p>
<p><a href="http://www.arduino.cc">Arduino</a><br />
<a href="http://processing.org/">Processing</a></p>
<p><strong>Switch Example from Class</strong></p>
<ul>
<img class="alignnone size-full wp-image-713" title="switchDiagram" src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/switchDiagram.jpg" alt="" width="400" /></ul>
<p><strong>Resistive Sensor Example from Class</strong></p>
<ul>
<a href="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/resistiveSensorDiagram.jpg"><img class="alignnone size-full wp-image-714" title="resistiveSensorDiagram" src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/resistiveSensorDiagram.jpg" alt="" width="400" /></a></p>
<p><strong>Arduino code:</strong><br />
int sensorPin = A2;<br />
int sensorValue;</p>
<p>void setup()<br />
{<br />
Serial.begin(9600);<br />
pinMode(A2, INPUT);<br />
digitalWrite(A2,HIGH);<br />
}</p>
<p>void loop()<br />
{<br />
sensorValue = analogRead(sensorPin);<br />
Serial.println(sensorValue);<br />
delay(10);<br />
}</p>
<p><a href="https://courses.media.mit.edu/2011fall/mass62/?p=724">Processing Code</a></p>
<p><a href="http://www.kobakant.at/DIY/?cat=26">Hannah Perner-Wilson&#8217;s library of textile sensors</a></ul>
<p><strong>Capacitive Sensor Example from Class</strong></p>
<ul>
<a href="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/capSensingDiagram.jpg"><img class="alignnone size-full wp-image-715" title="capSensingDiagram" src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/10/capSensingDiagram.jpg" alt="" width="400" /></a></p>
<p>Download and install <a href="http://www.arduino.cc/playground/Main/CapSense">Paul Badger&#8217;s Capacitive Sensing Library</a> and put it in the libraries folder in your Arduino sketchbook.</p>
<p><strong>Arduino code:</strong><br />
#include &lt;CapSense.h&gt;</p>
<p>CapSense   mySensor = CapSense(11,10);        // 10M resistor between pins 11 &amp; 10, pin 10 is sensor pin<br />
long start;<br />
long sensorValue;</p>
<p>void setup()<br />
{<br />
Serial.begin(9600);<br />
}</p>
<p>void loop()<br />
{<br />
start = millis();<br />
sensorValue =  mySensor.capSense(30);</p>
<p>Serial.println(sensorValue);                  // print sensor output<br />
delay(10);                             // arbitrary delay to limit data to serial port<br />
}</p>
<p><a href="https://courses.media.mit.edu/2011fall/mass62/?p=724">Processing Code (same as for resistive sensing)</a></ul>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=712</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Conductor Assignments Helpful Links and Information</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=285</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=285#comments</comments>
		<pubDate>Tue, 27 Sep 2011 18:38:07 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=285</guid>
		<description><![CDATA[A diagram of the electronic components Dave introduced, click for a larger view: Hannah Perner-Wilson&#8217;s tutorial on electroplating]]></description>
			<content:encoded><![CDATA[<p>A diagram of the electronic components Dave introduced, click for a larger view:<br />
<a href="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/09/electronicComponentsDiagramDave.png"><img src="https://courses.media.mit.edu/2011fall/mass62/wp-content/uploads/2011/09/electronicComponentsDiagramDave.png" alt="" title="electronicComponentsDiagram" width="600" /></a></p>
<p><span id="more-285"></span></p>
<p><a href="http://web.media.mit.edu/~plusea/?p=554">Hannah Perner-Wilson&#8217;s tutorial on electroplating</a><br />
<img src="http://farm6.static.flickr.com/5298/5479835949_33337a97d3_m.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=285</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides: Conductors</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=117</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=117#comments</comments>
		<pubDate>Wed, 21 Sep 2011 01:45:46 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=117</guid>
		<description><![CDATA[Download here]]></description>
			<content:encoded><![CDATA[<p><a href="https://courses.media.mit.edu/2011fall/mass62/lectureNotes/craftingMaterialInterfacesConductors.pdf">Download here</a></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=117</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides: Introduction</title>
		<link>https://courses.media.mit.edu/2011fall/mass62/?p=51</link>
		<comments>https://courses.media.mit.edu/2011fall/mass62/?p=51#comments</comments>
		<pubDate>Wed, 14 Sep 2011 01:05:13 +0000</pubDate>
		<dc:creator>leah</dc:creator>
				<category><![CDATA[Lecture Notes]]></category>

		<guid isPermaLink="false">https://courses.media.mit.edu/2011fall/mass62/?p=51</guid>
		<description><![CDATA[Download here]]></description>
			<content:encoded><![CDATA[<p><a href="https://courses.media.mit.edu/2011fall/mass62/lectureNotes/craftingMaterialInterfacesIntro.pdf">Download here</a></p>
]]></content:encoded>
			<wfw:commentRss>https://courses.media.mit.edu/2011fall/mass62/?feed=rss2&#038;p=51</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
