

<?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>cwwang.com &#187; Processing</title>
	<atom:link href="http://cwwang.com/category/software/processing/feed/" rel="self" type="application/rss+xml" />
	<link>http://cwwang.com</link>
	<description>Che-Wei Wang</description>
	<lastBuildDate>Sat, 06 Nov 2010 15:58:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Time 00-XX</title>
		<link>http://cwwang.com/2010/01/06/time-00-xx/</link>
		<comments>http://cwwang.com/2010/01/06/time-00-xx/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 15:36:13 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/?p=1395</guid>
		<description><![CDATA[Some clocks are functional, some are not very practical. This is an ongoing series of clock experiments. Each clock is written in Processing and presented here using processing.js. link: [time 00]]]></description>
			<content:encoded><![CDATA[<p><img src="http://cwwang.com/wordpress/wp-content/uploads/time.png" alt="" title="time" width="600" height="400" class="alignnone size-full wp-image-1393" /></p>
<p>Some clocks are functional, some are not very practical.  This is an ongoing series of clock experiments.</p>
<p>Each clock is written in Processing and presented here using processing.js.</p>
<p>link: [<a href="http://cwandt.com/time/00.php">time 00</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2010/01/06/time-00-xx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSR Reader</title>
		<link>http://cwwang.com/2008/04/13/gsr-reader/</link>
		<comments>http://cwwang.com/2008/04/13/gsr-reader/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 06:31:16 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/?p=731</guid>
		<description><![CDATA[Galvanic skin response readings are simply the measurement of electrical resistance through the body. Two leads are attached to two fingertips. One lead sends current while the other measures the difference. This setup measures GSR every 50 milliseconds. Each reading is graphed, while peaks are highlighted and an average is calculated to smooth out the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/img_09491.jpg" rel="lightbox[731]" title="img_09491" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/img_09491.thumbnail.jpg" alt="" width="128" height="96" class="attachment wp-att-733 " /></a> <a href="http://cwwang.com/wordpress/wp-content/uploads/img_09451.jpg" rel="lightbox[731]" title="img_09451" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/img_09451.thumbnail.jpg" alt="" width="128" height="96" class="attachment wp-att-732 " /></a></p>
<p>Galvanic skin response readings are simply the measurement of electrical resistance through the body.  Two leads are attached to two fingertips.  One lead sends current while the other measures the difference.  This setup measures GSR every 50 milliseconds.  Each reading is graphed, while peaks are highlighted and an average is calculated to smooth out the values.  A baseline reading is taken for 10 seconds if the readings go flat (fingers removed from leads).</p>
<p><span id="more-731"></span></p>
<p><object width="480" height="362"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=892300&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=892300&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="480" height="362"></embed></object><br /><a href="http://vimeo.com/892300?pg=embed&amp;sec=892300">GSR Reader</a> from <a href="http://vimeo.com/user271044?pg=embed&amp;sec=892300">che-wei wang</a> on <a href="http://vimeo.com?pg=embed&amp;sec=892300">Vimeo</a>.</p>
<p><object width="480" height="240"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=892210&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=892210&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="480" height="240"></embed></object><br /><a href="http://vimeo.com/892210?pg=embed&amp;sec=892210">GSR readings in processing</a> from <a href="http://vimeo.com/user271044?pg=embed&amp;sec=892210">che-wei wang</a> on <a href="http://vimeo.com?pg=embed&amp;sec=892210">Vimeo</a>.</p>
<p>Arduino Code:</p>
<pre><code>void setup(){
  Serial.begin(9600);
}

void loop(){
  int a=analogRead(0);
  if (Serial.available() &gt; 0) {

    byte inbyte=Serial.read();
    if(inbyte=='a'){
      Serial.print(a,BYTE);

    }
  }
}</code></pre>
<p>Processing Code:</p>
<pre><code>import processing.serial.*;
Serial myPort;  

int hPosition = 1;     // the horizontal position on the graph
float currentReading;
float lastReading;
int count=0;
int zeroLinePos=0;

float gsrAverage,prevGsrAverage;
float baseLine=0;
long lastFlatLine=0;
color graphColor=color(255,255,255);
int baselineTimer=10000;
int gsrValue;
int gsrZeroCount=0;
float gsrRange=0;
int downhillCount=0;
int uphillCount=0;
boolean downhill;
boolean peaked=false;
float peak, valley;

void setup () {
  size(900, 450);
  // List all the available serial ports
  //println(Serial.list());

  myPort = new Serial(this, Serial.list()[0], 9600);
  currentReading=0;
  lastReading=0;
  gsrAverage=0;
  background(0);

  smooth();
}

void draw () {
  //best delay setting for gsr readings
  delay(50);
  //image(myMovie, 0, 0);

  if (gsrValue&lt;15 &amp;&amp;gsrValue&gt;-15){
    if( gsrZeroCount&gt;10){
      currentReading=0;//flatline
      gsrAverage=0;
      baseLine=0;
      lastFlatLine=millis();
      gsrZeroCount=0;
      // println("reset");

    }
    gsrZeroCount++;
  }
  else{
    currentReading=gsrValue-baseLine;
    gsrZeroCount=0;
  }

  if(millis()-lastFlatLine&gt;baselineTimer){
    baseLine=gsrAverage;
  }

  //graph colors
  if(gsrAverage&gt;0 &amp;&amp; gsrAverage&lt;height/2.0*.25) graphColor=color(255,255,255);
  else if(gsrAverage&gt;height/2.0*.25 &amp;&amp; gsrAverage&lt;height/2.0*.5) graphColor=color(255,250,100);
  else if(gsrAverage&gt;height/2.0*.5 &amp;&amp; gsrAverage&lt;height/2.0*.75) graphColor=color(255,250,0);
  else if(gsrAverage&gt;height/2.0*.75) graphColor=color(255,100,0);

  gsrRange=peak-valley;

  // at the edge of the screen, go back to the beginning:
  if (hPosition &gt;= width) {
    hPosition = 0;

    //cover last drawing
    fill(0,200);
    noStroke();
    rect(0,0,width,height);
  }
  else {
    hPosition+=1;
  }

  gsrAverage=smooth(currentReading,.97,gsrAverage);

  //draw stuff

  //spike
  noStroke();
  if(gsrRange&gt;200){
    fill(255);
    ellipse(10,10,20,20);
  }
  else{
    fill(0);
    ellipse(10,10,20,20);
  }

  //graph
  strokeWeight(.5);
  stroke(graphColor);
  line(hPosition-1, height/2.0-lastReading, hPosition, height/2.0-currentReading);
  stroke(255,0,100);
  line(hPosition-1,height/2.0-prevGsrAverage,hPosition,height/2.0-gsrAverage);

  //draw peaks
  int thres=7;

  noFill();
  stroke(255,0,0);
  strokeWeight(2);

  if (currentReading-thres&gt;lastReading&amp;&amp; peaked==true){
    downhill=false;
    //println(downhillCount);
    uphillCount++;
    downhillCount=0;
    point(hPosition-1, height/2.0-lastReading);
    valley=lastReading;
    peaked=false;

  }
  if(currentReading+thres&lt;lastReading &amp;&amp; peaked==false){
    //println(uphillCount);
    downhill=true;
    uphillCount=0;
    downhillCount++;
    point(hPosition-1, height/2.0-lastReading);
    peak=lastReading;
    peaked=true;
  }

  prevGsrAverage=gsrAverage;
  lastReading=currentReading;
  //send 'a' for more bytes
  myPort.write('a');
}

void serialEvent (Serial myPort) {
  int inByte=myPort.read();
  //0-255
  gsrValue=inByte;
}

void keyPressed(){
  if (keyCode==DOWN)zeroLinePos+=3;
  if (keyCode==UP)zeroLinePos-=3;

  strokeWeight(1);
  stroke(255,0,0);
  line(0,zeroLinePos,2,zeroLinePos);
}

int smooth(float data, float filterVal, float smoothedVal){
  if (filterVal &gt; 1){      // check to make sure param's are within range
    filterVal = .99;
  }
  else if (filterVal &lt;= 0){
    filterVal = 0;
  }
  smoothedVal = (data * (1 - filterVal)) + (smoothedVal  *  filterVal);
  return (int)smoothedVal;
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/04/13/gsr-reader/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>CSV import for Processing</title>
		<link>http://cwwang.com/2008/02/23/csv-import-for-processing/</link>
		<comments>http://cwwang.com/2008/02/23/csv-import-for-processing/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 00:29:00 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/23/csv-import-for-processing/</guid>
		<description><![CDATA[Here&#8217;s a some code for Processing to import csv files and parse the entries into a 2D array. //for importing csv files into a 2d array //by che-wei wang String lines[] = loadStrings("list.csv"); String [][] csv; int csvWidth=0; //calculate max width of csv file for (int i=0; i < lines.length; i++) { String [] chars=split(lines[i],','); [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a some code for Processing to import csv files and parse the entries into a 2D array.<br />
<span id="more-633"></span></p>
<pre>//for importing csv files into a 2d array
//by che-wei wang

String lines[] = loadStrings("list.csv");
String [][] csv;
int csvWidth=0;

//calculate max width of csv file
for (int i=0; i < lines.length; i++) {
  String [] chars=split(lines[i],',');
  if (chars.length>csvWidth){
    csvWidth=chars.length;
  }
}

//create csv array based on # of rows and columns in csv file
csv = new String [lines.length][csvWidth];

//parse values into 2d array
for (int i=0; i < lines.length; i++) {
  String [] temp = new String [lines.length];
  temp= split(lines[i], ',');
  for (int j=0; j < temp.length; j++){
   csv[i][j]=temp[j];
  }
}

//test
println(csv[2][2]);</pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/23/csv-import-for-processing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Infinite Mouse Tracking</title>
		<link>http://cwwang.com/2008/02/20/infinite-mouse-tracking/</link>
		<comments>http://cwwang.com/2008/02/20/infinite-mouse-tracking/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 17:25:31 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/20/infinite-mouse-tracking/</guid>
		<description><![CDATA[I wanted to use the mouse as a simple surface optical encoder to get infinite panning motion. The problem with reading mouse coordinates on the screen, is that once the mouse reaches the edge of the screen, it stops counting. So a simple solution is to reposition the mouse (using the robot class) every few [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to use the mouse as a simple surface optical encoder to get infinite panning motion.  The problem with reading mouse coordinates on the screen, is that once the mouse reaches the edge of the screen, it stops counting.  So a simple solution is to reposition the mouse (using the robot class) every few frames and calculate the change in mouse positions.</p>
<pre><code>//InfiniteMouseTracking
//by Che-Wei Wang
//2.20.2008

float mapPositionX;
float mapPositionY;
long count=0;
int moveX=0;
int moveY=0;

void setup()
{
  size(screen.width,screen.height,P3D);
  mapPositionX=width/2;
  mapPositionY=height/2;

  //noCursor();

  //set the mouse postion once before the program begins
  try {
    Robot robot = new Robot();
    robot.mouseMove(width/2, height/2);
  }
  catch (AWTException e) {
  }

}

void draw()
{
  background(0);

  //reset the cursor Position every few frames
  if(count%4==0){
    try {
      Robot robot = new Robot();
      robot.mouseMove(width/2, height/2);
    }
    catch (AWTException e) {
    }
    moveX=mouseX-pmouseX;
    moveY=mouseY-pmouseY;
  }

  count++;

  //new position= old position + movement * decay
  mapPositionX=mapPositionX+moveX*.8;
  mapPositionY=mapPositionY+moveY*.8;

  stroke(255);
  line(width/2,height/2,mapPositionX,mapPositionY);
  ellipse(mapPositionX,mapPositionY,100,100);

}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/20/infinite-mouse-tracking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Surface Output Example</title>
		<link>http://cwwang.com/2008/02/17/surface-output-example/</link>
		<comments>http://cwwang.com/2008/02/17/surface-output-example/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 21:41:22 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/17/surface-output-example/</guid>
		<description><![CDATA[.dxf and 3D point position .txt file output and sunflow rendering example]]></description>
			<content:encoded><![CDATA[<p>.dxf and 3D point position .txt file output and sunflow rendering example</p>
<p><iframe src="http://cwwang.com/wordpress/wp-content/processing/surfOut/" frameborder="0" height="500" width="563"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/17/surface-output-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ESS Jiggling Students Example</title>
		<link>http://cwwang.com/2008/02/09/ess-jiggling-students-example/</link>
		<comments>http://cwwang.com/2008/02/09/ess-jiggling-students-example/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 22:54:01 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/09/ess-jiggling-students-example/</guid>
		<description><![CDATA[An example sketch using the Ess library to make a class of objects jiggle in response to the microphone input]]></description>
			<content:encoded><![CDATA[<p>An example sketch using the <a href="http://www.tree-axis.com/Ess/index.html">Ess</a> library to make a class of objects jiggle in response to the microphone input</p>
<p><iframe src="http://cwwang.com/wordpress/wp-content/processing/jiggle/" frameborder="0" height="350" width="563"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/09/ess-jiggling-students-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sensors Galore</title>
		<link>http://cwwang.com/2008/02/01/sensors-galore/</link>
		<comments>http://cwwang.com/2008/02/01/sensors-galore/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 21:08:54 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/01/sensors-galore/</guid>
		<description><![CDATA[An example of blobDetection, Ess, sms, and ocd all rolled into one sketch. Click and drag on the screen to move the HUD sliders around. (nothing is going to load here. copy the code to your processing sketch to run it) Processing libraries: Tree-Axis » krister » Ess Processing Sudden Motion Sensor Library at daniel [...]]]></description>
			<content:encoded><![CDATA[<p>An example of blobDetection, Ess, sms, and ocd all rolled into one sketch. Click and drag on the screen to move the HUD sliders around.  (nothing is going to load here. copy the code to your processing sketch to run it)</p>
<p><span id="more-585"></span></p>
<p><iframe src="http://cwwang.com/wordpress/wp-content/processing/Sensors_Galore/" frameborder="0" height="300" width="563"></iframe></p>
<p>Processing libraries:<br />
<a href="http://www.cise.ufl.edu/%7Ekdamkjer/processing/libraries/ocd/">Tree-Axis » krister » Ess<br />
Processing Sudden Motion Sensor Library at daniel shiffman<br />
BlobDetection library / v3ga<br />
Myron (WebCamXtra) &#8211; Computer Vision &amp; Well Connected Motion Tracking<br />
Obsessive Camera Direction</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/01/sensors-galore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spot Example</title>
		<link>http://cwwang.com/2008/02/01/spot-example/</link>
		<comments>http://cwwang.com/2008/02/01/spot-example/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 19:43:17 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Teaching]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/02/01/spot-example/</guid>
		<description><![CDATA[A basic setup of a class structure The class Spot has 4 inputs (x,y,diamter, color) and 3 functions drawLines(float x1, float y1, float x2, float y2) , update(), and display(). Spot_Example : Built with Processing]]></description>
			<content:encoded><![CDATA[<p>A basic setup of a class structure</p>
<p>The class Spot has 4 inputs (x,y,diamter, color) and 3 functions<br />
drawLines(float x1, float y1, float x2, float y2) , update(), and display().</p>
<p><a href="http://cwwang.com/wordpress/wp-content/processing/Spot_Example/">Spot_Example : Built with Processing</a></p>
<p><iframe src="http://cwwang.com/wordpress/wp-content/processing/Spot_Example/" frameborder="0" height="300" width="563"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/02/01/spot-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HND: Live GPS and Vibe</title>
		<link>http://cwwang.com/2007/10/18/hnd-live-gps-and-vibe/</link>
		<comments>http://cwwang.com/2007/10/18/hnd-live-gps-and-vibe/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 04:29:14 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/10/18/hnd-live-gps-and-vibe/</guid>
		<description><![CDATA[Slightly updated code for incorporating vibe control via serial. [Processing: HND LiveGPS, Weight and Vibe] Arduino Code: int minPulse = 500; // Minimum servo position int maxPulse = 2500; // Maximum servo position int pulse,pulseR; long lastPulse = 0; // the time in milliseconds of the last pulse int refreshTime = 20; // the time [...]]]></description>
			<content:encoded><![CDATA[<p>Slightly updated code for incorporating vibe control via serial.</p>
<p><span id="more-348"></span><br />
[<a href="http://cwwang.com/wordpress/wp-content/uploads/hapticDeviceControl04LivegpsVibe/applet/">Processing: HND LiveGPS, Weight and Vibe</a>]<br />
Arduino Code:</p>
<pre><code>int minPulse = 500;   // Minimum servo position
int maxPulse = 2500;  // Maximum servo position
int pulse,pulseR;

long lastPulse = 0;    // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses

int distance=0;
int angle=0;

//vibe
int vibeMotor0 = 0;
int vibeMotor1 = 0;
int vibeMotor2 = 0;
int vibeMotor3 = 0;
int vibe;

void setup() {
  pinMode(11, OUTPUT);  // Set servo pin as an output pin
  pinMode(10, OUTPUT); 

  //vibe
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);

  pulse = minPulse;           // Set the motor position value to the minimum
  pulseR = minPulse;
  Serial.begin(9600);
  Serial.print(65);
}

void loop() {

  if (Serial.available()&amp;gt;=4) {
    int serialIn=Serial.read();
    if(serialIn==255){
      distance=Serial.read();
      angle=Serial.read();
      vibe=Serial.read();
    }

    //if(distance&amp;lt;20){
    if (vibe == 0)  {
      digitalWrite(3, HIGH);
      //delay(100);
      //digitalWrite(3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(9, LOW);

    }

    if (vibe == 1)  {
      digitalWrite (3, LOW);
      digitalWrite(5, HIGH);
      //delay(100);
      //digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(9, LOW);

    }

    if (vibe == 2)  {
      digitalWrite (3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, HIGH);
      //delay(100);
     // digitalWrite(6, LOW);
      digitalWrite(9, LOW);

    }

    if (vibe == 3)  {
      digitalWrite (3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(9, HIGH);
      //delay(100);
      //digitalWrite(9, LOW);

    }
        if (vibe == 4)  {
      digitalWrite (3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(9, LOW);
      //delay(100);
      //digitalWrite(9, LOW);

    }
    //}
  }

  pulse = distance*4*19/10+minPulse;    // convert the analog value
  pulseR = angle*4*19/10+minPulse;    // convert the analog value

    // pulse the servo again if rhe refresh time (20 ms) have passed:
  if (millis() - lastPulse &amp;gt;= refreshTime) {
    digitalWrite(11, HIGH);   // Turn the motor on
    delayMicroseconds(pulseR);       // Length of the pulse sets the motor position
    digitalWrite(11, LOW);    // Turn the motor off
    digitalWrite(10, HIGH);   // Turn the motor on
    delayMicroseconds(pulse);       // Length of the pulse sets the motor position
    digitalWrite(10, LOW);    // Turn the motor off 

    lastPulse = millis();           // save the time of the last pulse
  }

  Serial.print(255,BYTE); //send something
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/10/18/hnd-live-gps-and-vibe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HND: Live GPS</title>
		<link>http://cwwang.com/2007/10/15/hnd-live-gps/</link>
		<comments>http://cwwang.com/2007/10/15/hnd-live-gps/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 17:08:24 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/10/15/hnd-live-gps/</guid>
		<description><![CDATA[Here&#8217;s our Processing sketch for taking a live GPS feed of some guy in Kansas that never seems to move. The applet displays his location, our fixed location and controls MoMo, our haptic navigation device via serial connection. [HND: Live GPS]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/hndlivegpsscreenshot_1.png" title="hndlivegpsscreenshot_1.png" rel="lightbox[343]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/hndlivegpsscreenshot_1.thumbnail.png" alt="hndlivegpsscreenshot_1.png" class="imageframe" height="66" width="128" /></a></p>
<p>Here&#8217;s our Processing sketch for taking a live GPS feed of some guy in Kansas that never seems to move.  The applet displays his location, our fixed location and controls MoMo, our haptic navigation device via serial connection.<br />
[<a href="http://cwwang.com/wordpress/wp-content/uploads/hapticDeviceControl04Livegps/applet/">HND: Live GPS</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/10/15/hnd-live-gps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

