<?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>Tony Blews &#187; Programming Bits</title>
	<atom:link href="http://www.tonyblews.co.uk/category/computers/programming-bits/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tonyblews.co.uk</link>
	<description>Jack of all, master of none</description>
	<lastBuildDate>Mon, 09 Jan 2012 23:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Vision of the Arduino Dalek</title>
		<link>http://www.tonyblews.co.uk/2010/11/vision-of-the-arduino-dalek/</link>
		<comments>http://www.tonyblews.co.uk/2010/11/vision-of-the-arduino-dalek/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 15:54:53 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Dalek]]></category>
		<category><![CDATA[Make Stuff]]></category>
		<category><![CDATA[Programming Bits]]></category>
		<category><![CDATA[Robots]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Toys]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[dalek]]></category>
		<category><![CDATA[infra-red]]></category>
		<category><![CDATA[ir sensor]]></category>

		<guid isPermaLink="false">http://www.tonyblews.co.uk/?p=996</guid>
		<description><![CDATA[Ok, so that post title isn&#8217;t based on a Doctor Who episode title. Sue me. Recently I&#8217;ve bought two Sharp GP2Y0A21YK Infrared Proximity Sensors from RoboSavvy. These little things can detect object in a range of 10cm to 80cm. So, the task now is to wire them up, and use them to detect when the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so that post title isn&#8217;t based on a Doctor Who episode title. Sue me.</p>
<p>Recently I&#8217;ve bought two <a href="http://robosavvy.com/store/product_info.php/cPath/27/products_id/320">Sharp GP2Y0A21YK Infrared Proximity Sensors from RoboSavvy</a>. These little things can detect object in a range of 10cm to 80cm.</p>
<div id="attachment_997" class="wp-caption aligncenter" style="width: 210px"><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/irsensor.jpg"><img class="size-full wp-image-997" title="irsensor" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/irsensor.jpg" alt="" width="200" height="155" /></a><p class="wp-caption-text">Here is one</p></div>
<p>So, the task now is to wire them up, and use them to detect when the Dalek get within 20 cm of an obstacle.</p>
<p>The circuitry is fairly easy. The Red wire goes to the 5v connection, the Black goes to GND, and the yellow wire goes to one of the Analogue inputs on the Arduno. I&#8217;m using pins A2 and A3, one for each sensor.</p>
<p>My soldering is, as ever, attrocious, so we&#8217;ll not have a picture of of that. Instead, here is a picture of the sensors Blu-Taked on to the front of the thing.</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/irmounted.jpg"><img class="aligncenter size-full wp-image-1001" title="irmounted" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/irmounted.jpg" alt="" width="300" height="212" /></a></p>
<p>And, as a bonus, a picture of the button that I&#8217;ve also fitted (and wired to Digital Pin 8).</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/dalekbutton.jpg"><img class="aligncenter size-full wp-image-1002" title="dalekbutton" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/11/dalekbutton.jpg" alt="" width="300" height="258" /></a></p>
<p>So, what we are going to do now is have the Dalek spin left if detects an obstable to the right, and spin right if it sees something to the left.</p>
<p>Also, if the button on the back is pressed, it will sleep for five seconds.</p>
<p>Portions of this code come from <a href="http://luckylarry.co.uk/arduino-projects/arduino-using-a-sharp-ir-sensor-for-distance-calculation/">Lucky Larry&#8217;s website</a>.</p>
<pre>// Project: Dalek control system
// Version 0.3 - IR Sernsors
// Tony Blews tony@tonyblews.co.uk

int ButtonPin       = 8;
int MotorDirectionR = 10;
int MotorDirectionL = 11;
int MotorPowerR     = 12;
int MotorPowerL     = 13;
int IRPinLeft       = 2;
int IRPinRight      = 3;

void setup()
{
 pinMode(MotorDirectionR, OUTPUT);
 pinMode(MotorDirectionL, OUTPUT);
 pinMode(MotorPowerR, OUTPUT);
 pinMode(MotorPowerL, OUTPUT);
 pinMode(ButtonPin, INPUT);    // declare pushbutton as input

 Serial.begin(9600);
 Serial.println("Serial control Dalek system starting...");

}

float check_distance(int IRpin) {
 float volts = analogRead(IRpin)*0.0048828125;   // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
 float distance = 30*pow(volts, -1.10);          // worked out from graph 65 = theretical distance / (1/Volts)S - luckylarry.co.uk
 return(distance);                               // http://luckylarry.co.uk/arduino-projects/arduino-using-a-sharp-ir-sensor-for-distance-calculation/     
}

// modes for the motor control
// convention here is modeXX - where X is F for forward, S for stationary and B for backwards
// first X is the left motor, second X is the right one
// for direction control, the LOW if forward and HIGH is backward
// for power control, LOW is off and HIGH is on

// all stop
void modeSS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,LOW);
}

