<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for miscellanea.com || andrew burrell</title>
	<atom:link href="http://miscellanea.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://miscellanea.com</link>
	<description></description>
	<lastBuildDate>Sat, 18 Feb 2012 05:08:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>Comment on how to get more arduino analog inputs by Trent</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-9829</link>
		<dc:creator>Trent</dc:creator>
		<pubDate>Sat, 18 Feb 2012 05:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-9829</guid>
		<description>Hi Andrew, I build a controller with 32 pots connected to 4 multiplexers. I was wondering if you know how to properly transform these signals into a MIDI message. At the moment I can see all the pot values on the serial monitor, so I know they are properly connected. When I try to connect my controller through a midi device and into a DAW such as ableton or renoise, it responds as if I am turning every single knob at once without having touched them. 

If you could give me some advice that would be amazing. Thanks!

const int Apin = 2;
const int Bpin = 3;
const int Cpin = 4;
const int trigPin = 5;
const int echoPin = 6;
byte potVal;
byte lastVal[32]; // store the latest value here if it&#039;s different
byte MIDIBuf[3];
unsigned long duration;
int controllerNumber = 0;
#define CONTROLLER_CHANGE_STATUS 0xB0

void sendMIDI(int ctlNum, int value);

void setup(void)
{
  digitalWrite(trigPin, LOW);

  pinMode(Apin, OUTPUT);
  pinMode(Bpin, OUTPUT);
  pinMode(Cpin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(trigPin, OUTPUT);

  Serial.begin(9600); // MIDI
}

void loop()
{
  controllerNumber = 0;
  
  digitalWrite(trigPin, HIGH); // start trig pulse
  delay(1);//for (int i = 0; i &lt; 20; ++i);
  digitalWrite(trigPin, LOW); // end trig pulse
  duration = pulseIn(echoPin, HIGH); // read width of echo pulse

  MIDIBuf[0] = CONTROLLER_CHANGE_STATUS;
  MIDIBuf[1] = controllerNumber;
  MIDIBuf[2] = duration;
  Serial.write(MIDIBuf, 3);

  for (int i = 0 ; i &lt; 8; ++i)
  {
    digitalWrite(Apin, (i &amp; 1));
    digitalWrite(Bpin, (i &amp; 2));
    digitalWrite(Cpin, (i &amp; 4));

    for (int analogPin = 0; analogPin &gt;3)&amp;0x7F; // force 7-bit
      controllerNumber++;
      if (lastVal[controllerNumber] != potVal)
      Serial.println(analogRead(0));
      delay(100);
      { // only send if changed
        lastVal[controllerNumber] = potVal;
        MIDIBuf[0] = CONTROLLER_CHANGE_STATUS;
        MIDIBuf[1] = controllerNumber;
        MIDIBuf[2] = potVal;
        Serial.write(MIDIBuf, 3);
      }
    }
  }
}</description>
		<content:encoded><![CDATA[<p>Hi Andrew, I build a controller with 32 pots connected to 4 multiplexers. I was wondering if you know how to properly transform these signals into a MIDI message. At the moment I can see all the pot values on the serial monitor, so I know they are properly connected. When I try to connect my controller through a midi device and into a DAW such as ableton or renoise, it responds as if I am turning every single knob at once without having touched them. </p>
<p>If you could give me some advice that would be amazing. Thanks!</p>
<p>const int Apin = 2;<br />
const int Bpin = 3;<br />
const int Cpin = 4;<br />
const int trigPin = 5;<br />
const int echoPin = 6;<br />
byte potVal;<br />
byte lastVal[32]; // store the latest value here if it&#8217;s different<br />
byte MIDIBuf[3];<br />
unsigned long duration;<br />
int controllerNumber = 0;<br />
#define CONTROLLER_CHANGE_STATUS 0xB0</p>
<p>void sendMIDI(int ctlNum, int value);</p>
<p>void setup(void)<br />
{<br />
  digitalWrite(trigPin, LOW);</p>
<p>  pinMode(Apin, OUTPUT);<br />
  pinMode(Bpin, OUTPUT);<br />
  pinMode(Cpin, OUTPUT);<br />
  pinMode(echoPin, INPUT);<br />
  pinMode(trigPin, OUTPUT);</p>
<p>  Serial.begin(9600); // MIDI<br />
}</p>
<p>void loop()<br />
{<br />
  controllerNumber = 0;</p>
<p>  digitalWrite(trigPin, HIGH); // start trig pulse<br />
  delay(1);//for (int i = 0; i &lt; 20; ++i);<br />
  digitalWrite(trigPin, LOW); // end trig pulse<br />
  duration = pulseIn(echoPin, HIGH); // read width of echo pulse</p>
<p>  MIDIBuf[0] = CONTROLLER_CHANGE_STATUS;<br />
  MIDIBuf[1] = controllerNumber;<br />
  MIDIBuf[2] = duration;<br />
  Serial.write(MIDIBuf, 3);</p>
<p>  for (int i = 0 ; i &lt; 8; ++i)<br />
  {<br />
    digitalWrite(Apin, (i &amp; 1));<br />
    digitalWrite(Bpin, (i &amp; 2));<br />
    digitalWrite(Cpin, (i &amp; 4));</p>
<p>    for (int analogPin = 0; analogPin &gt;3)&amp;0x7F; // force 7-bit<br />
      controllerNumber++;<br />
      if (lastVal[controllerNumber] != potVal)<br />
      Serial.println(analogRead(0));<br />
      delay(100);<br />
      { // only send if changed<br />
        lastVal[controllerNumber] = potVal;<br />
        MIDIBuf[0] = CONTROLLER_CHANGE_STATUS;<br />
        MIDIBuf[1] = controllerNumber;<br />
        MIDIBuf[2] = potVal;<br />
        Serial.write(MIDIBuf, 3);<br />
      }<br />
    }<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by andrew</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-8607</link>
		<dc:creator>andrew</dc:creator>
		<pubDate>Thu, 10 Nov 2011 03:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-8607</guid>
		<description>Hi Dave,

Sorry I missed your question back on September. For more than 8 analogue inputs, there are two solutions I can think of. One would be to use two multiplexer ICs on 2 separate arduino pins, or more simply if you really only need 10 inputs, run 8 through the multiplexer and the last two through 2 standard arduino analogue inputs. 

a</description>
		<content:encoded><![CDATA[<p>Hi Dave,</p>
<p>Sorry I missed your question back on September. For more than 8 analogue inputs, there are two solutions I can think of. One would be to use two multiplexer ICs on 2 separate arduino pins, or more simply if you really only need 10 inputs, run 8 through the multiplexer and the last two through 2 standard arduino analogue inputs. </p>
<p>a</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on kinect &#8211;&gt; openFrameworks &#8211;&gt; Syphon &#8211;&gt; max/msp/jitter by Gerry</title>
		<link>http://miscellanea.com/kinect-openframeworks-syphon-maxmspjitter/comment-page-1/#comment-8061</link>
		<dc:creator>Gerry</dc:creator>
		<pubDate>Mon, 19 Sep 2011 23:43:33 +0000</pubDate>
		<guid isPermaLink="false">http://palace-of-memory.net/?p=302#comment-8061</guid>
		<description>sadly this doesn&#039;t seem to work with open frameworks 007.</description>
		<content:encoded><![CDATA[<p>sadly this doesn&#8217;t seem to work with open frameworks 007.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by David Early</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-8021</link>
		<dc:creator>David Early</dc:creator>
		<pubDate>Fri, 16 Sep 2011 22:29:53 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-8021</guid>
		<description>I have a requirement for 10 analog input for photocells.  Any ideas on this?

What additionalo IC to use for this?

Thanks,

Dave</description>
		<content:encoded><![CDATA[<p>I have a requirement for 10 analog input for photocells.  Any ideas on this?</p>
<p>What additionalo IC to use for this?</p>
<p>Thanks,</p>
<p>Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Fledgling Virtual Environments in Unity by Michela</title>
		<link>http://miscellanea.com/fledgling-virtual-environments-in-unity/comment-page-1/#comment-6561</link>
		<dc:creator>Michela</dc:creator>
		<pubDate>Wed, 08 Jun 2011 15:48:50 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=578#comment-6561</guid>
		<description>Good to read up on your stack! Thanks for posting.</description>
		<content:encoded><![CDATA[<p>Good to read up on your stack! Thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by andrew</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-5142</link>
		<dc:creator>andrew</dc:creator>
		<pubDate>Fri, 11 Mar 2011 21:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-5142</guid>
		<description>It is not literally possible to read more than one of the multiplexer&#039;s pins at once, but the loop happens so fast that you can turn the two (or more) pots at once and it will read them in turn but  fast enough to act like they are all being read at once. (if it is still not quite fast enough look at removing or shortening the delay(10) in each of the &#039;read&#039; code blocks in the sketch.)

hope this helps, a</description>
		<content:encoded><![CDATA[<p>It is not literally possible to read more than one of the multiplexer&#8217;s pins at once, but the loop happens so fast that you can turn the two (or more) pots at once and it will read them in turn but  fast enough to act like they are all being read at once. (if it is still not quite fast enough look at removing or shortening the delay(10) in each of the &#8216;read&#8217; code blocks in the sketch.)</p>
<p>hope this helps, a</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by Constantine</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-5136</link>
		<dc:creator>Constantine</dc:creator>
		<pubDate>Fri, 11 Mar 2011 15:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-5136</guid>
		<description>Hi,
I was wondering if this setup means that it would not be possible for arduino to read the input of 2 analog pins on the multiplexer at the same time.
For example, if I connect 2 potentiometers to 2 pins of the multiplexer and turn them at the same time,would arduino successfully read both or that is not possible?
Thanks in advance,
Constantine.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I was wondering if this setup means that it would not be possible for arduino to read the input of 2 analog pins on the multiplexer at the same time.<br />
For example, if I connect 2 potentiometers to 2 pins of the multiplexer and turn them at the same time,would arduino successfully read both or that is not possible?<br />
Thanks in advance,<br />
Constantine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by andrew</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-4717</link>
		<dc:creator>andrew</dc:creator>
		<pubDate>Wed, 09 Feb 2011 03:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-4717</guid>
		<description>hi.. 

There were some syntax errors in your code, but the following, assuming your hardware is wired up correctly, should work for you to read all 8 analog inputs of the 4051 from analog pin 0 on the arduino.  If you wanted to read from 3 4051s then you just need to repeat the process in the loop, but using two other analog pins on the arduino..

&lt;code&gt;
void setup()
 
{ 
  //4051 digital control pins
 
  pinMode(8, OUTPUT);    // s0
  pinMode(9, OUTPUT);    // s1
  pinMode(10, OUTPUT);    // s2
  
  Serial.begin(9600);
}
 
void loop()
 
{
 
  //Read Value of 4051 analog-in 0 by setting the values of s0,s1 and s2
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  delay(10); //not sure if this delay is strictly necessary
  int readInZero = analogRead(0);  // read the arduino input pin the 4051 is using
  Serial.println(readInZero); //use the result
    
  //Read Value of 4051 analog-in 1 by setting the values of s0,s1 and s2
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  delay(10); //not sure if this delay is strictly necessary
  int readInOne = analogRead(0);  // read the arduino analog input pin 
  Serial.println(readInOne); //use the result
  
  //Read Value of 4051 analog-in 2 by setting the values of s0,s1 and s2
   digitalWrite(8, LOW);
   digitalWrite(9, HIGH);
   digitalWrite(10, LOW);
   delay(10);
   int readInTwo= analogRead(0);
   Serial.println(readInTwo); //use the result
   
   //Read Value of 4051 analog-in 3 by setting the values of s0,s1 and s2
   digitalWrite(8, HIGH);
   digitalWrite(9, HIGH);
   digitalWrite(10, LOW);
   delay(10);
   int readInThree= analogRead(0);
   Serial.println(readInThree); //use the result
   
   //Read Value of 4051 analog-in 4 by setting the values of s0,s1 and s2
   digitalWrite(8, LOW);
   digitalWrite(9, LOW);
   digitalWrite(10, HIGH);
   delay(10);
   int readInFour= analogRead(0);
   Serial.println(readInFour); //use the result
   
   //Read Value of 4051 analog-in 5 by setting the values of s0,s1 and s2
   digitalWrite(8, HIGH);
   digitalWrite(9, LOW);
   digitalWrite(10, HIGH);
   delay(10);
   int readInFive= analogRead(0);
   Serial.println(readInFive); //use the result
   
   //Read Value of 4051 analog-in 6 by setting the values of s0,s1 and s2
   digitalWrite(8, LOW);
   digitalWrite(9, HIGH);
   digitalWrite(10, HIGH);
   delay(10);
   int readInSix= analogRead(0);
   Serial.println(readInSix); //use the result
   
   //Read Value of 4051 analog-in 7 by setting the values of s0,s1 and s2
   digitalWrite(8, HIGH);
   digitalWrite(9, HIGH);
   digitalWrite(10, HIGH);
   delay(10);
   int readInSeven= analogRead(0);
   Serial.println(readInSeven); //use the result
 
 
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>hi.. </p>
<p>There were some syntax errors in your code, but the following, assuming your hardware is wired up correctly, should work for you to read all 8 analog inputs of the 4051 from analog pin 0 on the arduino.  If you wanted to read from 3 4051s then you just need to repeat the process in the loop, but using two other analog pins on the arduino..</p>
<p><code><br />
void setup()</p>
<p>{<br />
  //4051 digital control pins</p>
<p>  pinMode(8, OUTPUT);    // s0<br />
  pinMode(9, OUTPUT);    // s1<br />
  pinMode(10, OUTPUT);    // s2</p>
<p>  Serial.begin(9600);<br />
}</p>
<p>void loop()</p>
<p>{</p>
<p>  //Read Value of 4051 analog-in 0 by setting the values of s0,s1 and s2<br />
  digitalWrite(8, LOW);<br />
  digitalWrite(9, LOW);<br />
  digitalWrite(10, LOW);<br />
  delay(10); //not sure if this delay is strictly necessary<br />
  int readInZero = analogRead(0);  // read the arduino input pin the 4051 is using<br />
  Serial.println(readInZero); //use the result</p>
<p>  //Read Value of 4051 analog-in 1 by setting the values of s0,s1 and s2<br />
  digitalWrite(8, HIGH);<br />
  digitalWrite(9, LOW);<br />
  digitalWrite(10, LOW);<br />
  delay(10); //not sure if this delay is strictly necessary<br />
  int readInOne = analogRead(0);  // read the arduino analog input pin<br />
  Serial.println(readInOne); //use the result</p>
<p>  //Read Value of 4051 analog-in 2 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, LOW);<br />
   digitalWrite(9, HIGH);<br />
   digitalWrite(10, LOW);<br />
   delay(10);<br />
   int readInTwo= analogRead(0);<br />
   Serial.println(readInTwo); //use the result</p>
<p>   //Read Value of 4051 analog-in 3 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, HIGH);<br />
   digitalWrite(9, HIGH);<br />
   digitalWrite(10, LOW);<br />
   delay(10);<br />
   int readInThree= analogRead(0);<br />
   Serial.println(readInThree); //use the result</p>
<p>   //Read Value of 4051 analog-in 4 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, LOW);<br />
   digitalWrite(9, LOW);<br />
   digitalWrite(10, HIGH);<br />
   delay(10);<br />
   int readInFour= analogRead(0);<br />
   Serial.println(readInFour); //use the result</p>
<p>   //Read Value of 4051 analog-in 5 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, HIGH);<br />
   digitalWrite(9, LOW);<br />
   digitalWrite(10, HIGH);<br />
   delay(10);<br />
   int readInFive= analogRead(0);<br />
   Serial.println(readInFive); //use the result</p>
<p>   //Read Value of 4051 analog-in 6 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, LOW);<br />
   digitalWrite(9, HIGH);<br />
   digitalWrite(10, HIGH);<br />
   delay(10);<br />
   int readInSix= analogRead(0);<br />
   Serial.println(readInSix); //use the result</p>
<p>   //Read Value of 4051 analog-in 7 by setting the values of s0,s1 and s2<br />
   digitalWrite(8, HIGH);<br />
   digitalWrite(9, HIGH);<br />
   digitalWrite(10, HIGH);<br />
   delay(10);<br />
   int readInSeven= analogRead(0);<br />
   Serial.println(readInSeven); //use the result</p>
<p>}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by C#Bb</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-4707</link>
		<dc:creator>C#Bb</dc:creator>
		<pubDate>Tue, 08 Feb 2011 10:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-4707</guid>
		<description>Took me all night but here&#039;s my understanding; special thanks to Andrew Burrell  
 Edited cy Caesar Passee
MUx A edited by pitchoilcan at geemail dot com
void setup()  
{
//4051 digital control pins
  pinMode
(8, OUTPUT); // s0
  pinMode
(9, OUTPUT); // s1
  pinMode
(10, OUTPUT); // s2
    Serial.
begin(9600);
}
void loop()
{
//Read Value of 4051 analog-in 0 by setting the values of s0,s1 and s2
  digitalWrite
(8, LOW);
  digitalWrite
(9, LOW);
  digitalWrite
(10, LOW);
  delay
(10); //not sure if this delay is strictly necessary
int readInZero = analogRead(0); // read the input pin
  Serial.print(readInZero); //use the result
//
  digitalWrite
(8, LOW);
  digitalWrite
(9, HIGH);
  digitalWrite
(10, LOW);
  delay
(10);
int readInTwo= analogRead(0);
  Serial.print(readInTwo);  
//
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delay(10);
int readInFour= analogRead(0);
Serial.print(readInFour);
digitalWrite(8, High);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
delay(10);
int readInSix= analogRead(0); 
Serial.print(readInSix);
//
digitalWrite(8, HiGH);
digitalWrite(9, HIGH);
digitalWrite(10, HiGH);
delay(10);
int readInSeven= analogRead(0); 
Serial.print(readInSeven);
//
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
delay(10);
int readInFive= analogRead(0); 
Serial.print(readInFive);
//
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
delay(10);
int readInThree= analogRead(0);
Serial.print(readInThree);
//
digitalWrite(8, HIGH);
digitalWrite(9, Low;
digitalWrite(10, HIGH);
delay(10);
int readInOne= analogRead(0);
Serial.print(readInOne);</description>
		<content:encoded><![CDATA[<p>Took me all night but here&#8217;s my understanding; special thanks to Andrew Burrell<br />
 Edited cy Caesar Passee<br />
MUx A edited by pitchoilcan at geemail dot com<br />
void setup()  <br />
{<br />
//4051 digital control pins<br />
  pinMode<br />
(8, OUTPUT); // s0<br />
  pinMode<br />
(9, OUTPUT); // s1<br />
  pinMode<br />
(10, OUTPUT); // s2<br />
    Serial.<br />
begin(9600);<br />
}<br />
void loop()<br />
{<br />
//Read Value of 4051 analog-in 0 by setting the values of s0,s1 and s2<br />
  digitalWrite<br />
(8, LOW);<br />
  digitalWrite<br />
(9, LOW);<br />
  digitalWrite<br />
(10, LOW);<br />
  delay<br />
(10); //not sure if this delay is strictly necessary<br />
int readInZero = analogRead(0); // read the input pin<br />
  Serial.print(readInZero); //use the result<br />
//<br />
  digitalWrite<br />
(8, LOW);<br />
  digitalWrite<br />
(9, HIGH);<br />
  digitalWrite<br />
(10, LOW);<br />
  delay<br />
(10);<br />
int readInTwo= analogRead(0);<br />
  Serial.print(readInTwo);  <br />
//<br />
digitalWrite(8, LOW);<br />
digitalWrite(9, LOW);<br />
digitalWrite(10, HIGH);<br />
delay(10);<br />
int readInFour= analogRead(0);<br />
Serial.print(readInFour);<br />
digitalWrite(8, High);<br />
digitalWrite(9, LOW);<br />
digitalWrite(10, LOW);<br />
delay(10);<br />
int readInSix= analogRead(0); <br />
Serial.print(readInSix);<br />
//<br />
digitalWrite(8, HiGH);<br />
digitalWrite(9, HIGH);<br />
digitalWrite(10, HiGH);<br />
delay(10);<br />
int readInSeven= analogRead(0); <br />
Serial.print(readInSeven);<br />
//<br />
digitalWrite(8, HIGH);<br />
digitalWrite(9, HIGH);<br />
digitalWrite(10, LOW);<br />
delay(10);<br />
int readInFive= analogRead(0); <br />
Serial.print(readInFive);<br />
//<br />
digitalWrite(8, LOW);<br />
digitalWrite(9, HIGH);<br />
digitalWrite(10, HIGH);<br />
delay(10);<br />
int readInThree= analogRead(0);<br />
Serial.print(readInThree);<br />
//<br />
digitalWrite(8, HIGH);<br />
digitalWrite(9, Low;<br />
digitalWrite(10, HIGH);<br />
delay(10);<br />
int readInOne= analogRead(0);<br />
Serial.print(readInOne);</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on how to get more arduino analog inputs by andrew</title>
		<link>http://miscellanea.com/how-to-get-more-arduino-analog-inputs/comment-page-1/#comment-4692</link>
		<dc:creator>andrew</dc:creator>
		<pubDate>Mon, 07 Feb 2011 22:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://miscellanea.com/?p=525#comment-4692</guid>
		<description>Hi,

The loop function &quot;void loop()&quot; is where the guts of any arduino code goes. It simply loops through its instructions continually while the arduino is powered up. 

So what you need to do is hook up all 8 piezos using the input pins of the multiplexer, then in the loop function read each of these pins in turn. (by setting s0, s1 &amp; s2 to high or low according to what pin you are up to reading)

You cannot, in reality, read all of the 8 pins at once, you need to run through them in turn, but you do it fast enough that it makes no real difference to the user.  

basically what you will be doing to the code above is adding 6 more code segments like the following but changing the LOW and HIGHS and also changing the variable name for each to make it unique (ie: readInTwo). This will switch through the inputs reading them in turn. If it seems laggy i would try removing or shortening the delay

   digitalWrite(8, LOW);
 
   digitalWrite(9, HIGH);
 
   digitalWrite(10, LOW);
 
   delay(10);
 
   int readInTwo= analogRead(0); //change this variable name to be unique for each pin

   //do some stuff with the value you just got


hope this helps
andrew</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>The loop function &#8220;void loop()&#8221; is where the guts of any arduino code goes. It simply loops through its instructions continually while the arduino is powered up. </p>
<p>So what you need to do is hook up all 8 piezos using the input pins of the multiplexer, then in the loop function read each of these pins in turn. (by setting s0, s1 &amp; s2 to high or low according to what pin you are up to reading)</p>
<p>You cannot, in reality, read all of the 8 pins at once, you need to run through them in turn, but you do it fast enough that it makes no real difference to the user.  </p>
<p>basically what you will be doing to the code above is adding 6 more code segments like the following but changing the LOW and HIGHS and also changing the variable name for each to make it unique (ie: readInTwo). This will switch through the inputs reading them in turn. If it seems laggy i would try removing or shortening the delay</p>
<p>   digitalWrite(8, LOW);</p>
<p>   digitalWrite(9, HIGH);</p>
<p>   digitalWrite(10, LOW);</p>
<p>   delay(10);</p>
<p>   int readInTwo= analogRead(0); //change this variable name to be unique for each pin</p>
<p>   //do some stuff with the value you just got</p>
<p>hope this helps<br />
andrew</p>
]]></content:encoded>
	</item>
</channel>
</rss>

