<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Cdixon90&#039;s Blog</title>
	<atom:link href="http://cdixon90.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cdixon90.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 13 Apr 2010 11:59:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='cdixon90.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Cdixon90&#039;s Blog</title>
		<link>http://cdixon90.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cdixon90.wordpress.com/osd.xml" title="Cdixon90&#039;s Blog" />
	<atom:link rel='hub' href='http://cdixon90.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Physical Computing Lab 7 and 8</title>
		<link>http://cdixon90.wordpress.com/2010/04/13/physical-computing-lab-7-and-8/</link>
		<comments>http://cdixon90.wordpress.com/2010/04/13/physical-computing-lab-7-and-8/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 11:29:32 +0000</pubDate>
		<dc:creator>cdixon90</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cdixon90.wordpress.com/?p=24</guid>
		<description><![CDATA[Display Temperature The objective of this lab was to display the temperature manualy on the 7-Segment Display using the POT instead of the TEMP CONTROL. The POT can be selected instead of Temp Control using the SW2 switch. This switch is located on the CONTROL SWITCHES section of the board. This is an example of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=24&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Display Temperature</strong></p>
<p>The objective of this lab was to display the temperature manualy on the <strong>7-Segment Display </strong>using the <strong>POT</strong> instead of the <strong>TEMP CONTROL. </strong></p>
<p>The POT can be selected instead of Temp Control using the <strong>SW2 </strong>switch. This switch is located on the <strong>CONTROL SWITCHES</strong> section of the board.</p>
<p><em>This is an example of a POT Slider (potentiometer slider)</em></p>
<p><a href="http://cdixon90.files.wordpress.com/2010/04/pot-slider.jpg"><img class="aligncenter size-full wp-image-25" title="POT slider" src="http://cdixon90.files.wordpress.com/2010/04/pot-slider.jpg?w=150&#038;h=110" alt="" width="150" height="110" /></a></p>
<p>The POT is located on the bottom left-hand side of the board and can be given a value of  0% &#8211; 100%</p>
<p><strong>This is the code I used to do this on the Arduino Board</strong></p>
<p>const int num_digits = 4;                 // the number of digits used</p>
<p>const int num_pins = 8;                 // the number of pins used</p>
<p>const int numPatterns=10;               // number of patterns to display</p>
<p>const int num_pinsPort2 = 8;                 // the number of pinsPort2 used</p>
<p>unsigned long time;</p>
<p>unsigned long time1;</p>
<p>unsigned long time2;</p>
<p>int comparator_out;</p>
<p>int comparator_flag=0;</p>
<p>byte count=0;</p>
<p>int MSB;</p>
<p>int LSB;</p>
<p>int temperature;</p>
<p>int temp;</p>
<p>int timer = 500;                       // time to next pattern</p>
<p>int pins[] = {</p>
<p>  6, 15, 7, 14, 8, 10, 9, 11};  // pins used, first one to segment A, second to segment B…</p>
<p>int digits[] = {</p>
<p>  2, 19, 3, 18};</p>
<p>  int pinsPort2[] = {</p>
<p>  6, 15, 7, 14, 8, 10, 9, 11};  // pinsPort2 used in PORT 2</p>
<p>int pinsPort1[] = {</p>
<p>  2, 19, 3, 18, 4, 17, 5, 16};</p>
<p>// define all different patterns (numbers) to display</p>
<p>int patterns[numPatterns][num_pins]=</p>
<p>{</p>
<p>  {</p>
<p>    1,1,1,1,1,1,0,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    0,1,1,0,0,0,0,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,1,0,1,1,0,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,1,1,1,0,0,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    0,1,1,0,0,1,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,0,1,1,0,1,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,0,1,1,1,1,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,1,1,0,0,0,0,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,1,1,1,1,1,1,0      }</p>
<p>  ,</p>
<p>  {</p>
<p>    1,1,1,1,0,1,1,0      }</p>
<p>  ,</p>
<p>};</p>
<p>void setup()</p>
<p>{</p>
<p>  int i;</p>
<p>  for (i = 0; i &lt; num_pins; i++)   // the array elements are numbered from 0 to num_pins – 1</p>
<p>    pinMode(pins[i], OUTPUT);      // set each pin as an output</p>
<p>  for (i = 0; i &lt; num_digits; i++)   // the array elements are numbered from 0 to num_pins – 1</p>
<p>    pinMode(digits[i], OUTPUT);      // set each pin as an output</p>
<p>  digitalWrite(digits[0], LOW);</p>
<p>  digitalWrite(digits[1], LOW);</p>
<p>  digitalWrite(digits[2], LOW);</p>
<p>  digitalWrite(digits[3], LOW);</p>
<p>    pinMode(pinsPort1[4], INPUT);      // set each pin as an output</p>
<p>    digitalWrite(pinsPort1[4], HIGH);      // set each pin as an output</p>
<p>    Serial.begin(9600);</p>
<p>}</p>
<p>void loop()</p>
<p>{</p>
<p>  time1=millis();</p>
<p>  //count++;</p>
<p>  DAC_conversion();</p>
<p>  do{</p>
<p>    displayTemperature(temp);</p>
<p>    time2=millis();</p>
<p>  }</p>
<p>  while((time2-time1) &lt;200);</p>
<p>   //delay(10);</p>
<p>}</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>//*************************** FUNCTIONS **********************************************</p>
<p>void displayTemperature( int temperature){</p>
<p>  MSB = temperature / 10;</p>
<p>  LSB= temperature- (MSB * 10);</p>
<p>  digitalWrite(digits[0], HIGH);</p>
<p>  digitalWrite(digits[1], LOW);</p>
<p>  segmentsOn(LSB);</p>
<p>  delay(2);</p>
<p>  digitalWrite(digits[0], LOW);</p>
<p>  digitalWrite(digits[1], HIGH);</p>
<p>  segmentsOn(MSB);</p>
<p>  delay(2);</p>
<p>  digitalWrite(digits[1], LOW);</p>
<p>}</p>
<p>//————————————————————————————-</p>
<p>void  segmentsOn(byte number){</p>
<p>  int p;</p>
<p>  for (p = 0; p &lt; num_pins; p++) {   // loop through the pin states for pattern</p>
<p>    if (patterns[number][p]==1)</p>
<p>    {</p>
<p>      digitalWrite(pins[p], HIGH);   // turning it on</p>
<p>    }</p>
<p>    else</p>
<p>    {</p>
<p>      digitalWrite(pins[p], LOW);    // turning it off</p>
<p>    }</p>
<p>  } </p>
<p>}</p>
<p>//——————————————————————————————-</p>
<p>//*************************** FUNCTIONS **********************************************</p>
<p>void outputPort2(byte value){</p>
<p>byte test;</p>
<p>byte mask=1;</p>
<p>int x;</p>
<p>for(x=0; x&lt;=7; x++){</p>
<p> test = value &amp; mask;</p>
<p>  if(test&gt;0){</p>
<p>    digitalWrite(pinsPort2[x], HIGH);   // turning it on</p>
<p>  }</p>
<p>  else  if(test==0){</p>
<p>     digitalWrite(pinsPort2[x], LOW);    // turning it off</p>
<p>  }</p>
<p>  mask = mask&lt;&lt;1;</p>
<p>}</p>
<p>}</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>void DAC_conversion(){</p>
<p>count=00;</p>
<p>   do{</p>
<p>     outputPort2(count);</p>
<p>     comparator_out = !digitalRead(pinsPort1[4]);</p>
<p>     count++;</p>
<p>     if(count==255){</p>
<p>       count=0;</p>
<p>     }</p>
<p>     temp=count;</p>
<p>     }while(comparator_out!=0);</p>
<p>}</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cdixon90.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cdixon90.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cdixon90.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=24&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cdixon90.wordpress.com/2010/04/13/physical-computing-lab-7-and-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/296596631d88e11a5c234a3a207aec33?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cdixon90</media:title>
		</media:content>

		<media:content url="http://cdixon90.files.wordpress.com/2010/04/pot-slider.jpg" medium="image">
			<media:title type="html">POT slider</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical Computing Lab 4</title>
		<link>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-4/</link>
		<comments>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-4/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:27:08 +0000</pubDate>
		<dc:creator>cdixon90</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cdixon90.wordpress.com/?p=13</guid>
		<description><![CDATA[const int num_digits = 4; // the number of digits used const int num_pins = 8; // the number of pins used const int numPatterns=10; // number of patterns to display unsigned long time; unsigned long time1; unsigned long time2; int count=0; int MSB; int LSB; int temperature; int timer = 500; // time to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=13&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>const int num_digits = 4; // the number of digits used<br />
const int num_pins = 8; // the number of pins used<br />
const int numPatterns=10; // number of patterns to display<br />
unsigned long time;<br />
unsigned long time1;<br />
unsigned long time2;<br />
int count=0;</p>
<p>int MSB;<br />
int LSB;<br />
int temperature;<br />
int timer = 500; // time to next pattern<br />
int pins[] = {<br />
6, 15, 7, 14, 8, 10, 9, 11}; // pins used, first one to segment A, second to segment B…</p>
<p>int digits[] = {<br />
2, 19, 3, 18};<br />
// define all different patterns (numbers) to display<br />
int patterns[numPatterns][num_pins]=<br />
{<br />
{<br />
1,1,1,1,1,1,0,0 }<br />
,<br />
{<br />
0,1,1,0,0,0,0,0 }<br />
,<br />
{<br />
1,1,0,1,1,0,1,0 }<br />
,<br />
{<br />
1,1,1,1,0,0,1,0 }<br />
,<br />
{<br />
0,1,1,0,0,1,1,0 }<br />
,<br />
{<br />
1,0,1,1,0,1,1,0 }<br />
,<br />
{<br />
1,0,1,1,1,1,1,0 }<br />
,<br />
{<br />
1,1,1,0,0,0,0,0 }<br />
,<br />
{<br />
1,1,1,1,1,1,1,0 }<br />
,<br />
{<br />
1,1,1,1,0,1,1,0 }<br />
,<br />
};</p>
<p>void setup()<br />
{<br />
int i;</p>
<p>for (i = 0; i &lt; num_pins; i++) // the array elements are numbered from 0 to num_pins – 1<br />
pinMode(pins[i], OUTPUT); // set each pin as an output</p>
<p>for (i = 0; i &lt; num_digits; i++) // the array elements are numbered from 0 to num_pins – 1<br />
pinMode(digits[i], OUTPUT); // set each pin as an output</p>
<p>digitalWrite(digits[0], LOW);<br />
digitalWrite(digits[1], LOW);<br />
digitalWrite(digits[2], LOW);<br />
digitalWrite(digits[3], LOW);</p>
<p>}</p>
<p>void loop()<br />
{</p>
<p>// WRITE YOUR PROGRAMME CODE HERE<br />
  time1=millis();<br />
 <br />
 <br />
  do{<br />
   Temperature(count);<br />
    time2=millis();<br />
  }while((time2-time1)&lt;100);<br />
 <br />
  count++;<br />
  if(count==100){<br />
    count=0;<br />
  }<br />
  //delay of 10 milliseconds</p>
<p>//byte temperature=6;<br />
//digitalWrite (digits[0],HIGH);</p>
<p>//segmentsOn(temperature);</p>
<p>}<br />
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>//*************************** FUNCTIONS **********************************************<br />
void Temperature(int temperature) {<br />
  MSB=temperature/10;<br />
  LSB=temperature-(MSB*10);<br />
  digitalWrite (digits[0],HIGH);<br />
  digitalWrite (digits[1],LOW);<br />
  segmentsOn(LSB);<br />
  delay(5);<br />
 <br />
  digitalWrite (digits[0],LOW);<br />
  digitalWrite (digits[1],HIGH);<br />
  segmentsOn(MSB);<br />
  delay(5);<br />
 <br />
  digitalWrite (digits[0],LOW);</p>
<p>}<br />
 </p>
<p>void segmentsOn(byte number){<br />
int p;<br />
for (p = 0; p &lt; num_pins; p++) { // loop through the pin states for pattern<br />
if (patterns[number][p]==1)<br />
{<br />
digitalWrite(pins[p], HIGH); // turning it on<br />
}<br />
else<br />
{<br />
digitalWrite(pins[p], LOW); // turning it off<br />
}<br />
}<br />
}</p>
<p>//——————————————————————————————-</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cdixon90.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cdixon90.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cdixon90.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=13&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/296596631d88e11a5c234a3a207aec33?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cdixon90</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical Computing Lab 3</title>
		<link>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-3/</link>
		<comments>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-3/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:26:20 +0000</pubDate>
		<dc:creator>cdixon90</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cdixon90.wordpress.com/?p=9</guid>
		<description><![CDATA[To display variable you need to  list out all the possible numbers. Then set up all the outputs. Then a delay between the two so they can be display. MSB means the Most Significant Bit LSB means the Least Significant Bit const int num_digits=4; unsigned long time; unsigned long time1; unsigned long time2; int count=0; int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=9&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div>
<p>To display variable you need to  list out all the possible numbers. Then set up all the outputs. Then a delay between the two so they can be display.</p>
<p><strong>MSB</strong> means the <strong>Most Significant Bit</strong></p>
<p><strong>LSB </strong>means the <strong>Least Significant Bit</strong></p>
<p>const int num_digits=4;<br />
unsigned long time;<br />
unsigned long time1;<br />
unsigned long time2;<br />
int count=0;<br />
int MSB;<br />
int LSB;<br />
int temperature;<br />
int timer=500;<br />
int digits[]={2,19,3,18};</p>
<p>const int numPatterns=10;      //You are defining the 10 different numbers 1<br />
const int num_pins=8;           //You are defining the 7 segements and decimal</p>
<p>int pins [] = {6,15,7,14,8,10,9,11};  // This tells which segement will have to be turned on.<br />
int patterns [numPatterns] [num_pins]=<br />
{<br />
  {1,1,1,1,1,1,0,0},// 0<br />
  {0,1,1,0,0,0,0,0},// 1<br />
  {1,1,0,1,1,0,1,0},// 2<br />
  {1,1,1,1,0,0,1,0},// 3<br />
  {0,1,1,0,0,1,1,0},// 4<br />
  {1,0,1,1,0,1,1,0},// 5<br />
  {0,0,1,1,1,1,1,0},// 6<br />
  {1,1,1,0,0,0,0,0},// 7<br />
  {1,1,1,1,1,1,1,0},// 8<br />
  {1,1,1,0,0,1,1,0},// 9<br />
};</p>
<p>void setup ()<br />
{<br />
  int i;<br />
  for(i=0; i&lt;num_pins, i++)<br />
  pinMode(pins[i}, OUTPUT);<br />
  for(i=o,i&lt;num_digits, i++)<br />
  pinMode(digits[i] OUTPUT0;<br />
 <br />
 digitalWrite (digits[0],LOW)<br />
 digitalWrite (digits[1],LOW)<br />
 digitalWrite (digits[2],LOW)<br />
 digitalWrite (digits[3],LOW)<br />
 }<br />
 <br />
void loop<br />
{<br />
  time 1=millis();<br />
  do{<br />
    display Temperature(count);<br />
    time2=millis();<br />
  }<br />
  while((time2-time1)&lt;100);<br />
  count++<br />
  if(count==100){<br />
    count=0,<br />
  }<br />
  //delay(10)<br />
 <br />
 void display Temperature(int temperature) {<br />
   MSB= temperature/10;<br />
   LSB= tempertaure-(MSB*10);<br />
   digitalWrite(digits[O], HIGH);<br />
   digitalWrite(digits[1], LOW);<br />
   segmentOn(LSB);<br />
   delay(5);<br />
  <br />
   digitalWrite(digits[O], LOW);<br />
   digitalWrite(digits[1], HIGH);<br />
   segmentOn(MSB);<br />
   delay(5);<br />
   digitalWrite(digits[1];LOW);<br />
 <br />
 <br />
int number= 3;<br />
//segmentsOn(number);</p>
<p>void setup ();</p>
<p>void loop ();</p>
<p>//——————————————–<br />
void segmentsOn(byte number)<br />
{<br />
  int p;<br />
  for (p=0; p&lt;num_pins; p++)// looping through pins for pattern<br />
 {<br />
  if (patterns [number] [p] ==1)<br />
  {<br />
    digitalWrite (pins[p], HIGH);// This turns the Segement on<br />
  }<br />
  else<br />
  {<br />
    digitalWrite (pins[p], LOW);// This part turns each segement off<br />
   <br />
  }<br />
}<br />
}<br />
//————————————————</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cdixon90.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cdixon90.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cdixon90.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=9&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/296596631d88e11a5c234a3a207aec33?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cdixon90</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical Computing Lab 5 and 6</title>
		<link>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-5-and-6/</link>
		<comments>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-5-and-6/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:25:19 +0000</pubDate>
		<dc:creator>cdixon90</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cdixon90.wordpress.com/?p=10</guid>
		<description><![CDATA[In this Lab we wrote the code to make the Port 2 LED&#8217;s display numbers counting continuously upwards. There are 8 LED&#8217;s and we used a method of Binary Numbers to show the numbers counting, for example:  If D4 was the only LED turned on the number being displayed would be 64. We then wanted to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=10&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this Lab we wrote the code to make the <strong>Port 2 LED&#8217;s </strong>display numbers counting continuously upwards. There are 8 LED&#8217;s and we used a method of <strong>Binary Numbers </strong>to show the numbers counting<strong>,</strong> for example:  If D4 was the only LED turned on the number being displayed would be 64.</p>
<p>We then wanted to see these numbers in <strong>Decimal Form </strong>so we then used &#8220;serial.print&#8221; to make the  counting numbers display on the serial monitor.</p>
<p>After this we used an <strong>Oscilliscope</strong> to display our counting numbers using a <em>Ramp Wave.</em> On the Ramp Wave each colum shows a number represented by a voltage between 1 and 5 volts.</p>
<p><a href="http://cdixon90.files.wordpress.com/2010/03/ramp-graph.jpg"><img class="aligncenter size-medium wp-image-21" title="Ramp Graph" src="http://cdixon90.files.wordpress.com/2010/03/ramp-graph.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a></p>
<p><strong>The code we used to do all this is listed below:</strong></p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>const int num_digits = 4;                 // the number of digits used<br />const int num_pinsPort2 = 8;              // the number of pinsPort2 used<br />int x;<br />int count;<br />int comparator_out;<br />int pinsPort2[] = {6, 15, 7, 14, 8, 10, 9, 11};   // pinsPort2 used in PORT 2<br />int pinsPort1[] = {2, 19, 3, 18, 4, 17, 5, 16};   // pinsPort1 used in PORT 1</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>void setup()</p>
<p>{</p>
<p> int i;<br /> <br /> for (i = 0; i &lt; num_pinsPort2; i++){   // the array elements are numbered from 0 to num_pinsPort2 &#8211; 1<br /> pinMode(pinsPort2[i], OUTPUT);         // set each pin as an output</p>
<p>  }</p>
<p> pinMode(pinsPort1[4], INPUT);      // set Comparator Output pin as an Input<br /> Serial.begin(115200);</p>
<p>}</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>void loop()</p>
<p>{<br />for(x=0; x&lt;255; x++){count = x;<br />  outputPort2(count);</p>
<p>/*Serial.println(count);<br />/*delay(100);</p>
<p>}</p>
<p>}</p>
<p>//*************************** FUNCTIONS **********************************************</p>
<p>void outputPort2(byte value){</p>
<p>byte test; <br />byte mask=1;</p>
<p>int x;</p>
<p>for(x=0; x&lt;=7; x++){<br />test = value &amp; mask;</p>
<p> if(test&gt;0){<br /> <br />   digitalWrite(pinsPort2[x], HIGH);   // turning it on</p>
<p>  }</p>
<p> else  if(test==0){</p>
<p>   digitalWrite(pinsPort2[x], LOW);    // turning it off</p>
<p>  }</p>
<p> mask = mask&lt;&lt;1;  // Shift mask 1 position Left</p>
<p>}<br />}</p>
<p>//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cdixon90.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cdixon90.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cdixon90.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=10&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cdixon90.wordpress.com/2010/03/09/physical-computing-lab-5-and-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/296596631d88e11a5c234a3a207aec33?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cdixon90</media:title>
		</media:content>

		<media:content url="http://cdixon90.files.wordpress.com/2010/03/ramp-graph.jpg?w=300" medium="image">
			<media:title type="html">Ramp Graph</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical Computing Lab 2</title>
		<link>http://cdixon90.wordpress.com/2010/02/09/physical-computing-lab-2/</link>
		<comments>http://cdixon90.wordpress.com/2010/02/09/physical-computing-lab-2/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 13:32:29 +0000</pubDate>
		<dc:creator>cdixon90</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cdixon90.wordpress.com/?p=3</guid>
		<description><![CDATA[The Objective of the day was to use a 7 segment display and make it display numbers. This is a 7 Segment Display:                                                            It was decided to make the 7 segment display display the year  &#8220;2010&#8243;.                                                                                                                                                                                                                                                                      Below is the code used and some explanations of each part of the code to go with it. int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=3&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Objective of the day was to use a 7 segment display and make it display numbers.</p>
<p>This is a 7 Segment Display:</p>
<p>                                                          <img src="http://www.mindkits.co.nz/images/products/7-Segment%20Serial%20Display-600.jpg" alt="" width="259" height="181" /></p>
<p>It was decided to make the 7 segment display display the year  &#8220;2010&#8243;.                                                                                                                                                                                                                                                                      Below is the code used and some explanations of each part of the code to go with it.</p>
<p>int pin2 =  2;    //  Pin 2 Turns on the 4th Number Display<br />
int pin3 =  3;    //  Pin 3 Turns on the 3rd Number Display<br />
int pin4 =  4;<br />
int pin5 =  5;<br />
int pin6 =  6;<br />
int pin7 =  7;<br />
int pin8 =  8;<br />
int pin9 = 9;<br />
int pin10 = 10;<br />
int pin11 = 11;<br />
int pin14 = 14;<br />
int pin15 = 15;<br />
int pin16 = 16;<br />
int pin17 = 17;<br />
int pin18 = 18;   // Pin 18 Turns on the 1st Number Display<br />
int pin19 = 19;   // Pin 19 Turns on the 3rd Number Display</p>
<p>void setup()   {                // Void Setup runs once at the start of every program<br />
    <br />
  pinMode(pin2, OUTPUT);   */  This set of code tells the Arduino that all the pins are OUTPUTS<br />
  pinMode(pin4, OUTPUT);<br />
  pinMode(pin5, OUTPUT);<br />
  pinMode(pin6, OUTPUT);<br />
  pinMode(pin7, OUTPUT);<br />
  pinMode(pin8, OUTPUT);<br />
 <br />
  pinMode(pin9, OUTPUT);    <br />
  pinMode(pin10, OUTPUT); <br />
  pinMode(pin11, OUTPUT);<br />
  pinMode(pin14, OUTPUT);<br />
  pinMode(pin15, OUTPUT);<br />
  pinMode(pin16, OUTPUT);<br />
  pinMode(pin17, OUTPUT);<br />
  pinMode(pin18, OUTPUT);<br />
  pinMode(pin19, OUTPUT);<br />
}<br />
void loop()    {      //  Void Loop repeats continuously until the program is stopped <br />
 <br />
  digitalWrite(pin2, HIGH);    */  This set of code tells the Arduino to turn on the 4th Number Display via &#8221;digitalWrite(pin2, HIGH);&#8221;   <br />
  digitalWrite(pin3, LOW);             and tells it to light up which ever pins are HIGH. This displays the Number 0<br />
  digitalWrite(pin4, LOW);  <br />
  digitalWrite(pin5, LOW);<br />
  digitalWrite(pin6, HIGH);<br />
  digitalWrite(pin7, HIGH);<br />
  digitalWrite(pin8, HIGH);  <br />
  digitalWrite(pin9, LOW); <br />
  digitalWrite(pin10, HIGH);<br />
  digitalWrite(pin11, LOW); <br />
  digitalWrite(pin14, HIGH);<br />
  digitalWrite(pin15, HIGH);<br />
  digitalWrite(pin16, LOW);<br />
  digitalWrite(pin17, LOW);<br />
  digitalWrite(pin18, LOW);<br />
  digitalWrite(pin19, LOW);<br />
 <br />
 delay(1);                                          */  There is a delay of 1ms as this code does not make all 4 numbers display at once. Each number is displayed for 1ms.  </p>
<p>                                                                    This happens so quickly that it looks to the human   eye as if all 4 numbers are displaying at the same time</p>
<p>  digitalWrite(pin2, LOW);     */  This set of code tells the Arduino to turn on the 4th Number Display via &#8221;digitalWrite(pin19, HIGH);&#8221;   <br />
 digitalWrite(pin3, LOW);             and tells it to light up which ever pins are HIGH. This displays the Number 1<br />
  digitalWrite(pin4, LOW);  <br />
  digitalWrite(pin5, LOW);<br />
  digitalWrite(pin6, LOW);<br />
  digitalWrite(pin7, HIGH);<br />
  digitalWrite(pin8, LOW);  <br />
  digitalWrite(pin9, LOW); <br />
  digitalWrite(pin10, LOW);<br />
  digitalWrite(pin11, LOW); <br />
  digitalWrite(pin14, LOW);<br />
  digitalWrite(pin15, HIGH);<br />
  digitalWrite(pin16, LOW);<br />
  digitalWrite(pin17, LOW);<br />
  digitalWrite(pin18, LOW);<br />
  digitalWrite(pin19, HIGH);<br />
 <br />
 delay(1);<br />
 <br />
  digitalWrite(pin2, LOW);       */  This set of code tells the Arduino to turn on the 4th Number Display via &#8221;digitalWrite(pin3, HIGH);&#8221;   <br />
  digitalWrite(pin3, HIGH);            and tells it to light up which ever pins are HIGH. This displays the Number 0<br />
  digitalWrite(pin4, LOW);  <br />
  digitalWrite(pin5, LOW);<br />
  digitalWrite(pin6, HIGH);<br />
  digitalWrite(pin7, HIGH);<br />
  digitalWrite(pin8, HIGH);  <br />
  digitalWrite(pin9, LOW); <br />
  digitalWrite(pin10, HIGH);<br />
  digitalWrite(pin11, LOW); <br />
  digitalWrite(pin14, HIGH);<br />
  digitalWrite(pin15, HIGH);<br />
  digitalWrite(pin16, LOW);<br />
  digitalWrite(pin17, LOW);<br />
  digitalWrite(pin18, LOW);<br />
  digitalWrite(pin19, LOW);<br />
 <br />
  delay(1);<br />
 <br />
   digitalWrite(pin2, LOW);      */  This set of code tells the Arduino to turn on the 4th Number Display via &#8221;digitalWrite(pin18, HIGH);&#8221;  <br />
  digitalWrite(pin3, LOW);              and tells it to light up which ever pins are HIGH. This displays the Number 2<br />
  digitalWrite(pin4, LOW);  <br />
  digitalWrite(pin5, LOW);<br />
  digitalWrite(pin6, HIGH);<br />
  digitalWrite(pin7, LOW);<br />
  digitalWrite(pin8, HIGH);  <br />
  digitalWrite(pin9, HIGH); <br />
  digitalWrite(pin10, LOW);<br />
  digitalWrite(pin11, LOW); <br />
  digitalWrite(pin14, HIGH);<br />
  digitalWrite(pin15, HIGH);<br />
  digitalWrite(pin16, LOW);<br />
  digitalWrite(pin17, LOW);<br />
  digitalWrite(pin18, HIGH);<br />
  digitalWrite(pin19, LOW);<br />
 <br />
  delay(1);<br />
}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cdixon90.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cdixon90.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cdixon90.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cdixon90.wordpress.com&amp;blog=11937262&amp;post=3&amp;subd=cdixon90&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cdixon90.wordpress.com/2010/02/09/physical-computing-lab-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/296596631d88e11a5c234a3a207aec33?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cdixon90</media:title>
		</media:content>

		<media:content url="http://www.mindkits.co.nz/images/products/7-Segment%20Serial%20Display-600.jpg" medium="image" />
	</item>
	</channel>
</rss>