// move straight ahead
void modeFF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// move straight backwards
void modeBB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// spin left
void modeBF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//spin right
void modeFB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//main program loop
void loop()
{
 if (digitalRead(ButtonPin) == HIGH)
 {
 modeSS();
 delay(5000); // sleep for 5 seconds if button pressed.
 }
 modeFF();
 if ((check_distance(IRPinLeft) &lt;20) &amp;&amp; (check_distance(IRPinLeft) &lt;20) )
 {
 //back up a bit
 modeBB();
 delay(1000);
 //rotate on spot for 2 sec (approx timing for 180 degrees)
 modeFB();
 delay(2000);
 }

 if (check_distance(IRPinLeft) &lt;20)
 {
 // rotate on spot for 1 second (approx timing for 90 degrees)
 modeFB();
 delay(1000);
 }
 if (check_distance(IRPinRight) &lt;20)
 {
 // rotate on spot for 1 second (approx timing for 90 degrees)
 modeBF();
 delay(1000);
 }
}
</pre>
<p>Video coming soon, I promise.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2010%2F11%2Fvision-of-the-arduino-dalek%2F&amp;title=Vision%20of%20the%20Arduino%20Dalek" id="wpa2a_2"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2010/11/vision-of-the-arduino-dalek/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Power of the Arduino Dalek</title>
		<link>http://www.tonyblews.co.uk/2010/09/power-of-the-arduino-dalek/</link>
		<comments>http://www.tonyblews.co.uk/2010/09/power-of-the-arduino-dalek/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 01:01:23 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Dalek]]></category>
		<category><![CDATA[Make Stuff]]></category>
		<category><![CDATA[Programming Bits]]></category>
		<category><![CDATA[Robots]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Toys]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[dalek]]></category>

		<guid isPermaLink="false">http://www.tonyblews.co.uk/?p=943</guid>
		<description><![CDATA[It has been a while since I&#8217;ve messed with the Dalek project, so this is just a brief update of the minor twiddling I&#8217;ve done. Firstly, the Dalek now has a USB Type B socket on the rear of the casing replacing one of the &#8220;Dalek Bumps&#8221;, as shown: Acquired from Maplin (part no N57FL), [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I&#8217;ve messed with the Dalek project, so this is just a brief update of the minor twiddling I&#8217;ve done.</p>
<p>Firstly, the Dalek now has a USB Type B socket on the rear of the casing replacing one of the &#8220;Dalek Bumps&#8221;, as shown:</p>
<div id="attachment_945" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/dalekusb.jpg"><img class="size-full wp-image-945" title="dalekusb" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/dalekusb.jpg" alt="" width="400" height="260" /></a><p class="wp-caption-text">USB B Socket, in place of Dalek Bump</p></div>
<p>Acquired from Maplin (part no <span class="capitals">N57FL</span>), this USB Panel Mount Socket is reversible, with a Type A socket on one side, and a Type B on the other.</p>
<p>As a PC generally has a Type A socket, and the Arduino I&#8217;m using has a Type B socket, I opted to have the Type B on the outside.</p>
<p>This will allow the use of a normal A-B cable to connect between the PC and the case socket, and require a short A-B cable to connect between the case socket and the Arduino (as having a 3m cable curled round inside the thing seems a bit stupid).</p>
<p>Sadly, getting a short USB A-B cable isn&#8217;t easy. So I had to chop up an existing cable and butcher it.</p>
<div id="attachment_948" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/usb-cable1.jpg"><img class="size-full wp-image-948" title="usb-cable1" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/usb-cable1.jpg" alt="" width="400" height="231" /></a><p class="wp-caption-text">All chopped and ready to solder</p></div>
<div id="attachment_949" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/usb-cable2.jpg"><img class="size-full wp-image-949" title="usb-cable2" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/usb-cable2.jpg" alt="" width="400" height="296" /></a><p class="wp-caption-text">Bad soldering hidden by about 50cm of tape</p></div>
<p>Now, the Arduino can be left inside the Dalek case, which can be screwed shut again.</p>
<p>However, when the Arduino isn&#8217;t connected via the USB link, it loses power (tenuous link to the title of the post). Luckily, the Arduino Duemilanove that I&#8217;m using has a 2.1mm socket, and will run from a 9v battery.</p>
<p>So we need a PP3 9V battery clip, and a 2.1mm DC power plug.</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/powerparts.jpg"><img class="aligncenter size-full wp-image-951" title="powerparts" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/powerparts.jpg" alt="" width="400" height="297" /></a></p>
<p>Solder the battery clip&#8217;s black wire to the outside connection of the plug, and solder the battery clip&#8217;s red wire to the centre connection of the plug.</p>
<p>For clearer instructions, and clearer pictures (I have a crap camera), see <a href="http://www.arduino.cc/playground/Learning/9VBatteryAdapter">the relevant page at Arduino Playground</a>.</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/powerlead.jpg"><img class="aligncenter size-full wp-image-952" title="powerlead" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/09/powerlead.jpg" alt="" width="400" height="208" /></a></p>
<p>The yellow tape is not being used to hide a massive solder disaster this time, but merely to keep the wires together.</p>
<p>So, now I have a Dalek with a battery pack for the motors (from the original casing), a battery pack for the Arduino (ok, a PP3 taped inside), and a USB socket on the casing.</p>
<p>Now it can be programmed, unplugged, and be left to trundle into things.</p>
<p>So here is some code to make it wait for five seconds,  spin right for one second, wait for two seconds, spin left for one second, and repeat for ever (or until the power is removed):</p>
<pre>// Project: Dalek control system
// Version 0.2 - Sit and spin
// Tony Blews tony@tonyblews.co.uk

int MotorDirectionR = 10;
int MotorDirectionL = 11;
int MotorPowerR     = 12;
int MotorPowerL     = 13;
long randNumber;

void setup()
{
 pinMode(MotorDirectionR, OUTPUT);
 pinMode(MotorDirectionL, OUTPUT);
 pinMode(MotorPowerR, OUTPUT);
 pinMode(MotorPowerL, OUTPUT);
   randomSeed(analogRead(0));

}

// modes for the motor control
// convention here is modeXX - where X is F for forward,
//S for stationary and B for backwards
// first X is the left motor, second X is the right one
// for direction control, the LOW if forward and HIGH is backward
// for power control, LOW is off and HIGH is on

// all stop
void modeSS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,LOW);
}

