<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2544121607701420693</id><updated>2012-02-16T15:23:19.591-08:00</updated><category term='dissertation'/><category term='dof'/><category term='laser cut'/><category term='vision'/><category term='servo'/><category term='wheelchair'/><category term='leg'/><category term='hexapod'/><category term='de montfort'/><title type='text'>practisevoodoo</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-324062634274777525</id><published>2011-12-28T13:07:00.001-08:00</published><updated>2011-12-28T13:14:31.617-08:00</updated><title type='text'>Kindle conversion</title><content type='html'>I got a Kindle for Christmas! (thanks Granny). However like many people I ran into the problem with converting .epub to .mobi where the converted files have huge margins on the left hand side of the screen. After some research I found a series of forum post suggesting various solutions but all of them were very manual processes and I wanted something that would just do it for me.&lt;br /&gt;&lt;br /&gt;So what I've got here is a simple shell script that does it all for you. You will need to install calibre since it uses the command line tools from that to do the actual conversion but it will automatically convert and sort the formatting out for you.&lt;br /&gt;&lt;br /&gt;I'll probably end up redoing it all in python so that it will work on windows.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;mkdir _temp&lt;br /&gt;mkdir converted&lt;br /&gt;&lt;br /&gt;for file in &amp;quot;$@&amp;quot;&lt;br /&gt;do&lt;br /&gt;    echo &amp;quot;Converting \&amp;quot;$file\&amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;    cp -f &amp;quot;$file&amp;quot; _temp/.&lt;br /&gt;&lt;br /&gt;    filename=$( echo &amp;quot;$file&amp;quot; &amp;#124; sed 's/^.*\///' )&lt;br /&gt;    file_type=$( echo &amp;quot;$filename&amp;quot; &amp;#124; sed 's/^.*\.//' )&lt;br /&gt;    new_file=$( echo &amp;quot;$filename&amp;quot; &amp;#124; sed 's/[^.]*$/mobi/' )&lt;br /&gt;&lt;br /&gt;    # if .epub&lt;br /&gt;    if [[ $file_type == &amp;quot;epub&amp;quot; ]]&lt;br /&gt;    then&lt;br /&gt;        # if the metadata is lacking language information then set it to en&lt;br /&gt;        lang_meta=$( ebook-meta &amp;quot;_temp/$filename&amp;quot; &amp;#124; egrep &amp;quot;^Language&amp;quot; )&lt;br /&gt;        if [[ !( -n &amp;quot;$lang_meta&amp;quot; ) ]]&lt;br /&gt;        then&lt;br /&gt;            echo &amp;quot;Changing metadata language&amp;quot;&lt;br /&gt;            ebook-meta -l en &amp;quot;_temp/$file&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;        fi&lt;br /&gt;&lt;br /&gt;        # edit the stylesheet to get rid of the massive gap on the left&lt;br /&gt;        unzip -f &amp;quot;_temp/$filename&amp;quot; stylesheet.css &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;        sed -i 's/margin-left:.*;/margin-left: 0;/g' stylesheet.css&lt;br /&gt;        zip &amp;quot;_temp/$filename&amp;quot; stylesheet.css &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;    fi&lt;br /&gt;    &lt;br /&gt;    ebook-convert &amp;quot;_temp/$filename&amp;quot; &amp;quot;_temp/$new_file&amp;quot; &amp;gt; /dev/null&lt;br /&gt;    #wine kindlegen &amp;quot;_temp/$filename&amp;quot;&lt;br /&gt;&lt;br /&gt;    mv -f &amp;quot;_temp/$new_file&amp;quot; converted/.&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;rm -r _temp&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-324062634274777525?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/324062634274777525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2011/12/kindle-conversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/324062634274777525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/324062634274777525'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2011/12/kindle-conversion.html' title='Kindle conversion'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-7122346506167641333</id><published>2011-02-14T06:06:00.000-08:00</published><updated>2011-02-14T06:13:55.982-08:00</updated><title type='text'>NXT and I2C</title><content type='html'>Lets face it I am a terrible blogger, but no one reads this anyway so who cares.&lt;br /&gt;&lt;br /&gt;Anyway recently I had some serious grief getting a Devantech CMPS03 digital compass to work with a Lego NXT. The info doesn't appear to be anywhere else on line and I couldn't find a decent I2C example in nxc.&lt;br /&gt;&lt;br /&gt;Here is some basic code showing how to get it working.&lt;br /&gt;&lt;br /&gt;#define cmpAddr 0xC0                            // Machine address of the compass&lt;br /&gt;#define cmpPort S1                            // Port that the compass is plugged in to&lt;br /&gt;&lt;br /&gt;byte bufLSWrite[] = {cmpAddr, 0x01, 0xC1};      // Written to the compass... (Compass, give me data from register 1, now)&lt;br /&gt;&lt;br /&gt;// Take a compass reading&lt;br /&gt;int compassReading()&lt;br /&gt;{&lt;br /&gt;    byte r;&lt;br /&gt;    byte outbuf[1];&lt;br /&gt;    byte byteNumber;&lt;br /&gt;    int result;&lt;br /&gt;    byteNumber = 1; // Read byte 1&lt;br /&gt;    &lt;br /&gt;    while (I2CCheckStatus(cmpPort) == STAT_COMM_PENDING);&lt;br /&gt;&lt;br /&gt;    if (I2CBytes(cmpPort, bufLSWrite, byteNumber, outbuf))&lt;br /&gt;    {  r = outbuf[0];&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {  r = -1;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    result = r;&lt;br /&gt;&lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;task main()&lt;br /&gt;{&lt;br /&gt;   int reading;&lt;br /&gt;   int counter = 0;&lt;br /&gt;&lt;br /&gt;   SetSensorLowspeed(cmpPort);&lt;br /&gt;&lt;br /&gt;   while( true )&lt;br /&gt;   {  reading = compassReading();&lt;br /&gt;      &lt;br /&gt;      NumOut( 1, LCD_LINE1, counter++, false );&lt;br /&gt;      NumOut( 1, LCD_LINE3, reading, false );&lt;br /&gt;      &lt;br /&gt;      Wait(1000);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This is actually just a stepping stone to getting the sensor to work via NXT++ from my netbook but I'll post that code later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-7122346506167641333?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/7122346506167641333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2011/02/nxt-and-i2c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/7122346506167641333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/7122346506167641333'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2011/02/nxt-and-i2c.html' title='NXT and I2C'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-8149059269100683181</id><published>2010-07-14T10:29:00.000-07:00</published><updated>2010-07-14T10:36:43.048-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dissertation'/><category scheme='http://www.blogger.com/atom/ns#' term='wheelchair'/><category scheme='http://www.blogger.com/atom/ns#' term='vision'/><category scheme='http://www.blogger.com/atom/ns#' term='de montfort'/><title type='text'>How's this for a project name, "The Doom chair"?</title><content type='html'>It's been a while and I will be posting details explaining just wtf this project actual is later but for the moment check out video of what I am working on at the moment.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/4LYyw1z0lJs&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/4LYyw1z0lJs&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-8149059269100683181?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/8149059269100683181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2010/07/hows-this-for-project-name-doom-chair.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/8149059269100683181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/8149059269100683181'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2010/07/hows-this-for-project-name-doom-chair.html' title='How&apos;s this for a project name, &quot;The Doom chair&quot;?'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-6183740336326470759</id><published>2009-09-04T09:08:00.000-07:00</published><updated>2011-02-14T06:06:12.631-08:00</updated><title type='text'>MCP42XXX digital potentiometer</title><content type='html'>It took me a while to figure out how to use the MCP42100 digital pot ic chips to work. Here is the code I use.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/* Control the MCP42XXX series of digital potentiometers. */&lt;br /&gt;class MCP42XXX&lt;br /&gt;{  protected:&lt;br /&gt;      byte ss;&lt;br /&gt;      byte clk;&lt;br /&gt;      byte mosi;&lt;br /&gt;&lt;br /&gt;      void spi_transfer( byte val )&lt;br /&gt;      {  int i;&lt;br /&gt;     &lt;br /&gt;         digitalWrite( this-&gt;clk, LOW );&lt;br /&gt;        &lt;br /&gt;         for( i=1; i&lt;=8; ++i )&lt;br /&gt;         {  if( val &gt; 127 )&lt;br /&gt;               digitalWrite( this-&gt;mosi, HIGH );&lt;br /&gt;            else&lt;br /&gt;               digitalWrite( this-&gt;mosi, LOW );&lt;br /&gt;              &lt;br /&gt;            digitalWrite( this-&gt;clk, HIGH );&lt;br /&gt;            val = val &lt;&lt; 1;&lt;br /&gt;            digitalWrite( this-&gt;clk, LOW );&lt;br /&gt;         }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;   public:&lt;br /&gt;      /* Set the ss (Slave Select), clk (clock) and&lt;br /&gt;           mosi (Master Output Slave Input) pins. */&lt;br /&gt;      MCP42XXX( byte ss, byte clk, byte mosi )&lt;br /&gt;      {  this-&gt;ss = ss;&lt;br /&gt;         this-&gt;clk = clk;&lt;br /&gt;         this-&gt;mosi = mosi;&lt;br /&gt;        &lt;br /&gt;         pinMode( this-&gt;ss, OUTPUT );&lt;br /&gt;         pinMode( this-&gt;clk, OUTPUT );&lt;br /&gt;         pinMode( this-&gt;mosi, OUTPUT );&lt;br /&gt;         digitalWrite( this-&gt;ss, HIGH );&lt;br /&gt;         digitalWrite( this-&gt;clk, HIGH );&lt;br /&gt;        &lt;br /&gt;         this-&gt;set( 2, 127 );&lt;br /&gt;      }&lt;br /&gt;     &lt;br /&gt;      /* Select the potentiometer to control and set the value.&lt;br /&gt;         If pot = 0 set value for potentiometer 0, if pot = 1 set&lt;br /&gt;         value for potentiometer 1, if pot = 2 set value for both&lt;br /&gt;         potentiometers.&lt;br /&gt;         val can go from 0 to 255. */&lt;br /&gt;      void set( byte pot, byte val )&lt;br /&gt;      {   byte pot_code;&lt;br /&gt;         &lt;br /&gt;          switch( pot )&lt;br /&gt;          {  case 0: pot_code = B00010001;&lt;br /&gt;                break;&lt;br /&gt;             case 1: pot_code = B00010010;&lt;br /&gt;                break;            &lt;br /&gt;             case 2: pot_code = B00010011;&lt;br /&gt;                break;            &lt;br /&gt;             default:&lt;br /&gt;                return;&lt;br /&gt;          };&lt;br /&gt;&lt;br /&gt;          digitalWrite( this-&gt;ss, LOW );&lt;br /&gt;         &lt;br /&gt;          this-&gt;spi_transfer( pot_code );&lt;br /&gt;          this-&gt;spi_transfer( val );&lt;br /&gt;         &lt;br /&gt;          digitalWrite( this-&gt;ss, HIGH );&lt;br /&gt;      }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-6183740336326470759?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/6183740336326470759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/09/mcp42xxx-digital-potentiometer.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6183740336326470759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6183740336326470759'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/09/mcp42xxx-digital-potentiometer.html' title='MCP42XXX digital potentiometer'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-6293948801380470751</id><published>2009-08-18T11:02:00.001-07:00</published><updated>2009-08-18T11:41:05.015-07:00</updated><title type='text'>Laziness</title><content type='html'>Well it's been a while since I posted, if I'm going to bugger off after only 6 posts I'm probably going to end up doing it again at some point. Anyways! have been working on projects even if I haven't been updating on them.&lt;br /&gt;&lt;br /&gt;So hexapod is on hold until I can get some beefier servos but have managed to get a hold of a power wheelchair at long last (I have been after one of these for a while). It's an old one so it doesn't have a 2nd joystick port on it so to get it controlable from an arduino/pc took some work.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_eIFInITLvXY/SortzoU9xMI/AAAAAAAAATM/h3fynKG1yLk/s1600-h/%21BWYf6gwCGk%7E%24%28KGrHgoOKi0EjlLmUvDqBK%28LjiKu4%21%7E%7E_12.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 239px;" src="http://4.bp.blogspot.com/_eIFInITLvXY/SortzoU9xMI/AAAAAAAAATM/h3fynKG1yLk/s320/%21BWYf6gwCGk%7E%24%28KGrHgoOKi0EjlLmUvDqBK%28LjiKu4%21%7E%7E_12.JPG" alt="" id="BLOGGER_PHOTO_ID_5371366976847201474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The control box is there on the left hand side, it was an old Dynamic which died shortly after I got it so I'm not going into the control system I tried to use since I can only assume I managed to kill the it.&lt;br /&gt;&lt;br /&gt;I managed to get a replacement though (don't know who made it).  The problem with this new one was that the arduino wasn't able to simulate the output from the joystick on its own.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_eIFInITLvXY/Sorxr-vLYDI/AAAAAAAAATU/IhBhXgmoMTs/s1600-h/P050809_19.08.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_eIFInITLvXY/Sorxr-vLYDI/AAAAAAAAATU/IhBhXgmoMTs/s320/P050809_19.08.JPG" alt="" id="BLOGGER_PHOTO_ID_5371371243470282802" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_eIFInITLvXY/Sorx25vAzyI/AAAAAAAAATc/1ltddsBBccc/s1600-h/P060809_20.40.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 320px;" src="http://4.bp.blogspot.com/_eIFInITLvXY/Sorx25vAzyI/AAAAAAAAATc/1ltddsBBccc/s320/P060809_20.40.JPG" alt="" id="BLOGGER_PHOTO_ID_5371371431105974050" border="0" /&gt;&lt;/a&gt;You can see that the joystick is just two potentiometers at right angles to each other, the difference with this 2nd setup is that the pots are positioned 45 degrees off the direction of travel. It means that each pot is in direct control of one of the motors, from my point of view it makes the code a lot easier. But the way that the rest of the control box uses the current flowing through the joystick means that the arduino can't do it on its own. In the end I decided to use a MCP42100 digital potentiometer ic to simulate the two potentiometers, that only left the problem of controlling the MCP.&lt;br /&gt;&lt;br /&gt;The MCP code was pretty easy once I got my head round it. It's an SPI bus device. Credit to http://little-scale.blogspot.com/2008/05/four-midi-controlled-digital-pots-via.html and http://www.arduino.cc/en/Tutorial/SPIDigitalPot.&lt;br /&gt;&lt;br /&gt;But here is the code.&lt;br /&gt;#define SS 2&lt;br /&gt;#define CLK 4&lt;br /&gt;#define MOSI 3&lt;br /&gt;&lt;br /&gt;byte pot0 = B00010001; // write to pot 0&lt;br /&gt;byte pot1 = B00010010; // write to pot 1&lt;br /&gt;byte pots = B00010011; // write to both&lt;br /&gt;&lt;br /&gt;void setup()&lt;br /&gt;{  Serial.begin( 9600 );&lt;br /&gt;&lt;br /&gt;  pinMode( SS, OUTPUT );&lt;br /&gt;  pinMode( CLK, OUTPUT );&lt;br /&gt;  pinMode( MOSI, OUTPUT );&lt;br /&gt;&lt;br /&gt;  digitalWrite( SS, HIGH );&lt;br /&gt;  digitalWrite( CLK, HIGH );&lt;br /&gt;&lt;br /&gt;  set_mcp_pot( pots, potval );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop()&lt;br /&gt;{  set_mcp_pot( pot0, 255 );&lt;br /&gt;  delay( 3000 );&lt;br /&gt;&lt;br /&gt;  set_mcp_pot( pot1, 255 );&lt;br /&gt;  delay( 3000 );&lt;br /&gt;&lt;br /&gt;  set_mcp_pot( pots, 0 );&lt;br /&gt;  delay( 3000 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void set_mcp_pot( byte pot, byte val )&lt;br /&gt;{  digitalWrite( SS, LOW );&lt;br /&gt;&lt;br /&gt;  spi_transfer( pot );&lt;br /&gt;  spi_transfer( val );&lt;br /&gt;&lt;br /&gt;  digitalWrite( SS, HIGH );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void spi_transfer( byte working )&lt;br /&gt;{  int i;&lt;br /&gt;&lt;br /&gt;  digitalWrite( CLK, LOW );&lt;br /&gt;&lt;br /&gt;  for( i=1; i&lt;=8; ++i )    {  if( working &gt; 127 )&lt;br /&gt;        digitalWrite( MOSI, HIGH );&lt;br /&gt;     else&lt;br /&gt;        digitalWrite( MOSI, LOW );&lt;br /&gt;      &lt;br /&gt;     digitalWrite( CLK, HIGH );&lt;br /&gt;     working = working &lt;&lt; 1;&lt;br /&gt;     digitalWrite( CLK, LOW );&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I have also managed to get it working with the digital compass to do the heading following that I wanted. I'll post that code later once I've checked the wheelchair batteries, I think they are having issues now....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-6293948801380470751?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/6293948801380470751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/08/laziness.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6293948801380470751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6293948801380470751'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/08/laziness.html' title='Laziness'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_eIFInITLvXY/SortzoU9xMI/AAAAAAAAATM/h3fynKG1yLk/s72-c/%21BWYf6gwCGk%7E%24%28KGrHgoOKi0EjlLmUvDqBK%28LjiKu4%21%7E%7E_12.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-6856914019549819991</id><published>2009-06-17T13:06:00.000-07:00</published><updated>2009-06-17T13:09:30.323-07:00</updated><title type='text'>So little time....</title><content type='html'>I'm going to get around to posting the laser plans for the hexapod and posting updates info on the compass project I swear but I have been having job interviews and visiting universities and just generally running around. &lt;br /&gt;Trust me driving to Plymouth from Brighton for an open day is not fun. Plymouth uni is doing some seriously scary cool stuff with robotics though, if you ever get a chance to check out their department, do.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-6856914019549819991?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/6856914019549819991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/06/so-little-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6856914019549819991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6856914019549819991'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/06/so-little-time.html' title='So little time....'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-6737212387508334772</id><published>2009-06-02T11:11:00.000-07:00</published><updated>2009-06-02T11:20:21.870-07:00</updated><title type='text'>Charlotte's Web</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/SiVsfzsjKnI/AAAAAAAAAQQ/A6tnaUjvdSw/s1600-h/DSC00892.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/SiVsfzsjKnI/AAAAAAAAAQQ/A6tnaUjvdSw/s320/DSC00892.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5342795826653768306" /&gt;&lt;/a&gt;&lt;br /&gt;So I finally got the parts to put the hexapod together, need to get some beefier servos to replace the lifting ones on this since these can only just manage it. Besides that one hicup it's going well. I need to tweek the design just the tiniest little bit and then I can post the files. The controller works fine too, I'm using a roboduino nano and that's hooked up to Texas Instruments TLC5940. The tlc5940 is a 16 channel pwn chip, mainly used for leds but it can run servos too, there is even a software library http://www.arduino.cc/playground/Learning/TLC5940.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-6737212387508334772?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/6737212387508334772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/06/charlottes-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6737212387508334772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/6737212387508334772'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/06/charlottes-web.html' title='Charlotte&apos;s Web'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_eIFInITLvXY/SiVsfzsjKnI/AAAAAAAAAQQ/A6tnaUjvdSw/s72-c/DSC00892.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-3409995216395420356</id><published>2009-05-23T12:27:00.000-07:00</published><updated>2009-05-23T12:43:42.741-07:00</updated><title type='text'>As the crow flies</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/ShhRdAZ_FKI/AAAAAAAAAPs/X0AuEgskL1A/s1600-h/P220509_10.18.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/ShhRdAZ_FKI/AAAAAAAAAPs/X0AuEgskL1A/s320/P220509_10.18.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5339106917014770850" /&gt;&lt;/a&gt;&lt;br /&gt;This is another one of the small projects that I have going at the moment (very, very early stages). In the picture is a Devantech CMPS03 on an arduino board. This is for my work with electric wheelchairs. I know some kids with severe physical disabilities, and the control interface for the wheelchairs leaves a lot to be desired. It is a one button interface, the wheelchair can only travel in certain pre-set directions. Since this control system doesn't allow you to correct for drift in the same way that the joystick does trying to travel in a straight line is impossible which is really annoying if you want to get anywhere. &lt;br /&gt;&lt;br /&gt;The idea is that I can use the digital compass to keep the wheelchair on a straight heading. I really want this to be something that I can just plug in between joystick and the motor driver, if the values coming from the joystick for the left and right motors are the same then the compass will correct for any drift. &lt;br /&gt;&lt;br /&gt;I'm using the wiring library from here http://www.grapelabs.de/index.php?id=52&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-3409995216395420356?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/3409995216395420356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/as-crow-flies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/3409995216395420356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/3409995216395420356'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/as-crow-flies.html' title='As the crow flies'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_eIFInITLvXY/ShhRdAZ_FKI/AAAAAAAAAPs/X0AuEgskL1A/s72-c/P220509_10.18.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-4878032472986767899</id><published>2009-05-19T03:06:00.000-07:00</published><updated>2009-05-19T03:19:13.422-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='leg'/><category scheme='http://www.blogger.com/atom/ns#' term='hexapod'/><category scheme='http://www.blogger.com/atom/ns#' term='servo'/><category scheme='http://www.blogger.com/atom/ns#' term='dof'/><category scheme='http://www.blogger.com/atom/ns#' term='laser cut'/><title type='text'>Hexapod leg</title><content type='html'>So after I had the rough plan for the legs done in the sintra board I got the first version of the design laser cut in 3mm arcylic. I was living near Brighton at this point so I used http://www.heritageinlay.com/&lt;br /&gt;&lt;br /&gt;The design wasn't quite right at this point, some of the pieces were too tight and the angle of the leg was off.&lt;br /&gt;&lt;br /&gt;I changed the design a bit and v2 of the leg should be ready soon.&lt;br /&gt;&lt;br /&gt;Each one of these legs is supposed to be 2DOF and have a ground contact sensor in the foot.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/ShKHDXMkH1I/AAAAAAAAAPk/Bq3vfoO7ppE/s1600-h/P010509_15.48%5B02%5D.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/ShKHDXMkH1I/AAAAAAAAAPk/Bq3vfoO7ppE/s320/P010509_15.48%5B02%5D.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337477000223530834" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_eIFInITLvXY/ShKG_v4oW0I/AAAAAAAAAPc/-GsBJUXmO5Y/s1600-h/P010509_15.48%5B01%5D.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://3.bp.blogspot.com/_eIFInITLvXY/ShKG_v4oW0I/AAAAAAAAAPc/-GsBJUXmO5Y/s320/P010509_15.48%5B01%5D.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337476938131331906" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_eIFInITLvXY/ShKG7yyR6AI/AAAAAAAAAPU/SPosJSbLgfk/s1600-h/P010509_15.48.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_eIFInITLvXY/ShKG7yyR6AI/AAAAAAAAAPU/SPosJSbLgfk/s320/P010509_15.48.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337476870190524418" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_eIFInITLvXY/ShKG4EkeKUI/AAAAAAAAAPM/MdeJLYN3fG4/s1600-h/P010509_15.47.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_eIFInITLvXY/ShKG4EkeKUI/AAAAAAAAAPM/MdeJLYN3fG4/s320/P010509_15.47.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5337476806244968770" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-4878032472986767899?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/4878032472986767899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/hexapod-leg.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/4878032472986767899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/4878032472986767899'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/hexapod-leg.html' title='Hexapod leg'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_eIFInITLvXY/ShKHDXMkH1I/AAAAAAAAAPk/Bq3vfoO7ppE/s72-c/P010509_15.48%5B02%5D.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-4831575615997494411</id><published>2009-05-18T09:41:00.000-07:00</published><updated>2009-05-18T09:56:35.096-07:00</updated><title type='text'>Hexapod</title><content type='html'>I've had quite a lot of free time recently so I decided to try and build a hexapod. Now I could have gone and bought a kit but that's cheating.&lt;br /&gt;&lt;br /&gt;I've been drawing the design in adobe illustrator.&lt;br /&gt;&lt;br /&gt;This first prototype was made out of 3mm pvc foamboard (also called sintra board). The bolts being used here are mainly m4 size and the servos are some cheap Accoms AS-17's that I got in bulk off ebay.&lt;br /&gt;&lt;br /&gt;My plan was to use an arduino and the software servo library to control a total of 13 servos. That gives me 6x 2DOF (Degrees Of Freedom) legs and a panning head for the ultrasonic distance sensor that I mean to use. As it turns out that plan sucked but more on that in later posts.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRidTJkNI/AAAAAAAAAOk/S1YE9DlBg6A/s1600-h/P150409_17.11%5B01%5D.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRidTJkNI/AAAAAAAAAOk/S1YE9DlBg6A/s320/P150409_17.11%5B01%5D.JPG" alt="" id="BLOGGER_PHOTO_ID_5337207054577275090" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRcP_eQaI/AAAAAAAAAOc/pYsTS9l9W3I/s1600-h/P150409_17.11.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRcP_eQaI/AAAAAAAAAOc/pYsTS9l9W3I/s320/P150409_17.11.JPG" alt="" id="BLOGGER_PHOTO_ID_5337206947925868962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRV3FviYI/AAAAAAAAAOU/M9QTxdl7XgI/s1600-h/P150409_17.10.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_eIFInITLvXY/ShGRV3FviYI/AAAAAAAAAOU/M9QTxdl7XgI/s320/P150409_17.10.JPG" alt="" id="BLOGGER_PHOTO_ID_5337206838162065794" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-4831575615997494411?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/4831575615997494411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/hexapod.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/4831575615997494411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/4831575615997494411'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/hexapod.html' title='Hexapod'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_eIFInITLvXY/ShGRidTJkNI/AAAAAAAAAOk/S1YE9DlBg6A/s72-c/P150409_17.11%5B01%5D.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2544121607701420693.post-3081444722943831671</id><published>2009-05-18T09:33:00.000-07:00</published><updated>2009-05-18T09:34:52.564-07:00</updated><title type='text'>In the beginning</title><content type='html'>This is really just a test posting, I plan to start posting details of my various electronics, programming and robotics projects in the future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2544121607701420693-3081444722943831671?l=practisevoodoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practisevoodoo.blogspot.com/feeds/3081444722943831671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/in-beginning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/3081444722943831671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2544121607701420693/posts/default/3081444722943831671'/><link rel='alternate' type='text/html' href='http://practisevoodoo.blogspot.com/2009/05/in-beginning.html' title='In the beginning'/><author><name>practisevoodoo</name><uri>http://www.blogger.com/profile/01741211846696772199</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