// spin left
void modeBF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//spin right
void modeFB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//main program loop
void loop()
{
delay (5000);
modeFB ();
delay (1000);
modeSS ();
delay(2000);
modeBF();
delay(1000);
modeSS();
}</pre>
<p>The next step will be to install some sensors.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 197px; width: 1px; height: 1px; overflow: hidden;">
<p><a class="cboxElement" title="USB Panel Mount Socket" rel="module" href="http://images.maplin.co.uk/full/n57fl.jpg"> </a></p>
<div id="ctl00_plcContentMain_BodyTop_updProgress" style="display: none;">
<div class="wait_wrapper">
<div class="please_wait">
<p><img class="wait_gif" src="http://maplin.co.uk/images/ajax-loader-blue.gif" alt="please wait animation" /></p>
<p class="wait_text">please wait&#8230;</p>
</div>
</div>
</div>
<div class="module_information">
<h1 class="module_item_title">USB Panel Mount Socket</h1>
</div>
</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2010%2F09%2Fpower-of-the-arduino-dalek%2F&amp;title=Power%20of%20the%20Arduino%20Dalek" id="wpa2a_4"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2010/09/power-of-the-arduino-dalek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genesis of the Arduino Dalek</title>
		<link>http://www.tonyblews.co.uk/2010/07/genesis-of-the-arduino-dalek/</link>
		<comments>http://www.tonyblews.co.uk/2010/07/genesis-of-the-arduino-dalek/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 01:36:15 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Dalek]]></category>
		<category><![CDATA[Make Stuff]]></category>
		<category><![CDATA[Programming Bits]]></category>
		<category><![CDATA[Robots]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Toys]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[dalek]]></category>

		<guid isPermaLink="false">http://www.tonyblews.co.uk/?p=850</guid>
		<description><![CDATA[As previously mentioned here, I was recently given a broken toy Dalek, which I promptly took apart (in the name of Science). Here it is before surgery commenced&#8230; Having stripped the thing down, I found inside two perfectly good electric motors, and when you find two working motors inside a toy there is only one [...]]]></description>
			<content:encoded><![CDATA[<p>As previously mentioned <a href="http://www.tonyblews.co.uk/2010/05/dalek-autopsy/">here</a>, I was recently given a broken toy Dalek, which I promptly took apart (in the name of Science).</p>
<p>Here it is before surgery commenced&#8230;</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-1.jpg"><img class="aligncenter size-full wp-image-852" title="dalek-1" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-1.jpg" alt="" width="400" height="300" /></a></p>
<p>Having stripped the thing down, I found inside two perfectly good electric motors, and when you find two working motors inside a toy there is only one thing to do: Work out how to use a computer to control them!</p>
<p>So, figuring out that the easiest way of doing this was with an <a href="http://arduino.cc/">Arduino</a>, I <a href="http://www.amazon.co.uk/gp/product/B003CR56MU?ie=UTF8&amp;tag=ukwatransit-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=B003CR56MU">bought one</a>.</p>
<p>I won&#8217;t bleat on about how good the Arduino is, or how easy it is to use. There are hundreds of sites that do that.</p>
<p>Instead, here is a list of things wot i dun to get a PC controlling the Dalek.</p>
<p>To start with, I think we&#8217;ll have a bit of circuit design. Below is a simple circuit that takes 2 inputs from the Arduino and runs a motor either forwards or backwards. One input decides the direction of the motor, the other whether it is on or off.</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/relay-circuit.jpg"><img class="aligncenter size-full wp-image-856" title="relay-circuit" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/relay-circuit.jpg" alt="" width="250" height="270" /></a></p>
<p>All very nice and abstract, but to be of any use it&#8217;ll need to be built. The quickest and easiest way is on Veroboard. So here is the design for that:</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/relay-vero.jpg"><img class="aligncenter size-full wp-image-858" title="relay-vero" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/relay-vero.jpg" alt="" width="250" height="236" /></a></p>
<p>The relays do the switching, and the diodes are there to protect the Arduino from back-emf currents when the relays toggle. Two of these circuits will be used, one for each motor. I built them on separate strips of board to make things easier for myself. This is what they look like when all connected up and dumped onto the Dalek chassis:</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-wired1.jpg"><img class="aligncenter size-full wp-image-860" title="dalek-wired1" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-wired1.jpg" alt="" width="400" height="300" /></a></p>
<p>The small board in the top left of the picture is just a plug I bodged up to make connecting the thing easier.</p>
<p>The parts used are 4x 1A5VDC DPDT relays, 4x 1N4004 diodes, a 10&#215;39 strip of Veroboard and some wires.</p>
<p>After all that soldering and burning my fingers, the next step is to write some code to make the thing move.</p>
<p>Each motor can be controlled to go backwards, forwards or stop. This gives nine possible movements, as this table shows:</p>
<p><a href="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-matrix.jpg"><img class="aligncenter size-full wp-image-865" title="dalek-matrix" src="http://www.tonyblews.co.uk/wordpress/wp-content/uploads/2010/07/dalek-matrix.jpg" alt="" width="200" height="170" /></a></p>
<p>And now its time to test this whole think by writing a program that takes keyboard commands (the letters in red, above) and sending signals to the circuitry to control the motors. Heres it is:</p>
<pre>// Project: Dalek control system
// Version 0.1 - Written before my Arduino even arrived
// Tony Blews tony@tonyblews.co.uk

int MotorDirectionR = 10;
int MotorDirectionL = 11;
int MotorPowerR     = 12;
int MotorPowerL     = 13;

void setup()
{
 pinMode(MotorDirectionR, OUTPUT);
 pinMode(MotorDirectionL, OUTPUT);
 pinMode(MotorPowerR, OUTPUT);
 pinMode(MotorPowerL, OUTPUT);

 Serial.begin(9600);
 Serial.println("Serial control Dalek system starting...");

}

// modes for the motor control
// convention here is modeXX - where X is F for forward, S for stationary and B for backwards
// first X is the left motor, second X is the right one
// for direction control, the LOW if forward and HIGH is backward
// for power control, LOW is off and HIGH is on

// all stop
void modeSS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,LOW);
}

// move straight ahead
void modeFF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// move straight backwards
void modeBB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// spin left
void modeBF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

//spin right
void modeFB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,HIGH);
}

// move forward left
void modeSF()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,LOW);
}

// move forward right
void modeFS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,HIGH);
}

// move backward left
void modeSB()
{
 digitalWrite(MotorDirectionR, HIGH);
 digitalWrite(MotorDirectionL, LOW);
 digitalWrite(MotorPowerR,HIGH);
 digitalWrite(MotorPowerL,LOW);
}

// move backward right
void modeBS()
{
 digitalWrite(MotorDirectionR, LOW);
 digitalWrite(MotorDirectionL, HIGH);
 digitalWrite(MotorPowerR,LOW);
 digitalWrite(MotorPowerL,HIGH);
}

//main program loop
void loop()
{
 if (Serial.available() &gt;0)
 {
 char inByte = Serial.read();
 // this version uses the QWEASDZXC "square" on the keyboard
 // as my laptop doesn't have a numeric keypad
 switch (inByte)
 {
 case 'q':
 modeSF();
 break;
 case 'w':
 modeFF();
 break;
 case 'e':
 modeFS();
 break;
 case 'a':
 modeBF();
 break;
 case 's':
 modeSS();
 break;
 case 'd':
 modeFB();
 break;
 case 'z':
 modeBS();
 break;
 case 'x':
 modeBB();
 break;
 case 'c':
 modeSB();
 break;
 default:
 modeSS();
 break;
 }
 }
}
</pre>
<p>And with that done, I suppose all that is left to do is show a video of the bottom bit of the dalek trundling around under computer control&#8230;</p>
<p>&#8230; which have to wait until the next post.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2010%2F07%2Fgenesis-of-the-arduino-dalek%2F&amp;title=Genesis%20of%20the%20Arduino%20Dalek" id="wpa2a_6"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2010/07/genesis-of-the-arduino-dalek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UK Waterways Site Ranking</title>
		<link>http://www.tonyblews.co.uk/2009/01/uk-waterways-site-ranking/</link>
		<comments>http://www.tonyblews.co.uk/2009/01/uk-waterways-site-ranking/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 04:11:09 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Canals]]></category>
		<category><![CDATA[Programming Bits]]></category>

		<guid isPermaLink="false">http://www.tonyblews.co.uk/?p=294</guid>
		<description><![CDATA[Ah while ago, a Mr. Andrew Denny of Granny Buttons bemoaned the lack of a UK specific site ranking chart for canal and waterways related blogs. So, I made one which tracks hits via a little image button thing like this&#8230; &#8230; then formats the results into a nice table. Furthermore, it is located at [...]]]></description>
			<content:encoded><![CDATA[<p>Ah while ago, a Mr. Andrew Denny of <a href="http://www.grannybuttons.com/">Granny Buttons</a> bemoaned the lack of a UK specific site ranking chart for canal and waterways related blogs.</p>
<p style="text-align: center;">So, I made one which tracks hits via a little image button thing like this&#8230;<br />
<a href="http://www.coobeastie.co.uk/ranking/index.php?id=2"><img class="aligncenter" src="http://www.coobeastie.co.uk/ranking/button.php?id=2&amp;log=no" alt="" width="110" height="30" /></a>&#8230; then formats the results into a nice table.</p>
<p>Furthermore, it is located at <a href="http://www.ukwrs.co.uk/ranking/">http://www.ukwrs.co.uk/ranking/</a></p>
<p>Right then&#8230;. next project?</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2009%2F01%2Fuk-waterways-site-ranking%2F&amp;title=UK%20Waterways%20Site%20Ranking" id="wpa2a_8"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2009/01/uk-waterways-site-ranking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Psycho Fireman</title>
		<link>http://www.tonyblews.co.uk/2008/08/psycho-fireman/</link>
		<comments>http://www.tonyblews.co.uk/2008/08/psycho-fireman/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 01:49:32 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[b3ta]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming Bits]]></category>
		<category><![CDATA[firemen]]></category>
		<category><![CDATA[rob manuel]]></category>

		<guid isPermaLink="false">http://tonyblews.co.uk/wordpress/?p=210</guid>
		<description><![CDATA[I couple of weeks ago I did some coding for Rob Manuel of b3ta fame, specifically the code to parse a wiki page and present the resulting data in a format usuable to a Flash application. Rob has used this to load in the levels to his &#8220;Psycho Fireman&#8221; game, a variation (blatant rip-off) of [...]]]></description>
			<content:encoded><![CDATA[<p>I couple of weeks ago I did some coding for <a href="http://www.robmanuel.com/">Rob        Manuel</a> of <a href="http://www.b3ta.com/">b3ta</a> fame, specifically        the code to parse a wiki page and present the resulting data in a format        usuable to a Flash application.</p>
<p>Rob has used this to load in the levels to his &#8220;<a href="http://www.b3ta.com/links/Wiki_puzzle_game">Psycho        Fireman</a>&#8221; game, a variation (blatant rip-off) of Sokoban.</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="333" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.robmanuel.com/psychofireman/psychofireman.swf" /><embed type="application/x-shockwave-flash" width="400" height="333" src="http://www.robmanuel.com/psychofireman/psychofireman.swf"></embed></object></p>
<p>Sadly, he suffered a terminal hard-drive crash shortly afterwards, so the game was never finished.<br />
All the game progress was documented <a href="http://www.e4.com/joystick/diary.html">here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2008%2F08%2Fpsycho-fireman%2F&amp;title=Psycho%20Fireman" id="wpa2a_10"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2008/08/psycho-fireman/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stafford Forum Image Host</title>
		<link>http://www.tonyblews.co.uk/2007/08/stafford-forum-image-host/</link>
		<comments>http://www.tonyblews.co.uk/2007/08/stafford-forum-image-host/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 08:03:10 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Programming Bits]]></category>
		<category><![CDATA[Stafford]]></category>

		<guid isPermaLink="false">http://www.tonyblews.co.uk/?p=296</guid>
		<description><![CDATA[Just a little note to announce that the image host and upload for Stafford Forum is finished. It lives at http://www.coobeastie.co.uk/staffordforumfiles/]]></description>
			<content:encoded><![CDATA[<p>Just a little note to announce that the image host and upload for <a href="http://www.staffordforum.com/">Stafford Forum</a> is finished.</p>
<p>It lives at <a href="http://www.coobeastie.co.uk/staffordforumfiles/">http://www.coobeastie.co.uk/staffordforumfiles/</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.tonyblews.co.uk%2F2007%2F08%2Fstafford-forum-image-host%2F&amp;title=Stafford%20Forum%20Image%20Host" id="wpa2a_12"><img src="http://www.tonyblews.co.uk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.tonyblews.co.uk/2007/08/stafford-forum-image-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

