<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Coding 4 Fun</title>
    <atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/coding4fun/rss"/>
    <generator>Rev9</generator>
    <description></description>
    <link>http://channel9.msdn.com/coding4fun/rss</link>
    <language>en</language>
  <item>
      <title>Connecting to the Kinect remotely with the Kinect Service</title>
      <description><![CDATA[<p>So this week we've learned about the Kinect and how to develop with it, we've read about the updated APIs and even some deployment tips.</p><p>Today, let's look at a new Coding4Fun Kinect project and one that could open up some very interesting ways to build awesome apps.</p><p>Image the Kinect (and PC) in one room and your app in another (room, building, state, country). Say something that can run on the machine that has the Kinect connected to it but send the camera, depth, skeleton and audio to an app running on another computer or device, like a Windows Phone 7...</p><p>You don't need to imagine, because there's the...</p><h2>Coding4Fun Kinect Service</h2><blockquote><p>The <strong>Coding4Fun Kinect Service</strong> allows you to stream Kinect color, depth, skeleton, and audio from one PC to another PC or a Windows Phone via sockets. Both server and client libraries are available to send and receive the data. Please review the included WPF and Windows Phone samples for a quick explanation of how to use the libraries. Also check out the <a href="http://kinectservice.codeplex.com/documentation">Documentation tab</a> for more information and sample usage.</p><p>This project requires the <a href="http://www.kinectforwindows.com/">Kinect for Windows SDK</a> v1.0. If you want to learn how to use the <a href="http://www.kinectforwindows.com/">Kinect for Windows SDK</a>, head over to the <a href="http://channel9.msdn.com/">Channel 9</a> and view the Quickstart series.</p><p>...</p></blockquote><p><strong>Project Information URL:</strong> <a title="http://kinectservice.codeplex.com/" href="http://kinectservice.codeplex.com/">http://kinectservice.codeplex.com/</a></p><p><strong>Project Download URL:</strong> <a title="http://kinectservice.codeplex.com/releases/view/81291" href="http://kinectservice.codeplex.com/releases/view/81291">http://kinectservice.codeplex.com/releases/view/81291</a></p><p><strong>Project Source URL:</strong> <a title="http://kinectservice.codeplex.com/SourceControl/list/changesets" href="http://kinectservice.codeplex.com/SourceControl/list/changesets">http://kinectservice.codeplex.com/SourceControl/list/changesets</a></p><p>Runs with v1? Yes</p><p><a href="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image%5B2%5D-83.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image_thumb-78.png" alt="image" width="186" height="384" border="0"></a></p><p>Here's the C# Solution;</p><p><a href="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image%5B11%5D-18.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image_thumb%5B3%5D-21.png" alt="image" width="405" height="230" border="0"></a></p><p>And the VB (yes, there's a full VB.Net version) Solution;</p><p><a href="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image%5B5%5D-55.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/image_thumb%5B1%5D-60.png" alt="image" width="409" height="226" border="0"></a></p><p>Here's a snip of code from the C# Phone Sample;</p><p><pre class="brush: csharp">void client_ColorFrameReady(object sender, ColorFrameReadyEventArgs e)
{
    if(e.ColorFrame.BitmapImage != null)
        this.Color.Source = e.ColorFrame.BitmapImage;
}

void client_DepthFrameReady(object sender, DepthFrameReadyEventArgs e)
{
    if(_outputBitmap == null)
    {
        this._outputBitmap = new WriteableBitmap(
            e.DepthFrame.ImageFrame.Width, 
            e.DepthFrame.ImageFrame.Height);

        this.Depth.Source = this._outputBitmap;
    }

    byte[] convertedDepthBits = this.ConvertDepthFrame(e.DepthFrame.DepthData, e);

    Buffer.BlockCopy(convertedDepthBits, 0, _outputBitmap.Pixels, 0, convertedDepthBits.Length);
    _outputBitmap.Invalidate();
}

void client_AudioFrameReady(object sender, AudioFrameReadyEventArgs e)
{
    _kinectSound.SubmitBuffer(e.AudioFrame.AudioData);

    if(_kinectSound.State != SoundState.Playing)
        _kinectSound.Play();
}

private void client_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
    Skeleton skeleton = (from s in e.SkeletonFrame.Skeletons
                             where s.TrackingState == SkeletonTrackingState.Tracked
                             select s).FirstOrDefault();

    if(skeleton == null)
        return;

    SetEllipsePosition(headEllipse, skeleton.Joints[(int)JointType.Head]);
    SetEllipsePosition(leftEllipse, skeleton.Joints[(int)JointType.HandLeft]);
    SetEllipsePosition(rightEllipse, skeleton.Joints[(int)JointType.HandRight]);
}

</pre></p><p>Contact Information:</p><ul><li>Blog: <a title="http://www.brianpeek.com/" href="http://www.brianpeek.com/">http://www.brianpeek.com/</a> </li><li>Twitter: <a href="https://twitter.com/#!/BrianPeek" target="_blank">@BrianPeek</a> </li></ul> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:3df5c84359fa43e3a8b19fee000e7bff">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/kinect/Connecting-to-the-Kinect-remotely-with-the-Kinect-Service</comments>
      <link>http://channel9.msdn.com/coding4fun/kinect/Connecting-to-the-Kinect-remotely-with-the-Kinect-Service</link>
      <itunes:summary>So this week we&#39;ve learned about the Kinect and how to develop with it, we&#39;ve read about the updated APIs and even some deployment tips.Today, let&#39;s look at a new Coding4Fun Kinect project and one that could open up some very interesting ways to build awesome apps.Image the Kinect (and PC) in one room and your app in another (room, building, state, country). Say something that can run on the machine that has the Kinect connected to it but send the camera, depth, skeleton and audio to an app running on another computer or device, like a Windows Phone 7...You don&#39;t need to imagine, because there&#39;s the...Coding4Fun Kinect ServiceThe Coding4Fun Kinect Service allows you to stream Kinect color, depth, skeleton, and audio from one PC to another PC or a Windows Phone via sockets. Both server and client libraries are available to send and receive the data. Please review the included WPF and Windows Phone samples for a quick explanation of how to use the libraries. Also check out the Documentation tab for more information and sample usage.This project requires the Kinect for Windows SDK v1.0. If you want to learn how to use the Kinect for Windows SDK, head over to the Channel 9 and view the Quickstart series....Project Information URL: http://kinectservice.codeplex.com/Project Download URL: http://kinectservice.codeplex.com/releases/view/81291Project Source URL: http://kinectservice.codeplex.com/SourceControl/list/changesetsRuns with v1? YesHere&#39;s the C# Solution;And the VB (yes, there&#39;s a full VB.Net version) Solution;Here&#39;s a snip of code from the C# Phone Sample;void client_ColorFrameReady(object sender, ColorFrameReadyEventArgs e)
{
    if(e.ColorFrame.BitmapImage != null)
        this.Color.Source = e.ColorFrame.BitmapImage;
}

void client_DepthFrameReady(object sender, DepthFrameReadyEventArgs e)
{
    if(_outputBitmap == null)
    {
        this._outputBitmap = new WriteableBitmap(
            e.DepthFrame.ImageFrame.Width, 
            e.DepthFrame.ImageF</itunes:summary>
      <pubDate>Thu, 09 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/kinect/Connecting-to-the-Kinect-remotely-with-the-Kinect-Service</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>coding4fun</category>
      <category>kinect</category>
  </item>
  <item>
      <title>Large Scale Terrain Rendering</title>
      <description><![CDATA[<p>Today's project is hard to apply a &quot;W&quot; name to, maybe we'll just call this &quot;Wow Wednesday&quot; and leave it at that, because once I got this project running, &quot;Wow, that's kind of cool&quot; was my first thought... <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif?v=c9' alt='Wink' /></p><h2><a href="http://www.codeproject.com/Articles/319399/Terrain-Rendering" target="_blank">Terrain Rendering</a></h2><blockquote><p>Terrain Rendering is a game technology code sample that demonstrates how to render large-scale terrains in real time by efficiently distributing the tasks between the CPU and the GPU. This article provides an overview of the terrain-rendering application and includes a link to the free code.</p><p><a href="http://bcove.me/mz986zms" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B3%5D-35.png" alt="image" width="480" height="270" border="0"></a></p><h4>Introduction</h4><p>This sample demonstrates how to render large-scale terrains on Intel® microarchitecture codename Sandy Bridge in real time by efficiently distributing the tasks between the CPU cores and the processor graphics unit. The sample pre-processes an input height map into a hierarchical quadtree representation which is used to render the terrain with adaptively selected level of detail (LOD). The adaptive simplified triangulation calculated during the pre-processing is compactly encoded to save runtime processing and memory space. LOD construction is asynchronously performed by the CPU cores while rendering is done by the processor graphics unit.</p><h4>Application</h4><p>Terrain Rendering is an application using DXUT and Microsoft DirectX* 11 with D3D_FEATURE_LEVEL_10_0. The application handles all rendering, user interaction and GUI. Upon initialization, the application loads all models, allocates resources and compiles shaders. On the first run, the application pre-calculates triangulation, which can take some time (up to one minute), and stores it on the disk. On subsequent runs, the application loads the data from the disk.</p><h4>Overview</h4><p>Terrain rendering demonstrates how to render large-scale terrains on Intel microarchitecture codename Sandy Bridge in real time by efficiently distributing the tasks between the CPU cores and the processor graphics unit. The terrain rendering can be optimized by constructing simplified triangulation, which is adaptive to the terrain surface characteristics. Such triangulation contains more primitives in sharp regions with high-frequency details and allocates a small number of large triangles for flat areas. This significantly reduces the total triangle count while providing almost the same visual quality (compare fig. 1 and 2).</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B6%5D-28.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B1%5D-41.png" alt="image" width="532" height="407" border="0"></a></p><p>Full-resolution triangulation (fig. 1) is more than 5x redundant compared to adaptive (fig. 2), which results in nearly 3x lower performance with almost the same visual quality.</p><p>Pre-computing adaptive triangulation is a complex and computation-intensive task. Doing this at runtime could require a significant amount of time and would lead to perceptible stalls or delays. To solve this problem, the application pre-computes adaptive triangulation for the whole terrain at the pre-process stage and stores the resulting data on the disk in a compact representation (see section 4). For example, the whole encoded triangulation for an 8192×8192 terrain consumes approximately 6 MB (compare this to 128 MB required to store the height map). At the runtime stage, this data is used to efficiently construct the triangulation.</p><p>...</p></blockquote><h2><a href="http://software.intel.com/en-us/articles/vcsource-samples-snb-terrain/?cid=sw:graphics341" target="_blank">SNB Terrain</a></h2><blockquote><p>This sample demonstrates how to render large-scale terrains on Intel® microarchitecture code name Sandy Bridge in real time by efficiently distributing the tasks between the CPU cores and the processor graphics unit. The input height map is preprocessed into a hierarchical quad tree representation which is used to render the terrain with adaptively selected level of detail (LOD). The adaptive simplified triangulation is compactly encoded to save runtime processing and memory space. LOD construction is asynchronously performed by the CPU cores while rendering is done by the processor graphics unit, which provides stable frame rate.</p><h4>System Requirements</h4><h6>Hardware:</h6><ul><li>CPU: Intel® Advanced Vector Extensions (Intel® AVX)-enabled x86 (Intel® microarchictecture code name Sandy Bridge or better suggested) </li><li>GFX: uses Microsoft DirectX* 11 graphics API on Microsoft DirectX* 10 (or better) hardware </li><li>OS: Microsoft Windows* 7 SP1 (for Intel AVX support) </li><li>MEM: 2 GB of RAM or better </li></ul><h6>Software:</h6><strong>Toolkits Supported:</strong> <ul><li>Microsoft DirectX* SDK (June 2010 release or later) </li><li>Microsoft Windows* SDK May 2010 </li></ul><strong>Compilers Supported:</strong> <ul><li>Microsoft Visual Studio* 2010 (Intel AVX support required) or <a href="http://software.intel.com/en-us/articles/c-compilers/">Intel® C&#43;&#43; Compiler version 11</a> </li></ul><strong>Libraries Required:</strong> <ul><li>Microsoft* C Run-Time Libraries (CRT) 2008/2010 </li></ul></blockquote><p>Getting this to compile and run on my notebook wasn't hard, once I got the <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812" target="_blank">DirectX SDK</a> installed. Here's some snaps of it running on my notebook;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLf5965%5B3%5D.png" target="_blank"><img title="SNAGHTMLf5965" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLf5965_thumb.png" alt="SNAGHTMLf5965" width="650" height="370" border="0"></a></p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLf7177%5B3%5D.png" target="_blank"><img title="SNAGHTMLf7177" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLf7177_thumb.png" alt="SNAGHTMLf7177" width="650" height="370" border="0"></a></p><p>Here's a snap of the Solution;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B10%5D-20.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B3%5D-27.png" alt="image" width="165" height="427" border="0"></a></p><p>So what good is this? I'm not really sure...lol. I just thought it was pretty cool and fun, to be able to &quot;fly&quot; around the terrain, to play with the settings and know that I've got the source for how it was generated. That said, the best part was the original <a href="http://www.codeproject.com" target="_blank">CodeProject</a> <a href="http://www.codeproject.com/Articles/319399/Terrain-Rendering" target="_blank">article</a> with the details and depth it went into. If you've ever wondered about terrain retendering, this is an article you might want to check out...</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:6bfb3050ac4d464a88269fed01474f2f">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/blog/Large-Scale-Terrain-Rendering</comments>
      <link>http://channel9.msdn.com/coding4fun/blog/Large-Scale-Terrain-Rendering</link>
      <itunes:summary>Today&#39;s project is hard to apply a &amp;quot;W&amp;quot; name to, maybe we&#39;ll just call this &amp;quot;Wow Wednesday&amp;quot; and leave it at that, because once I got this project running, &amp;quot;Wow, that&#39;s kind of cool&amp;quot; was my first thought... Terrain RenderingTerrain Rendering is a game technology code sample that demonstrates how to render large-scale terrains in real time by efficiently distributing the tasks between the CPU and the GPU. This article provides an overview of the terrain-rendering application and includes a link to the free code.IntroductionThis sample demonstrates how to render large-scale terrains on Intel&#174; microarchitecture codename Sandy Bridge in real time by efficiently distributing the tasks between the CPU cores and the processor graphics unit. The sample pre-processes an input height map into a hierarchical quadtree representation which is used to render the terrain with adaptively selected level of detail (LOD). The adaptive simplified triangulation calculated during the pre-processing is compactly encoded to save runtime processing and memory space. LOD construction is asynchronously performed by the CPU cores while rendering is done by the processor graphics unit.ApplicationTerrain Rendering is an application using DXUT and Microsoft DirectX* 11 with D3D_FEATURE_LEVEL_10_0. The application handles all rendering, user interaction and GUI. Upon initialization, the application loads all models, allocates resources and compiles shaders. On the first run, the application pre-calculates triangulation, which can take some time (up to one minute), and stores it on the disk. On subsequent runs, the application loads the data from the disk.OverviewTerrain rendering demonstrates how to render large-scale terrains on Intel microarchitecture codename Sandy Bridge in real time by efficiently distributing the tasks between the CPU cores and the processor graphics unit. The terrain rendering can be optimized by constructing simplified triangulation, which is ad</itunes:summary>
      <pubDate>Wed, 08 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/blog/Large-Scale-Terrain-Rendering</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>coding4fun</category>
  </item>
  <item>
      <title>Rob helps us migrate our Beta 2 code to work with v1</title>
      <description><![CDATA[<p>This wouldn't be a complete &quot;OMG, Kinect for Windows SDK v1 is out&quot; theme week if we didn't cover how to upgrade all your Beta2 projects to v1. Luckily Rob Relyea has us covered with an outstanding code migration series.</p><p>If you have, or download, beta 2 based code/project and it doesn't compile, one of your first stops should be this post collection.</p><h2>Kinect for Windows – Code Migration from Beta2 to v1.0 (C#/VB)</h2><blockquote><p>There have been a number of significant changes and improvements in our APIs since Beta2. This set of documents attempts to detail the changes to facilitate code migration from beta 2 to v1.</p><h3>API Change Details</h3><p>[these links take you to a seperate post with details]</p><ul><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#namespacesAssemblyName">Namespace and Assembly Name changes</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#kinectSensor">Runtime type (Rename to KinectSensor, refactoring)</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#colorImages">ColorImage API changes</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#depthImages">DepthImage API changes</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#skeletons">Skeleton API changes</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#mapping">Mapping API changes (Skeleton -&gt; Depth, Depth -&gt; Color)</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#audio">Audio API changes</a> </li><li><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed#speech">Speech API changes</a> </li></ul><h3>Adapting to API Changes</h3><p>In order to adapt to this change, C#/VB developers should:</p><ul><li>Backup code projects (if not using source control, such as TFS) </li><li>Uninstall Beta 2 SDK (including speech runtime 10.x components). </li><li>Install Kinect for Windows SDK v1. </li><li>Migrate code to use v1 APIs and best practices via one of the migration techniques below </li><li>If you need help with the answer, go the <a href="http://bit.ly/KinectSDKForums">Kinect for Windows forums</a>. Search for other similar issues first. If needed, create a new issue. Please prefix the title of the forum post with “Migration issue:”. (for example: “Migration Issue: Runtime.Sensors replacement?”) </li><li>If you figured out the answer, and want to suggest improvements to the details and techniques in these documents, please leave a comment (We generally will respond to that feedback, but won’t show the comments, as it may get unwieldy). </li></ul><h3>Where to go for help</h3><h3>Code Migration Techniques (C#/VB)</h3><p>There are three major approaches to migration</p><p>1) RECOMMENDED: Use a migration reference assembly to assist with learning about API changes</p><p>2) RECOMMENDED: Go back to the examples you may have started from, find the newest versions of those, and transfer your improvements to this new version.</p><p>3) NOT RECOMMENDED: Change reference assembly, (recompile -&gt; search for info -&gt; change -&gt; adapt -&gt; repeat)</p><p>...</p></blockquote><p><strong>Project Information URL:</strong> <a title="http://robrelyea.wordpress.com/2012/02/01/k4w-code-migration-from-beta2-to-v1-0-managed/" href="http://robrelyea.wordpress.com/2012/02/01/k4w-code-migration-from-beta2-to-v1-0-managed/">http://robrelyea.wordpress.com/2012/02/01/k4w-code-migration-from-beta2-to-v1-0-managed/</a></p><p><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed/" target="_blank"><img title="SNAGHTML7d6672" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/SNAGHTML7d6672%5B5%5D.png" alt="SNAGHTML7d6672" width="450" height="364" border="0"></a></p><p><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed/" target="_blank"><img title="SNAGHTML7dd432" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/SNAGHTML7dd432%5B5%5D.png" alt="SNAGHTML7dd432" width="299" height="364" border="0"></a></p><p><a href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed/" target="_blank"><img title="SNAGHTML7f0d5a" src="http://files.channel9.msdn.com/wlwimages/f1dda9cc6de74512b7c19f0101402403/SNAGHTML7f0d5a%5B5%5D.png" alt="SNAGHTML7f0d5a" width="320" height="364" border="0"></a></p><p>Contact Information:</p><ul><ul><li>Blog: <a title="http://robrelyea.wordpress.com/" href="http://robrelyea.wordpress.com/">http://robrelyea.wordpress.com/</a> </li><li>Twitter: <a href="https://twitter.com/#!/rrelyea" target="_blank">@rrelyea</a> </li></ul></ul> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:3fc09337f5c64730a9459fed016845c9">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/kinect/Rob-helps-us-migrate-our-Beta-2-code-to-work-with-v1</comments>
      <link>http://channel9.msdn.com/coding4fun/kinect/Rob-helps-us-migrate-our-Beta-2-code-to-work-with-v1</link>
      <itunes:summary>This wouldn&#39;t be a complete &amp;quot;OMG, Kinect for Windows SDK v1 is out&amp;quot; theme week if we didn&#39;t cover how to upgrade all your Beta2 projects to v1. Luckily Rob Relyea has us covered with an outstanding code migration series.If you have, or download, beta 2 based code/project and it doesn&#39;t compile, one of your first stops should be this post collection.Kinect for Windows – Code Migration from Beta2 to v1.0 (C#/VB)There have been a number of significant changes and improvements in our APIs since Beta2. This set of documents attempts to detail the changes to facilitate code migration from beta 2 to v1.API Change Details[these links take you to a seperate post with details]Namespace and Assembly Name changes Runtime type (Rename to KinectSensor, refactoring) ColorImage API changes DepthImage API changes Skeleton API changes Mapping API changes (Skeleton -&amp;gt; Depth, Depth -&amp;gt; Color) Audio API changes Speech API changes Adapting to API ChangesIn order to adapt to this change, C#/VB developers should:Backup code projects (if not using source control, such as TFS) Uninstall Beta 2 SDK (including speech runtime 10.x components). Install Kinect for Windows SDK v1. Migrate code to use v1 APIs and best practices via one of the migration techniques below If you need help with the answer, go the Kinect for Windows forums. Search for other similar issues first. If needed, create a new issue. Please prefix the title of the forum post with “Migration issue:”. (for example: “Migration Issue: Runtime.Sensors replacement?”) If you figured out the answer, and want to suggest improvements to the details and techniques in these documents, please leave a comment (We generally will respond to that feedback, but won’t show the comments, as it may get unwieldy). Where to go for helpCode Migration Techniques (C#/VB)There are three major approaches to migration1) RECOMMENDED: Use a migration reference assembly to assist with learning about API changes2) RECOMMENDED: Go back to the exa</itunes:summary>
      <pubDate>Wed, 08 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/kinect/Rob-helps-us-migrate-our-Beta-2-code-to-work-with-v1</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>coding4fun</category>
      <category>kinect</category>
  </item>
  <item>
      <title>When deploying Kinect apps, ensure the runtime, components and device are ready...</title>
      <description><![CDATA[<p>The second post in our &quot;Oh yeah, v1!&quot; week is a logical next step from yesterday's post...</p><p>Now that the Kinect for Windows SDK is in a v1 state and we can start officially deploying Kinect for Windows SDK based applications, one of the things we're going to be facing is just that, deployment and setup issues. Rob Relyea has kicked off helping us with just that, providing suggestions and tips...</p><h2>Kinect Apps – ensuring Kinect Runtime is installed</h2><blockquote><p>Kinect for Windows 1.0 enabled apps should ensure that the Kinect Runtime is installed wherever the app is installed.</p><p>[Note: <a href="http://kinectforwindows.org">Kinect for Windows</a> 1.0's latest public preview is beta 2. Parts of this blog post may be applicable to beta 2, but is primarily focused on the final v1.0 version, coming <a href="http://blogs.msdn.com/b/kinectforwindows/archive/2012/01/09/kinect-for-windows-commercial-program-announced.aspx">February 1st</a>. Since v1.0 is not yet released, information I give here may change when it does release. I also am filtering this information to ensure that I am not giving away details that we don't yet want to release.]</p><h4>Guidelines</h4><h5>App installers should install its dependencies, including Kinect Runtime – CRITICAL</h5><p>Kinect for Windows 1.0 will have a KinectRuntime-v1.0-Setup.exe that your app installer MUST chain install. In addition to installing Kinect specific software (drivers &#43; runtime), KinectRuntime-v1.0-Setup.exe will ensure the following dependencies are installed:</p><ul><li>VCRT x86 and/or x64 </li><li>.NET 4 client profile (or later 4.x versions like .NET 4.5) </li><li>Microsoft Speech Runtime v11 x86 and/or x64 </li></ul><h5>Running an app should provide a decent user experience if Kinect Runtime isn’t installed</h5><p>...</p></blockquote><p><strong>Project Information URL: <a title="http://robrelyea.wordpress.com/2012/01/11/kinect-apps-ensuring-kinect-runtime-is-installed/" href="http://robrelyea.wordpress.com/2012/01/11/kinect-apps-ensuring-kinect-runtime-is-installed/">http://robrelyea.wordpress.com/2012/01/11/kinect-apps-ensuring-kinect-runtime-is-installed/</a></strong></p><p><pre class="brush: csharp">public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            if (IsKinectRuntimeInstalled)
            {
                //go ahead and load the StartupUri as defined in App.xaml
                base.OnStartup(e);
            }
            else
            {
                MessageBox.Show(Assembly.GetExecutingAssembly().FullName &#43; &quot; is not able to excecute.&quot;
                &#43; &quot;An important dependency should have been installed by its setup program: Microsoft Kinect Runtime 1.0&quot;);
            }
        }

        public bool IsKinectRuntimeInstalled {
            get
            {
                bool isInstalled;
                try
                {
                    TestForKinectTypeLoadException();
                    isInstalled = true;
                }
                catch (FileNotFoundException)
                {
                    isInstalled = false;
                }
                return isInstalled;
            }
        }

        // This Microsoft.Kinect.dll based type, must be isolated in its own method
        // as the CLR will attempt to load the Microsoft.Kinect.dll assembly it when this method is executed.
        private void TestForKinectTypeLoadException()
        {
#pragma warning disable 219 //ignore the fact that status is unused code after this set.
            var status = KinectStatus.Disconnected;
#pragma warning restore 219
        }
    }
</pre></p><p>Contact Information:</p><ul><li>Blog: <a title="http://robrelyea.wordpress.com/" href="http://robrelyea.wordpress.com/">http://robrelyea.wordpress.com/</a> </li><li>Twitter: <a href="https://twitter.com/#!/rrelyea" target="_blank">@rrelyea</a> </li></ul> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:3e7574a6762c4642bcb19fed01515157">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/kinect/When-deploying-Kinect-apps-ensure-the-runtime-components-and-device-are-ready</comments>
      <link>http://channel9.msdn.com/coding4fun/kinect/When-deploying-Kinect-apps-ensure-the-runtime-components-and-device-are-ready</link>
      <itunes:summary>The second post in our &amp;quot;Oh yeah, v1!&amp;quot; week is a logical next step from yesterday&#39;s post...Now that the Kinect for Windows SDK is in a v1 state and we can start officially deploying Kinect for Windows SDK based applications, one of the things we&#39;re going to be facing is just that, deployment and setup issues. Rob Relyea has kicked off helping us with just that, providing suggestions and tips...Kinect Apps – ensuring Kinect Runtime is installedKinect for Windows 1.0 enabled apps should ensure that the Kinect Runtime is installed wherever the app is installed.[Note: Kinect for Windows 1.0&#39;s latest public preview is beta 2. Parts of this blog post may be applicable to beta 2, but is primarily focused on the final v1.0 version, coming February 1st. Since v1.0 is not yet released, information I give here may change when it does release. I also am filtering this information to ensure that I am not giving away details that we don&#39;t yet want to release.]GuidelinesApp installers should install its dependencies, including Kinect Runtime – CRITICALKinect for Windows 1.0 will have a KinectRuntime-v1.0-Setup.exe that your app installer MUST chain install. In addition to installing Kinect specific software (drivers &amp;#43; runtime), KinectRuntime-v1.0-Setup.exe will ensure the following dependencies are installed:VCRT x86 and/or x64 .NET 4 client profile (or later 4.x versions like .NET 4.5) Microsoft Speech Runtime v11 x86 and/or x64 Running an app should provide a decent user experience if Kinect Runtime isn’t installed...Project Information URL: http://robrelyea.wordpress.com/2012/01/11/kinect-apps-ensuring-kinect-runtime-is-installed/public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            if (IsKinectRuntimeInstalled)
            {
                //go ahead and load the StartupUri as defined in App.xaml
                base.OnStartup(e);
            }
            else
            {
   </itunes:summary>
      <pubDate>Tue, 07 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/kinect/When-deploying-Kinect-apps-ensure-the-runtime-components-and-device-are-ready</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>coding4fun</category>
      <category>kinect</category>
  </item>
  <item>
      <title>DPSF (Dynamic Particle System Framework) = Free particle library for XNA (Windows, XBox 360 and Windows Phone)</title>
      <description><![CDATA[<p>Last week's Mobile Monday we highlighted an open source/source available particle system/library for Windows Phone, <a href="http://channel9.msdn.com/coding4fun/blog/Where-theres-smoke-fire-and-explosions-theres-the-3D-particle-engine-Tranquility" target="_blank">Where there's smoke, fire and explosions... there's the 3D particle engine, Tranquility</a>, which can be used as is or as a basis for learning how to create a like library yourself.</p><p>This week we're highlighting another framework that while only available in binary form (through of course the demos and samples include their source) is also free, has been around a while longer, and has a much broader deployment reach, including not only Windows Phone 7, but also XBox 360, Windows and even the Zune!</p><h2><a href="http://www.xnaparticles.com/" target="_blank">DPSF (Dynamic Particle System Framework)</a></h2><blockquote><p>DPSF (Dynamic Particle System Framework) is a tried and tested, free <strong>programmer's</strong> tool for creating custom particle systems in <strong>XNA</strong> quickly and easily.</p><p>Incorporate particle effects into your project within a matter of minutes by using the provided Default Classes.</p><p>Unlike other particle system APIs / libraries, DPSF is flexible and allows you to code your own custom behaviors into the particle system; <strong>You are not limited to only using the parameters provided by the framework</strong>. You can create and control your own particle properties to make just about any effect you can imagine; If you can code it, you can create it in DPSF.</p><p>Upload particle systems you create to <a href="http://forums.xnaparticles.com">the DPSF forums</a> and download particle systems created by others.</p><p>Check out the <a href="http://www.xnaparticles.com/DemoVideos.php">demo videos</a> to see some of the things you can do with DPSF, or go ahead and <a href="http://www.xnaparticles.com/Download.php">download DPSF</a> and try it out for yourself.</p><p>If you use DPSF in your project, be sure to post a link to your project on the <a href="http://forums.xnaparticles.com">the DPSF forums</a>.</p><h4>Features</h4><p>Here is a list of some of the features DPSF provides:</p><ul><li>A single API for multiple platforms: supports 2D and 3D particles for Windows, Xbox 360, Windows Phone 7, and Zune. </li><li>Easily integrates with graphics engines, including <a href="http://www.synapsegaming.com">Synapse Gaming's SunBurn engine</a>. </li><li>Full API documentation is provided in the help file, as well as in the <a href="http://www.xnaparticles.com/DPSFHelp/index.html">online help documentation</a>. </li><li>Tutorials and their source code are provided in the installer. The tutorials (without source code) are also available in the <a href="http://www.xnaparticles.com/DPSFHelp/index.html">online help documentation</a>. </li><li>Allows particle systems to be created in minutes by using the Default Particle Systems provided; Just set values for the built-in parameters, such as position, velocity, acceleration, rotation, external force, start/end color, etc. </li><li>The Default Particle Systems may be extended, allowing you to provide any extra required functionality. Want your particles to have a weight property that determines how fast they accelerate? Or do you want your particles to follow a specific path or pattern? You can code the behavior to make it happen! </li><li>Templates to start from are provided to make creating new particle systems quick and easy. </li><li>You write the particle system code, giving you full control over the particle system and its particles, allowing you to create any type of particle system effects you desire. Your imagination is the limit. </li><li>Easy to integrate into existing projects; just add a reference to a dll file. </li><li>Use the built-in Effects (i.e. shaders) as well as custom Effects. </li><li>Modify the default Effect (i.e. shaders) to create new custom Effects quickly and easily. </li><li>Particle System Managers are provided to make updating and drawing many particle systems easy. </li><li>An Animations class is provided for easily creating animated particles. </li><li>Easily create a sequence of images, tile-sets, or animated gifs displaying particle system animations. </li><li>Particle systems may be implemented as DrawableGameComponents if required. </li></ul></blockquote><p>Check out these videos;</p><p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/ciuk6evv4_U&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ciuk6evv4_U&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p><p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JbW5edVNaRI&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/JbW5edVNaRI&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p><p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/HwMjyVB9EB4&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/HwMjyVB9EB4&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p><p>DPSF show's its maturity in a number of ways. First, there's good documentation.</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe85e490%5B3%5D.png" target="_blank"><img title="SNAGHTMLe85e490" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe85e490_thumb.png" alt="SNAGHTMLe85e490" width="634" height="407" border="0"></a></p><p>Secondly there's a nice set of tutorials;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B3%5D-34.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B1%5D-40.png" alt="image" width="387" height="161" border="0"></a></p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe8be00e%5B3%5D.png" target="_blank"><img title="SNAGHTMLe8be00e" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe8be00e_thumb.png" alt="SNAGHTMLe8be00e" width="614" height="407" border="0"></a></p><p>And finally the demo app is pretty awesome, showing off many of the capabilities of the framework. The demo ran for me the first time, with only a reference fix-up required;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B6%5D-27.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B2%5D-35.png" alt="image" width="222" height="407" border="0"></a></p><p>All I needed to do was point that DPSF reference to the folder where I installed the framework and all was well.</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B10%5D-19.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B4%5D-27.png" alt="image" width="312" height="382" border="0"></a></p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B16%5D-11.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B8%5D-13.png" alt="image" width="359" height="788" border="0"></a></p><p>One of my favorites (not sure why, maybe because the dog is cute...lol) is the Photo demo.</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe924fd0%5B3%5D.png" target="_blank"><img title="SNAGHTMLe924fd0" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe924fd0_thumb.png" alt="SNAGHTMLe924fd0" width="521" height="407" border="0"></a></p><p>This demo shows off some of the cool things that DPSF can do. From 3D features;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe933d79%5B3%5D.png" target="_blank"><img title="SNAGHTMLe933d79" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe933d79_thumb.png" alt="SNAGHTMLe933d79" width="521" height="407" border="0"></a></p><p>To different ways the photo can be &quot;particle'ized&quot;</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe9436c5%5B3%5D.png" target="_blank"><img title="SNAGHTMLe9436c5" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe9436c5_thumb.png" alt="SNAGHTMLe9436c5" width="521" height="407" border="0"></a></p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe9455f8%5B3%5D.png" target="_blank"><img title="SNAGHTMLe9455f8" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe9455f8_thumb.png" alt="SNAGHTMLe9455f8" width="521" height="407" border="0"></a></p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe946f80%5B3%5D.png" target="_blank"><img title="SNAGHTMLe946f80" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTMLe946f80_thumb.png" alt="SNAGHTMLe946f80" width="521" height="407" border="0"></a></p><p>And yes, you get the source for this demo and particle systems.</p><p>If you are looking around for a mature particle system, one with a price and license that's hard to beat, you run, not walk, and check out <a href="http://www.xnaparticles.com" target="_blank">DPSF</a>.</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:a5b7b656196a42a6be129fed0135fd61">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/blog/DPSF-Dynamic-Particle-System-Framework--Free-particle-library-for-XNA-Windows-XBox-360-and-Windows-P</comments>
      <link>http://channel9.msdn.com/coding4fun/blog/DPSF-Dynamic-Particle-System-Framework--Free-particle-library-for-XNA-Windows-XBox-360-and-Windows-P</link>
      <itunes:summary>Last week&#39;s Mobile Monday we highlighted an open source/source available particle system/library for Windows Phone, Where there&#39;s smoke, fire and explosions... there&#39;s the 3D particle engine, Tranquility, which can be used as is or as a basis for learning how to create a like library yourself.This week we&#39;re highlighting another framework that while only available in binary form (through of course the demos and samples include their source) is also free, has been around a while longer, and has a much broader deployment reach, including not only Windows Phone 7, but also XBox 360, Windows and even the Zune!DPSF (Dynamic Particle System Framework)DPSF (Dynamic Particle System Framework) is a tried and tested, free programmer&#39;s tool for creating custom particle systems in XNA quickly and easily.Incorporate particle effects into your project within a matter of minutes by using the provided Default Classes.Unlike other particle system APIs / libraries, DPSF is flexible and allows you to code your own custom behaviors into the particle system; You are not limited to only using the parameters provided by the framework. You can create and control your own particle properties to make just about any effect you can imagine; If you can code it, you can create it in DPSF.Upload particle systems you create to the DPSF forums and download particle systems created by others.Check out the demo videos to see some of the things you can do with DPSF, or go ahead and download DPSF and try it out for yourself.If you use DPSF in your project, be sure to post a link to your project on the the DPSF forums.FeaturesHere is a list of some of the features DPSF provides:A single API for multiple platforms: supports 2D and 3D particles for Windows, Xbox 360, Windows Phone 7, and Zune. Easily integrates with graphics engines, including Synapse Gaming&#39;s SunBurn engine. Full API documentation is provided in the help file, as well as in the online help documentation. Tutorials and their source code a</itunes:summary>
      <pubDate>Mon, 06 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/blog/DPSF-Dynamic-Particle-System-Framework--Free-particle-library-for-XNA-Windows-XBox-360-and-Windows-P</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>coding4fun</category>
      <category>windows-phone-7</category>
      <category>xbox+360</category>
  </item>
  <item>
      <title>Building the PIX-6T4 and writing a game for it too</title>
      <description><![CDATA[<p>Our Hardware Friday post returns us to the PIX-6T4, <a href="http://channel9.msdn.com/coding4fun/blog/The-PIX-6T4-kit-is-out" target="_blank">The PIX-6T4 kit is out...</a>, and a Friend of the Blog, <a href="http://10rem.net" target="_blank">Pete Brown</a>.</p><p>If you follow Pete, it probably won't surprise you to know he's gotten his hands on a PIX-6T4 and has shared his recent experience building the kit and writing his first &quot;real&quot; game for it.</p><h2><a href="http://10rem.net/blog/2012/01/21/assembling-the-pix-6t4-netduino-powered-hand-held-game-systEm" target="_blank">Assembling the PIX-6T4 Netduino-powered Hand-Held Game System</a></h2><blockquote><p>I recently picked up a PIX-6T4 build by Fabien Royer (with games by Fabien Royer and Bertrand Le Roy). This is a 64 pixel, two joystick/button, monophonic sound hand-held game device based around the Netduino Mini from Secret Labs. You create games in C# using Visual studio.</p><p>Disclaimer: I work for Microsoft and I enjoy working in the .NET Micro Framework as well as C&#43;&#43; on other microcontrollers. I purchased this product on my own, at full price; this is not a sample or review unit. Presumably, I got the same package of goodies everyone else gets.</p><h5>Unboxing</h5><p>The kit came in a regular USPS shipping box inside which were four bags. Two bags had components, and two had joysticks.</p></blockquote><p><a href="http://10rem.net/blog/2012/01/21/assembling-the-pix-6t4-netduino-powered-hand-held-game-systEm" target="_blank"><img title="SNAGHTML2327a52c" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/SNAGHTML2327a52c%5B4%5D.png" alt="SNAGHTML2327a52c" width="302" height="407" border="0"></a></p><p><a href="http://10rem.net/blog/2012/01/21/assembling-the-pix-6t4-netduino-powered-hand-held-game-systEm" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B3%5D-33.png" alt="image" width="517" height="407" border="0"></a></p><blockquote><h5>Conclusion</h5><p>I'm impressed with what Fabien has come up with here, and the stock games he and Bertrand have done are just perfect. I think the board and enclosure could use a little more design to make it more compact and also more hand-friendly, but overall, I think this is an excellent way to get into Netduino programming using something fun and exciting. Also, because of the display technology, you are constrained to creating games with very simple graphics (just LEDs) so, by necessity, you avoid that common barrier to entry. Sometimes constraint is a good thing.</p><p>Congratulations Fabien and Bertrand!</p></blockquote><h2><a href="http://10rem.net/blog/2012/01/22/my-first-real-pix-6t4-game-sixty4racer" target="_blank">My First Real PIX-6T4 Game: Sixty4Racer</a></h2><blockquote><p>After <a href="http://10rem.net/blog/2012/01/21/assembling-the-pix-6t4-netduino-powered-hand-held-game-system">assembling my Netduino-powered PIX-6T4</a>, I wanted to go and write a simple game. This post describes the construction of that game, including all source code.</p><h5>Concept</h5><p>When you have 64 monochrome red pixels, you need to keep the graphics simple. I decided on a game inspired by the classic <a href="http://www.bing.com/images/search?q=river&#43;raid&amp;qs=n&amp;sk=&amp;sc=8-3&amp;form=QBIR">Atari River Raid game</a>. This is essentially a vertical scrolling game where you need to dodge obstacles with your boat. Variations included things like <a href="http://www.bing.com/images/search?q=commodore&#43;spy&#43;hunter&amp;qs=n&amp;sk=&amp;sc=8-13&amp;form=QBIR">Spy Hunter on the C64</a> and many many others. Most of those games also involved shooting and enemies, but that's a but more complex than you can reasonably do on this board. I won't enable moving walls like <a href="http://www.bing.com/images/search?q=laser&#43;gates&#43;atari&amp;qs=n&amp;sk=&amp;form=QBIR">Laser Gates</a>, but I'll leave things open enough not to make it impossible to do that in the future.</p><p>The game had to be small enough that I could figure out the API, and then design, code, and blog about it in a single evening after my kids went to bed The PIX-6T4 is fun, but I have way too many projects on my backlog to be able to devote any significant<strong></strong> time to it (<em>here's a taste: a ShapeOko CNC mill, an AVR MIDI-&gt;CV Converter, the final touches on the MIDI Thru Box, several MFOS Synth Modules, Several Gadgeteer Board Concepts, a Win8 XAML book, chapters to review in my Silverlight 5 book, and much much more</em>). In fact, that was one of the <strong>big selling points of this device: simple gameplay and quick to develop for</strong>. Combined with the great library Fabien designed, and my past experience with Netduino and, more specifically, C#, and this should be an evening project.</p><h5>Screen Design</h5><p>Back in the 80s, in 7th grade, I used to design single-color sprites for the commodore 64. The sprites themselves were 3 bytes wide, with each pixel represented as a single bit in the byte. I used to define them on graph paper, but alas, the notebooks I filled with sprites and BASIC listings have long since disappeared.</p><p>...</p><p><a href="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image%5B7%5D-12.png" target="_blank"><img title="image" src="http://files.channel9.msdn.com/wlwimages/ae054c0b4d7b402ab1239e6800c0220f/image_thumb%5B2%5D-34.png" alt="image" width="670" height="162" border="0"></a></p><p>...</p><h5>First Iteration: Creating the scrolling playfield</h5><p>I called my project PeteBrown.Sixty4Racer. Just as in the previous post, I copied over the Program.cs file from another project and used that as the start. Please <a href="http://10rem.net/blog/2012/01/21/assembling-the-pix-6t4-netduino-powered-hand-held-game-system">read my previous post</a> to see what references you need and whatnot.</p><p>The first class I created was the one that manages the creation of the screens.</p><p>...</p><h5>Second Iteration: Adding in the player</h5><p>The PIX-6T4 libraries have built-in the concept of a PlayerMissile. This is a single pixel on the playfield. It may move, so it has X and Y speed. You can show or hide it, so it has Visibility. And most importantly, it has collision detection with other PlayerMissile instances. For our game, we're not going to use that, since we're looking for collision detection with the background. So, a little manual detection is in order.</p><p>...</p><h5>Third Iteration: Polishing</h5><p>The first thing I realized was that it was really hard to make out the player pixel in the sea of red. That's to be expected on a monochrome display at 8x8 resolution. The approach I came up with to make it a bit easier is to simply flicker the player pixel. Each time the game loop executes, I toggle the visibility of the ship PlayerMissile to give it a nice seizure-inducing flicker.</p><p>...</p><h5>Final Steps</h5><p>The final things to do are to create the manifest file and bitmap which will be used on the SD card. I'll need to check with Fabien to see what the exact format of the .bin file is, but I suspect it's just the 8 bytes of data formatted like all the other bitmap data in this application. I'm also not sure if he has a nice little app to write that data out, or convert from a bitmap, or something else. I ended up just using a hex editor to recreate the pattern from one of the images I created in the font editor.</p><p>...</p><h5>What You Can Do</h5><p>This came is completely free and open source. While I'd love credit for the initial work, it's not a requirement. Go ahead and do whatever you'd like with the source and have a blast <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p>Here's a video of the game in action.</p></blockquote><p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/10FzxWQTzzM&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/10FzxWQTzzM&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p><p>In short, if you have a hankering to get your soldering iron hot and build your own hand-held game console, one that you can also write your own games for, the <a href="http://nwazet.com/pix6t4" target="_blank">PIX-6T4</a>, and this guidance from Peter, has your name all over it...</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:e5e1e0b29f734aeb9e879fe601200177">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/blog/Building-the-PIX-64T-and-writing-a-game-for-it-too</comments>
      <link>http://channel9.msdn.com/coding4fun/blog/Building-the-PIX-64T-and-writing-a-game-for-it-too</link>
      <itunes:summary>Our Hardware Friday post returns us to the PIX-6T4, The PIX-6T4 kit is out..., and a Friend of the Blog, Pete Brown.If you follow Pete, it probably won&#39;t surprise you to know he&#39;s gotten his hands on a PIX-6T4 and has shared his recent experience building the kit and writing his first &amp;quot;real&amp;quot; game for it.Assembling the PIX-6T4 Netduino-powered Hand-Held Game SystemI recently picked up a PIX-6T4 build by Fabien Royer (with games by Fabien Royer and Bertrand Le Roy). This is a 64 pixel, two joystick/button, monophonic sound hand-held game device based around the Netduino Mini from Secret Labs. You create games in C# using Visual studio.Disclaimer: I work for Microsoft and I enjoy working in the .NET Micro Framework as well as C&amp;#43;&amp;#43; on other microcontrollers. I purchased this product on my own, at full price; this is not a sample or review unit. Presumably, I got the same package of goodies everyone else gets.UnboxingThe kit came in a regular USPS shipping box inside which were four bags. Two bags had components, and two had joysticks.ConclusionI&#39;m impressed with what Fabien has come up with here, and the stock games he and Bertrand have done are just perfect. I think the board and enclosure could use a little more design to make it more compact and also more hand-friendly, but overall, I think this is an excellent way to get into Netduino programming using something fun and exciting. Also, because of the display technology, you are constrained to creating games with very simple graphics (just LEDs) so, by necessity, you avoid that common barrier to entry. Sometimes constraint is a good thing.Congratulations Fabien and Bertrand!My First Real PIX-6T4 Game: Sixty4RacerAfter assembling my Netduino-powered PIX-6T4, I wanted to go and write a simple game. This post describes the construction of that game, including all source code.ConceptWhen you have 64 monochrome red pixels, you need to keep the graphics simple. I decided on a game inspired by the classic A</itunes:summary>
      <pubDate>Fri, 03 Feb 2012 14:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/blog/Building-the-PIX-64T-and-writing-a-game-for-it-too</guid>
      <dc:creator>Greg Duncan</dc:creator>
      <category>.net+micro+framework</category>
      <category>coding4fun</category>
  </item>
  <item>
      <title>Kinect Service</title>
      <description><![CDATA[<p>The <strong>Coding4Fun Kinect Service</strong> allows you to stream Kinect color, depth, skeleton, and audio from one PC to another PC or a Windows Phone via sockets. Both server and client libraries are available to send and receive the data.&nbsp; Please review the included WPF and Windows Phone samples for a quick explanation of how to use the libraries.&nbsp; Also check out the <a href="http://kinectservice.codeplex.com/documentation">Documentation tab</a> on CodePlex for more information and sample usage.</p><h2>WPF Sample Screenshots</h2><p><a href="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336814"><img title="Untitled" src="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336815" alt="Untitled" width="426" height="238" border="0"></a></p><h2>Windows Phone Sample Screenshots</h2><p><a href="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336926"><img title="3" src="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336927" alt="3" width="164" height="272" border="0"></a><a href="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336928"><img title="1" src="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336929" alt="1" width="164" height="272" border="0"></a><a href="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336930"><img title="2" src="http://download.codeplex.com/Download?ProjectName=kinectservice&amp;DownloadId=336931" alt="2" width="164" height="272" border="0"></a></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Project:RSSView:8c0d76e8ee8942c69f429feb0050b146">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/projects/Kinect-Service</comments>
      <link>http://channel9.msdn.com/coding4fun/projects/Kinect-Service</link>
      <itunes:summary>The Coding4Fun Kinect Service allows you to stream Kinect color, depth, skeleton, and audio from one PC to another PC or a Windows Phone via sockets. Both server and client libraries are available to send and receive the data.&amp;nbsp; Please review the included WPF and Windows Phone samples for a quick explanation of how to use the libraries.&amp;nbsp; Also check out the Documentation tab on CodePlex for more information and sample usage.WPF Sample ScreenshotsWindows Phone Sample Screenshots</itunes:summary>
      <pubDate>Thu, 02 Feb 2012 04:53:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/projects/Kinect-Service</guid>
      <dc:creator>Brian Peek</dc:creator>
      <category>kinect</category>
  </item>
  <item>
      <title>Netduino Controlled LED Cube</title>
      <description><![CDATA[<p>Commercial LED cubes have been around for a while now and can be quite large and capable of some <a href="http://www.seekway.com.cn/e/3d/h32/detail.htm">interesting displays</a>. This project is on a smaller scale and goes through the steps required to build a Netduino Mini-controlled 512 LED cube (8 x 8 x 8).</p><p>Clearly, the Mini does not have 512 pins and so we use <a href="http://en.wikipedia.org/wiki/Persistence_of_vision">Persistence of Vision</a> to control the LEDs in the cube. The result is that seven pins on the Netduino Mini can control 512 LEDs.</p><p>At the end of this article you should be able to create a cube capable of the following:</p><p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/FdpeC0GSRkM&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/FdpeC0GSRkM&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p><h3>Bill of Materials</h3><table class="MsoTableLightShadingAccent1" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td valign="top" width="308"><p class="MsoNormal"><span>Description</span></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>Quantity</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>LEDs (I chose blue)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>512</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>74HC595 Shift Registers</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>8</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>74HC238 3 to 8 line decoder</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>1</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>Netduino Mini</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>1</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>16 Pin DIL Socket (0.3&quot;)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>9</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>24 Pin DIL Socket (0.6&quot;)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>1</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>TIP122 NPN Transistor</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>8</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>100nF Ceramic Capacitor</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>10</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>2.2K Resistor</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>8</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>68 Ohm 0.25W Resistor (you may need to change these depending upon the LED you choose)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>64</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>8 Way Single Row Socket</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>9</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>36 Way Header Strip (Straight)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>3</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>2 Way Single Row Socket</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>2</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>2 Way PCB Mount Terminal Connector</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>1</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>8 Way Cable (ribbon or alarm)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>2.5m</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>Wire</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>Miscellaneous</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>Pad board 160 x 115 Hole</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>1</span></p></td></tr><tr><td valign="top" width="308"><p class="MsoNormal"><strong><span>Hex PCB spacer and screw (M3 threaded)</span></strong></p></td><td valign="top" width="143"><p class="MsoNormal" align="center"><span>4</span></p></td></tr></tbody></table><p><strong></strong>&nbsp;</p><p><strong>The following items are also required:</strong></p><ul><li>5V Power capable of delivering 2A </li><li>Solder (I used about 15 metres over the life of this project). </li><li>One 30cm x 30cm piece of wood </li><li>Drill and wood drill bits (4mm – 5mm) </li><li>Some cardboard and tape </li><li>A fair amount of patience </li><li>Good attention to detail </li></ul><p>You may need to shop around for the LEDs. I went to my preferred supplier and was quoted 18.5 pence each. By going on eBay I managed to negotiate the price down to 2.5 pence each including delivery. You are buying in bulk so don’t be afraid to ask for a good bulk price. Also, buy a few more than you need in case you have a faulty part or break a few.</p><h3>Building the Cube</h3><p>This is probably the most time consuming part of the project requiring a lot of patience and testing. The aim of the project is to convert these 512 blue LEDs:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B2%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb.png" alt="image" width="602" height="449" border="0"></a></p><p>Into this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B5%5D-3.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B1%5D-1.png" alt="image" width="602" height="615" border="0"></a></p><h4>Shaping the LEDs</h4><p>The exact dimensions of the cube depend upon the length of the legs on the LEDs. The legs are soldered together with the cathodes of the LEDs forming a horizontal plane and the anodes vertically connecting the layers. Each of the layers are configured into a common cathode display.</p><p>Take one of the LEDs and bend the cathode at a point as close to the body of the LED as possible. The cathode should be at 90 degrees to the anode and parallel to the flat base of the LED. This allows the horizontal legs to be soldered together to form the common cathode.</p><p>Shaping the anode is a little more difficult. The anodes connect the horizontal layers and so need to be shaped to ensure that each LED in the layer is directly above the corresponding LED in the layer below. Otherwise, each layer will be slightly offset from the one beneath it.</p><p>To achieve this, bend the anode in the opposite direction as described for the cathode. Then, still working with the anode, start about 2mm along the leg. Finally, bend the top 2-3mm through and fashion an angle at 90 degrees pointing back to the LED body. The end result should look like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B8%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B2%5D-3.png" alt="image" width="624" height="526" border="0"></a></p><p>The horizontal leg is the cathode and the vertical leg is the anode. When these are connected it should look like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B11%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B3%5D-4.png" alt="image" width="520" height="864" border="0"></a><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B14%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B4%5D-1.png" alt="image" width="248" height="864" border="0"></a></p><p>Notice how the shaped anode allows the LEDs to be placed above each other.</p><p>Now repeat this process for the remaining 511 LEDs.</p><h4>Building a Layer</h4><p>Our next task is to connect the LEDs together. This is best achieved by using a template for the individual layers. Use a piece of wood with a grid of holes drilled into it as the template.</p><p>Measure the distance from the center of the now horizontal cathode to the end of the leg and subtract about 2mm. This will tell you how far apart the LEDs are in the horizontal plane. The 2mm will be used to overlap with the neighboring LED and will connect the cathodes. Now drill an 8 x 8grid of holes, each of which are distance of your choosing apart.&nbsp; Here they are 20mm apart.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B17%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B5%5D.png" alt="image" width="381" height="380" border="0"></a></p><p>The holes need to be large enough to hold the LEDs securely but should not be so small that the LEDs are wedged into the hole and difficult to remove.</p><p>Take eight of the LEDs and place them along the top row with the cathodes all pointing to either the right or the left. If all are pointing to the right, the cathodes of seven LEDs will overlap slightly with the next LED to the right. The rightmost cathode will go off into space. Solder the cathodes together.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B20%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B6%5D-2.png" alt="image" width="624" height="84" border="0"></a></p><p>Now let’s add the remaining LEDs in the layer. I started on the left because I hold the soldering iron in my right hand. Take another seven LEDs and place these under the top row and down the far left column. The cathode of each first LED should overlap the cathode of the LED in the top layer. Solder these together.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B23%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B7%5D-1.png" alt="image" width="624" height="394" border="0"></a></p><p>Repeat with the remaining columns. At this point, you should have a horizontal row of LEDs connected together with eight strings of seven LEDs hanging from it. Eventually you should have something looking like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B26%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B8%5D-4.png" alt="image" width="624" height="468" border="0"></a></p><p>Now test the layer using a power supply and current limiting resistor. A 5V supply and a 68 Ohm resistor are adequate. Ground the cathode of the LED pointing off into space. Now touch each leg of the LEDs in turn with the positive output of the supply (through the current limiting resistor, of course). Each LED should light up and as you touch the anode.</p><p>One final bit of soldering is needed to add a stiffening wire to the layer. Cut and strip a piece of wire. The wire should be long enough to cross the entire layer. Place the stripped wire on the cathodes of the LEDs at the bottom of the string and solder it on to each.</p><p>At this point you will have one complete layer. Remove the layer from the template. This should be done carefully so that you do not put too much stress on the joints. Gently lifting it up with a screwdriver should help. Don’t hurry. Put this layer to one side and repeat another seven times.</p><h4>Connecting the Layers - The Cube Appears</h4><p>Now that all of the layers are built, test them again. This repeated test may save you future pain. Just imagine how difficult it will be to fix a bad joint in the middle of the cube. Check that the LEDs are still connected and none of the joints were broken when layers were removed from the template.</p><p>Now drop one of the layers back into the template. What we now need to do is to place a second layer on top of the first so that the anodes of the layer in the template touch the anodes of the LEDs in the upper layer. Once in place, we need to solder the anodes together, and so need a way of supporting the top layer whilst connecting the LEDs. A strip of cardboard can accomplish this. Cut the cardboard into strips (making sure the cardboard is the height needed to support the layer) and bind the strips together with tape. Two of these strips should be enough to support the layer. Here’s how it looked when several layers had already been connected:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B29%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B9%5D.png" alt="image" width="624" height="631" border="0"></a></p><p>Now that you have the layer supported, solder the anode of each LED in the top layer to the anode of the corresponding LED in the layer directly beneath it. Once this has been done, test each LED. Connect the cathode of the bottom layer to ground and touch each of the legs on the top layer in turn with the positive supply (going through the current limiting resistor). The LED on the bottom layer should light up. Repeat for each LED in the layer. Move the cathode to the top layer and repeat the test—this time the LED on the top layer should light. Again, repeat for each LED in the layer.</p><p>Now add the remaining layers. Just for safety, test every layer in the cube as it is built up. This repeated testing sounds like a big pain, but trust me it's worth it. At this point you will have a cube of LEDs looking something like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B32%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B10%5D-3.png" alt="image" width="624" height="650" border="0"></a></p><p>Now trim the cathodes that are still flying off into space.</p><h3>Building the Controller Board</h3><p>The controller board will allow any of the 512 LEDs in the cube to be turned on by a Netduino Mini using only seven pins.</p><h4>Persistence of Vision</h4><p>Connecting the anode to a positive supply while grounding the layer in which the LED is located can turn on any LED. You can also do this with more than one LED in a layer, and so within a layer can turn on 0 to 64 LEDs. To light the entire cube, we need to switch on each layer in turn while doing so fast enough to give the impression of static image. This is where the principle of <a href="http://en.wikipedia.org/wiki/Persistence_of_vision">Persistence of Vision</a> comes into play.</p><p>The basic algorithm is as follows:</p><ul><li><em>Layer</em> = 0 </li><li>Repeat <ul><li>Connect the anodes of the desired LEDs in <em>Layer</em> to positive supply </li><li>Connect <em>Layer</em> to ground (this turns the layer on) </li></ul></li><li>Move to next <em>Layer</em> </li></ul><p>If we do this fast enough, the human eye will see a single image as when watching TV or a movie.</p><p>Our basic building blocks for the controller are as follows:</p><ul><li>Microcontroller (a Netduino Mini) to run the whole show </li><li>Hardware to select the layer to be turned on (74HC238 and TIP122 transistors) </li><li>Hardware to turn on the LEDs (Shift registers) </li></ul><h4>Shift Registers</h4><p>The shift registers determine which LEDs are turned on. The board has a series of eight cascaded 74HC595 registers. This allows us to control 64 LEDs (8 chips x 8 outputs). The following schematic shows how two of these registers should be wired together:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B38%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B12%5D-2.png" alt="image" width="624" height="498" border="0"></a></p><p>The above should be repeated until you have eight shift registers cascaded.</p><p>The output from the register is 5V and will give more than enough power to burn out an LED, so we need to put a <a href="http://en.wikipedia.org/wiki/LED_circuit">current limiting resistor</a> in the circuit. A 68 Ohm resistor is required for the LEDs in this project—make sure you verify the value you choose against the LEDs used.</p><p>Putting this together gives the following layout:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B41%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B13%5D.png" alt="image" width="624" height="373" border="0"></a></p><p>Each socket holds a 74HC595 shift register. The connections are identical for each register with the data cascaded into the next register. So if we look at the bottom left socket you will see the following:</p><ul><li>Below the socket there is a connector that allows the output to be connected to the LEDs in the cube. </li><li>Above the connector are the resistors that limit the current flowing through the LEDs. </li><li>The socket above that will hold the 74HC595 shift register. </li><li>To the left of the socket is a 100nF capacitor. This smooths out the power supplied to the shift register and is connected between the power input and ground and placed as close to the IC as possible. </li></ul><p>The following colors have been used:</p><ul><li>Red = Power </li><li>Blue = SPI and cascaded data </li><li>Yellow = RCK </li><li>White = SPI clock </li></ul><p>Note that the connectors and current limiting resistor are slightly offset as output 0 is on pin 15 and this is routed on the underside of the board. The remaining connections are a direct one to one path from the pin to the resistor/connector.</p><p>The microcontroller uses the <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">Serial Peripheral Interface</a> (SPI) bus to tell the shift registers which LED to turn on. The data from the registers is cascaded and so we can store 64 bits of information (1 bit for each LED in a layer). With logic 1 turning a particular LED on and 0 turns the LED off.</p><h4>Layer Switching</h4><p>The layer switching logic allows the controller to connect any one of the layers to ground (using a common cathode). Coupling this with the LED selection logic above allows us to turn on any one of the LEDs in the cube. This is achieved by using a transistor as a switch. The TIP122 was selected because it is capable of sinking 2A. This may seem like a lot considering the 25mA for each LED, but remember that we potentially have 64 LEDs being turned on at once. This means we may be drawing 1.6A of current. If you use a different LED, you will need to verify that the shift registers, power supply, and the transistor are capable of dealing with the amount of power you will be drawing.</p><p>The schematic for the layer switching looks like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B44%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B14%5D-2.png" alt="image" width="624" height="468" border="0"></a></p><p>The 74HC238 has three input signals. These represent a binary number 0-7. The chip converts this number into eight output lines. 0 turns on line 0, 1 turns on line 1 etc. The output from each line (0 through 7) is then fed in the base of a TIP122 transistor. This turns on the appropriate layer by connecting the layer through to ground.</p><p>One line for the Netduino Mini controls enable line on the 72HC238 chip. This allows us to turn all of the outputs off whilst a new value is being loaded into the chip. This line is used to make sure that the transitions between the states are “invisible.” Without this there is the chance that the viewer may see a flickering effect when new values are loaded into both the 74HC595s and the 74HC238.</p><h4>The Completed Controller Board</h4><p>The completed controller board looks something like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B47%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B15%5D.png" alt="image" width="624" height="491" border="0"></a></p><p>Note that there are a pair of connectors to the top right and bottom left of the Netduino Mini. The pair at the top right breakout the COM1 port. The two at the bottom left allow grounding of an FTDI lead (connected to the controller board) and also one socket that is not connected. This allows the 5V lead on the FTDI connector to have a place to live and not be in danger of touching something it shouldn’t.</p><p>And on the underside:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B50%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B16%5D.png" alt="image" width="624" height="444" border="0"></a></p><h4>Connecting the Cube and Controller</h4><p>The final task (from a hardware point of view) is to connect the cube to the controller board. I tried both ribbon cable and alarm cable. The alarm cable was a little more difficult to connect but was flexible. The ribbon cable was easier to work with but was not as flexible. The principle is the same whichever you chose.</p><p>Place the cube on a flat surface (the anodes touching the surface) with one face of the cube facing you. The connections should be made so that the lower back left corner is co-ordinate (0, 0, 0). The co-ordinates increase moving to the right, towards you and up. So looking at the controller board above, shift register 0 connects to the LEDs farthest away from you with output 0 from the register connecting to the LED to the far left. Cut and make the 8 cables according to this pattern varying the lengths to suit the location of the controller board with respect to the cube. Each cable will need a single eight-way socket on one end with the other end connected to the appropriate LED.</p><p>The layer selection logic should be connected using a similar cable. Each layer should be connected to a TIP122 with layer 0 being the bottom layer.</p><p>The cube will then look like this:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B53%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B17%5D-1.png" alt="image" width="624" height="587" border="0"></a></p><p>Connecting it up to the controller:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B56%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B18%5D.png" alt="image" width="624" height="346" border="0"></a></p><p>I found it easier to be consistent and wire each plug and LED identically, and so all of the connections above have a black wire to the right of the connector. It helps with connecting things up later.</p><p>If we have everything connected then we only need one more thing...</p><h3>Software</h3><p>The software running the cube needs to perform two main tasks:</p><ul><li>Work out which LEDs are turned on </li><li>Run the display (cube) </li></ul><p>These two tasks need to be performed at the same time (or so fast that they appear to run at the same time). Luckily the .NET Micro Framework has a built in mechanism to allow us to do this—threading. Threading allows us to do this by running two tasks interleaved. So task 1 will run for a while, the system will then switch and run task 2 for a while, then back to task 1 and so on.</p><p>To do this, the software is split into two parts, the main program that decides what to display and a separate class that runs the display.</p><h4>LEDCube Class</h4><p>This class has only one purpose in life, to output data to the controller board and so “run” the display. It is a relatively simple class containing the following methods:</p><ul><li>Constructor </li><li>Buffer update method </li><li>Display Buffer method </li></ul><p>The constructor sets everything up by instantiating an instance of the SPI class and setting the buffer (which contains the data to be displayed) to be empty, effectively clearing the cube:</p><p><pre class="brush: csharp">public LEDCube()
{
    config = new SPI.Configuration(SPI_mod: SPI.SPI_module.SPI1,
                                   ChipSelect_Port: Pins.GPIO_PIN_20,
                                   ChipSelect_ActiveState: false,
                                   ChipSelect_SetupTime: 0,
                                   ChipSelect_HoldTime: 0,
                                   Clock_IdleState: true,
                                   Clock_Edge: true,
                                   Clock_RateKHz: 100);    spi = new SPI(config);
    buffer = new byte[64];
    for (int index = 0; index &lt; buffer.Length; index&#43;&#43;)
    {
        buffer[index] = 0;
    }
}</pre></p><p>The buffer is 64 bytes of data, 8 rows of 8 bytes. Each byte corresponds to a vertical layer in the cube.</p><p>The UpdateBuffer method allows the calling program to change what is displayed in the cube. A little control is needed here to ensure that the pattern displayed in the cube is consistent, and so locking is used to ensure that the buffer cannot be updated part way through a display cycle:</p><p><pre class="brush: csharp">public void UpdateBuffer(byte[] newValues)
{
    lock (buffer)
    {
        for (int index = 0; index &lt; buffer.Length; index&#43;&#43;)
        {
            buffer[index] = newValues[index];
        }
    }
} </pre></p><p>The final method in this class is the method spawned off into it’s own thread:</p><p><pre class="brush: csharp">public void DisplayBuffer()
{
    while (true)
    {
        lock (buffer)
        {
            byte[] displayData = new byte[8];            for (int row = 0; row &lt; 8; row&#43;&#43;)
            {
                int offset = row * 8;                for (int index = 0; index &lt; 8; index&#43;&#43;)
                {
                    displayData[index] = buffer[offset &#43; index];
                }                enable.Write(true);
                bit0.Write((row &amp; 1) != 0);
                bit1.Write((row &amp; 2) != 0);
                bit2.Write((row &amp; 4) != 0);
                spi.Write(displayData);
                enable.Write(false);
            }
        }
    }
}</pre></p><p>This method again uses the lock statement to lock the buffer. This means we cannot update the buffer until a full cube of data has been displayed. The method takes a block of eight bytes representing a layer and then writes this to the shift registers using SPI. Note that the spi.Write is embedded in the write to the enable line. This ensures that all of the layers are turned off whilst we are updating the shift registers.</p><p>Wrapping all of this in the LEDCube class means that we now have a very simple class where we can spawn the DislpayBuffer method into its own thread.</p><h4>Main Program</h4><p>The main program sets the cube up and then controls what is actually shown in the cube. The first thing we need to do is to set up a buffer to store the cube display and then spawn off the DisplayBuffer into its own thread.</p><p><pre class="brush: csharp">private static LEDCube cube = new LEDCube();
private static byte[] newFrame = new byte[64];
ClearCube();
Cube.UpdateBuffer(newFrame);
Thread display = new Thread(new ThreadStart(cube.DisplayBuffer));
display.Start(); </pre></p><p>The ClearCube method is trivial and simply sets all of the bytes in newFrame to zero. At this point we have a cube with a whole lot of nothing going on. The next thing we need to do is to add some effects.</p><h4>Making it Rain</h4><p>Now that we have the mechanism to control the cube, we simply need to work out what we want to display. The rain effect in the opening video illustrates the majority of the techniques used to control the cube.</p><p>The rain algorithm is as follows:</p><ul><li>Set up the cube with a number of rain drops </li><li>Repeat <ul><li>Count the drops in the bottom layer </li><li>Move drops down one layer </li><li>Add the number of drops that have disappeared back into the top layer </li></ul></li></ul><p>To do this we will create two methods:</p><ul><li>AddDrops </li><li>Rain </li></ul><p><pre class="brush: csharp">private static void AddDrops(int count, int plane = -1)
{
    for (int drops = 0; drops &lt; count; drops&#43;&#43;)
    {
        bool findingSpace = true;
        while (findingSpace)
        {
            int x = rand.Next() % 8;
            int y = rand.Next() % 8;
            int z;            if (plane == -1)
            {
                z = rand.Next() % 8;
            }
            else
            {
                z = plane;
            }            int position = (z * 8) &#43; y;
            byte value = (byte) ((1 &lt;&lt; x) &amp; 0xff);
            if ((newFrame[position] &amp; value) == 0)
            {
                newFrame[position] |= value;
                findingSpace = false;
            }
        }
    }
}</pre></p><p>AddDrops simply adds a specified number of rain drops to the buffer. It also makes sure that if asked for 10 it will always add 10 by checking to see if one exists in the location it wanted to use (check out the findingSpace variable):</p><p><pre class="brush: csharp">private static void Rain(int noDrops, int cycles)
{
    ClearCube();
    AddDrops(noDrops);
    cube.UpdateBuffer(newFrame);
    for (int currentCycle = 0; currentCycle &lt; cycles; currentCycle&#43;&#43;)
    {
        int bitCount = 0;
        for (int plane = 0; plane &lt; 8; plane&#43;&#43;)
        {
            byte value = 1;
            for (int bit = 0; bit &lt; 8; bit&#43;&#43;)
            {
                if ((newFrame[56 &#43; plane] &amp; value) &gt; 0)
                {
                    bitCount&#43;&#43;;
                }
                value &lt;&lt;= 1;
            }
        }
        for (int plane = 7; plane &gt; 0; plane--)
        {
            for (int currentByte = 0; currentByte &lt; 8; currentByte&#43;&#43;)
            {
                newFrame[(plane * 8) &#43; currentByte] = newFrame[((plane - 1) * 8) &#43; currentByte];
            }
        }
        for (int b = 0; b &lt; 8; b&#43;&#43;)
        {
            newFrame[b] = 0;
        }
        AddDrops(bitCount, 0);
        cube.UpdateBuffer(newFrame);
        Thread.Sleep(75);
    }
}</pre></p><p>Rain adds the specified number of drops to the newFrame, shows the drops, and then moves them all down by one horizontal plane. Before doing this, it counts how many drops are going to fall out of the cube (the number in the bottom horizontal plane). After all the drops have moved down one plane it adds the drops which have disappeared out of the bottom of the cube back in at the top in random positions.</p><p>We can display this by adding the following to the main program:</p><p><pre class="brush: csharp">while (true)
{
    Rain(10, 60000);
} </pre></p><p>Full source code at <a href="http://netduinoledcontrol.codeplex.com/">http://netduinoledcontrol.codeplex.com/</a>.</p><p>If you add your own effects, remember to consider the rating of the equipment and parts used. Turning on a full horizontal layer consumes 1.6A for the LEDs alone. Things can get warm/hot if every LED in the cube is turned on at the same time so avoid such effects.</p><h3>Conclusion</h3><p>When I started out on this project I was not sure how fast the Netduino Mini could control the cube. It has proven that it is up to the task of keeping the display running whilst also being able to work on the upcoming “frame.” If you have gone this far and built a cube then how about expanding it:</p><ul><li>Add some filters and a microphone and make the display respond to its environment </li><li>Connect the cube to a PC using Bluetooth </li><li>Add an MP3 player module and write software to synchronise the display to the music </li></ul><p>Where will you take it?</p><h3>About The Author</h3><p>Mark Stevens is a software engineer and self-confessed technology addict. Mark started in the computer industry in the 1980s and at the age of 16 wrote a disk operating system for a then state of the art 8-bit microprocessor (despite the fact the machine already had one). He did it for fun and has been hooked on IT ever since then. Mark currently writes line of business applications for Win32, ASP.NET, and Silverlight platforms. He has recently taken up microelectronics as a hobby and has since discovered that his wife does not like the smell of solder. Marks’ current exploits, thoughts, and contact information can be found on his <a href="http://blog.mark-stevens.co.uk/">blog</a>.</p><p class="MsoNormal">&nbsp;</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:a6740467db934541858d9f9101670ead">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Netduino-Controlled-LED-Cube</comments>
      <link>http://channel9.msdn.com/coding4fun/articles/Netduino-Controlled-LED-Cube</link>
      <itunes:summary>Commercial LED cubes have been around for a while now and can be quite large and capable of some interesting displays. This project is on a smaller scale and goes through the steps required to build a Netduino Mini-controlled 512 LED cube (8 x 8 x 8).Clearly, the Mini does not have 512 pins and so we use Persistence of Vision to control the LEDs in the cube. The result is that seven pins on the Netduino Mini can control 512 LEDs.At the end of this article you should be able to create a cube capable of the following:Bill of MaterialsDescriptionQuantityLEDs (I chose blue)51274HC595 Shift Registers874HC238 3 to 8 line decoder1Netduino Mini116 Pin DIL Socket (0.3&amp;quot;)924 Pin DIL Socket (0.6&amp;quot;)1TIP122 NPN Transistor8100nF Ceramic Capacitor102.2K Resistor868 Ohm 0.25W Resistor (you may need to change these depending upon the LED you choose)648 Way Single Row Socket936 Way Header Strip (Straight)32 Way Single Row Socket22 Way PCB Mount Terminal Connector18 Way Cable (ribbon or alarm)2.5mWireMiscellaneousPad board 160 x 115 Hole1Hex PCB spacer and screw (M3 threaded)4&amp;nbsp;The following items are also required:5V Power capable of delivering 2A Solder (I used about 15 metres over the life of this project). One 30cm x 30cm piece of wood Drill and wood drill bits (4mm – 5mm) Some cardboard and tape A fair amount of patience Good attention to detail You may need to shop around for the LEDs. I went to my preferred supplier and was quoted 18.5 pence each. By going on eBay I managed to negotiate the price down to 2.5 pence each including delivery. You are buying in bulk so don’t be afraid to ask for a good bulk price. Also, buy a few more than you need in case you have a faulty part or break a few.Building the CubeThis is probably the most time consuming part of the project requiring a lot of patience and testing. The aim of the project is to convert these 512 blue LEDs:Into this:Shaping the LEDsThe exact dimensions of the cube depend upon the length of the legs on the LEDs.</itunes:summary>
      <pubDate>Mon, 07 Nov 2011 22:50:33 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Netduino-Controlled-LED-Cube</guid>
      <dc:creator>Mark Stevens</dc:creator>
      <category>animation</category>
      <category>led</category>
      <category>electronics</category>
      <category>netmf</category>
  </item>
  <item>
      <title>KinectoPhone – Kinect and Windows Phone working together</title>
      <description><![CDATA[<p>A while ago we saw a <a href="http://www.youtube.com/watch?v=0J_Achk3_ZQ">demo from Microsoft</a> that showed how it is possible to use Windows Phone to interact with a Kinect-powered game. During the Kinect Code Camp, right before the official release of the Kinect for Windows SDK beta, <a href="http://adamkinney.com/blog/">Adam Kinney</a>, <a href="https://twitter.com/#%21/rickbarraza">Rick Barazza</a>, and I decided to work on a proof-of-concept project that would provide the same platform integration in a non-commercial development environment. Because it involved the main character hopping around collecting bonus items, we called the project Bunnyhop (codename KinectoPhone).</p><h1>Initial Mashup</h1><p>The project was divided into three major components:</p><p><strong>The desktop client</strong> – a Kinect-controlled 3D environment. It is only partially controlled by the motion sensor, since other responsibilities are delegate to the phone. Because it is a proof-of-concept and not a full-sized game, WPF is the primary sub-framework.</p><p><strong>The mobile client</strong> – a Windows Phone application that also is in charge of partially controlling the 3D environment on the desktop client. We decided to use Silverlight in favor of XNA because we didn't want complex graphics and all we needed was the bird's eye view of the playable area.</p><p><strong>The server</strong> – one of the most interesting (and issue-generating) components. This was the link between the desktop and the mobile client. Initially we planned on using a WCF service (and we actually did for a while), but then we decided to use sockets for better performance..</p><h1>Developing the communication layer</h1><p>Since we decided to remove support for WCF and focus on sockets, we needed to figure out a way to send appropriate data to both clients. Given the fact that the amounts of data that are being sent across clients are not really big, it seemed a good idea to make the server broadcast a dual data set—a collection of indicators that are used by both the phone and desktop clients. It will be the client's responsibility to select the required value.</p><p>Here is the general structure of a data package broadcasted by the server:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B16%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B10%5D-1.png" alt="image" width="240" height="106" border="0"></a></p><p>We tried to keep it as simple as possible. The desktop client is going to process the camera direction sent by the phone, and the phone will adjust the character position according to the movement generated by the Kinect-driven desktop client.</p><p>When the clients (both desktop and mobile) send data to the server, they identify themselves through a prefix. For example, the desktop client sends the following string to the server:</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B20%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B12%5D.png" alt="image" width="240" height="105" border="0"></a></p><p>The<strong> c prefix</strong> identifies the sender as the desktop client (computer). The phone sends the camera angle, led by the <strong>p prefix</strong> (phone):</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B24%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B14%5D.png" alt="image" width="240" height="107" border="0"></a></p><p>Before going any further, I must mention that socket communications on Windows Phone are fairly generic, so the code we decided to use is close to the <a href="http://go.microsoft.com/fwlink/?LinkId=219075">Sockets Sample on MSDN</a>. We added a custom string parser that makes sure that the proper data is read between devices.</p><h1>The server</h1><p>Our server is entirely based on socket interactions through the TCP layer. It is a .NET-based console application that is listening to incoming connections (limited to two) and is broadcasting the received content, synchronizing both the desktop and the mobile clients. It is a &quot;dummy&quot; server and so doesn't perform any data processing—it simply receives the data from one client and then passes it to another.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B4%5D-1.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B2%5D-1.png" alt="image" width="595" height="300" border="0"></a></p><p>Here is how the listening process is organized:</p><p><pre class="brush: csharp">
public static void StartListening()
{

    byte[] dataBuffer = new Byte[StateObject.BUFFER_SIZE];
    IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, PORT_NUMBER);
    Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

    try
    {
        listener.Bind(localEndPoint);
        listener.Listen(2);

        while (true)
        {
            completed.Reset();
            Console.WriteLine(&quot;Async transmission started.&quot;);
            listener.BeginAccept(new AsyncCallback(AcceptCallback),listener);
            completed.WaitOne();
        }

    }
    catch (Exception e)
    {
        Debug.WriteLine(e.ToString());
    }
}
</pre></p><p>The received byte array is later transformed to a standard string that is parsed according to the pattern described above. The parser detects the prefix and assigns the correct values depending on the sender.</p><p><pre class="brush: csharp">
private static void ParseContent(string content)
{
    var values = content.Split('|');
    if (content.StartsWith(&quot;c&quot;))
    {
        position = int.Parse(values[1]);
    }
    else if (content.StartsWith(&quot;p&quot;))
    {
        angle = int.Parse(values[1]);
    }
}
</pre></p><p>The difference in received data is present because each client is designed to affect only a part of the gameplay, and character movement cannot be directed by a desktop client or by the mobile application on its own. The mobile client reports the angle of character rotation, and the desktop client controls general movement progress and bonus pickups.</p><p>Once all values are read, the server broadcasts them back:</p><p><pre class="brush: csharp">
private static void Send(Socket handler)
{
    // The generalized string broadcasted by the server does not contain a platform
    // identifying prefix (p or c)
    string data = string.Format(&quot;{0}|{1}&quot;, angle, position);

    byte[] byteData = Encoding.UTF8.GetBytes(data);

    Console.WriteLine(&quot;DATA LENGTH [SENT] = {0} bytes. DATA = {1}&quot;, data.Length, data);

    handler.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), handler);
}
</pre></p><p>This is pretty much it when it comes to defining the server that handles cross-platform communications. It can be installed on a machine other than the one where the desktop client is running, as long as all of them work on either the same subnet or a network in which the IP addresses are static and have the invoked port open.</p><h1>The desktop client</h1><p>The desktop client was a bit of a graphical “fortress.” Rick was building the entire 3D environment while Adam and I were building the mobile application and the server interoperability layer.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B12%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B8%5D-3.png" alt="image" width="636" height="397" border="0"></a></p><p>We used the newly launched Kinect SDK to access the connected Kinect and it was initialized the moment the main window is loaded:</p><p><pre class="brush: csharp">
void SetupKinect()
{
    nui = new Runtime();

    try
    {
        nui.Initialize(RuntimeOptions.UseSkeletalTracking);
    }
    catch (InvalidOperationException)
    {
        MessageBox.Show(&quot;Runtime initialization failed. Please make sure Kinect device is plugged in.&quot;);
        return;
    }

    nui.SkeletonFrameReady &#43;= new EventHandler&lt;SkeletonFrameReadyEventArgs&gt;(nui_SkeletonFrameReady);
}
</pre></p><p><strong>Runtime</strong> is the standard device class that identifies the Kinect currently connected to the PC. As long as we were using just one sensor, we did not need to provide a numeric index when instantiating the <strong>Runtime</strong> class itself.</p><p>Since we are only using skeletal tracking—the desktop client is responsible for moving the character forward on a detected jump—the Runtime instance is initialized with a <strong>RuntimeOptions.UseSkeletalTracking</strong> argument. The event handler is invoked once we detect a tracked skeleton:</p><p><pre class="brush: csharp">
void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
    SkeletonFrame skeletonFrame = e.SkeletonFrame;

    foreach (SkeletonData data in skeletonFrame.Skeletons)
    {
        if (SkeletonTrackingState.Tracked == data.TrackingState)
        {

            phL = new Point(data.Joints[JointID.HandLeft].Position.X, data.Joints[JointID.HandLeft].Position.Y);
            phR = new Point(data.Joints[JointID.HandRight].Position.X, data.Joints[JointID.HandRight].Position.Y);
            pCore = new Point(data.Joints[JointID.HipCenter].Position.X, data.Joints[JointID.HipCenter].Position.Y);

            coreDeep = data.Joints[JointID.HipCenter].Position.Z;

            leftDeep = data.Joints[JointID.HandLeft].Position.Z - coreDeep;
            rightDeep = data.Joints[JointID.HandRight].Position.Z - coreDeep;

            handL.x = 640 &#43; 600 * phL.X;
            handL.y = 350 - 300 * phL.Y;
            handR.x = 640 &#43; 600 * phR.X;
            handR.y = 350 - 300 * phR.Y;

            bodyCore.x = 640 &#43; 30 * pCore.X;
            bodyCore.y = 350 - 300 * pCore.Y;

            follow.x = bodyCore.x;
        }
    }
}
</pre></p><p>The Kinect sensor monitors six skeletons at once, but not all of them are tracked for movement. That's the reason to check the <strong>SkeletonTrackingState</strong> before displaying the joint indicators on the screen.</p><p>The joint indicators themselves are declared in the XAML layout in the main page:</p><p><pre class="brush: xml">
&lt;Canvas x:Name=&quot;touch_screen&quot; Width=&quot;1280&quot; Height=&quot;720&quot; Background=&quot;#00FF0000&quot;&gt;
    &lt;local:BodyMarker x:Name=&quot;handL&quot;/&gt;
    &lt;local:BodyMarker x:Name=&quot;handR&quot;/&gt;
    &lt;local:BodyMarker x:Name=&quot;follow&quot; x=&quot;0&quot; y=&quot;0&quot;/&gt;
    &lt;local:BodyMarker x:Name=&quot;bodyCore&quot; x=&quot;0&quot; y=&quot;0&quot;/&gt;
&lt;/Canvas&gt;
</pre></p><p>The <strong>BodyMarker</strong> class is in fact a custom <strong>UserControl</strong>. It is easier to manage and later extend instances of a customizable unit rather than a simple ellipse:</p><p><pre class="brush: xml">
&lt;UserControl x:Class=&quot;KinectoPhone.Desktop.BodyMarker&quot;
             xmlns=&quot;<a class="linkification-ext" title="Linkification: http://schemas.microsoft.com/winfx/2006/xaml/presentation" href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;
             xmlns:x=&quot;<a class="linkification-ext" title="Linkification: http://schemas.microsoft.com/winfx/2006/xaml" href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;
             xmlns:mc=&quot;<a class="linkification-ext" title="Linkification: http://schemas.openxmlformats.org/markup-compatibility/2006" href="http://schemas.openxmlformats.org/markup-compatibility/2006">http://schemas.openxmlformats.org/markup-compatibility/2006</a>&quot;
             xmlns:d=&quot;<a class="linkification-ext" title="Linkification: http://schemas.microsoft.com/expression/blend/2008" href="http://schemas.microsoft.com/expression/blend/2008">http://schemas.microsoft.com/expression/blend/2008</a>&quot; &gt;
    &lt;Canvas&gt;
        &lt;Ellipse x:Name=&quot;bkg&quot; Width=&quot;10&quot; Height=&quot;10&quot; Canvas.Left=&quot;-5&quot; Canvas.Top=&quot;-5&quot;/&gt;
    &lt;/Canvas&gt;
&lt;/UserControl&gt;
</pre></p><p>In the skeleton tracking code above, we are not only tracking the joint position, we're also adjusting the character position based on the center hip location in space as well as detecting the jump by coordinating joint positions by the Z-axis.</p><p>The data is sent via an instance of the same AsynchronousClient I used on the server side, but with small modifications. I implemented a short verification mechanism that ensures the fact that I am using an IPv4 address as the endpoint will be functional with only IPv4 and not IPv6 addresses for the time being:</p><p><pre class="brush: csharp">
public AsynchronousClient()
{
    // The worker that is constantly syncing the state of the
    // desktop client with the server.
    backgroundWorker.DoWork &#43;= new DoWorkEventHandler(backgroundWorker_DoWork);

    IPHostEntry ipHost = Dns.GetHostEntry(&quot;192.168.173.1&quot;);

    var ipv4address = (from c in ipHost.AddressList where c.AddressFamily == AddressFamily.InterNetwork select c).First();

    if (ipv4address != null)
    {
        IPAddress ipAddress = (IPAddress)ipv4address;
        remoteEndPoint = new IPEndPoint(ipAddress, port);

        InitializeClient();
    }
}
</pre></p><p>The <strong>BackgroundWorker</strong> is managing the constant synchronization building the location and meta string that is being sent with updated character position and activity data from the desktop client:</p><p><pre class="brush: csharp">
void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
    if (!client.Connected)
    {
        client.Shutdown(SocketShutdown.Both);
        client.Close();
        InitializeClient();
    }

    DesktopData cd = (DesktopData)e.Argument;
    Send(client, string.Format(&quot;c|{0}&quot;, cd.Position));
    sendDone.WaitOne();

    // Receive the response from the remote device.
    Receive(client);
    receiveDone.WaitOne();
}
</pre></p><p>When the desktop client receives data, it only reads information regarding the camera angle. Therefore, that’s the only indicator we needed to set from the outside:</p><p><pre class="brush: csharp">
void aClient_ResponseReceived(object sender, ResponseReceivedEventArgs e)
{
    Dispatcher.Invoke(new Action(delegate
    {

        var values = e.Response.Split('|');

        cameraTargetRotation = Convert.ToDouble(values[0]);

    }), DispatcherPriority.Normal);
}
</pre></p><h1>Phone client</h1><p>The phone client has only one responsibility—adjust the camera angle as the user tilts the device. We used standard accelerometer-based capabilities to track the movement of the device in space.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B29%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B17%5D.png" alt="image" width="453" height="272" border="0"></a></p><p>The app uses a different implementation of the <strong>AsynchronousClient</strong> called <strong>SocketHandler</strong>. It works well to link the phone to the server. For example, take a look at the handler that processes the received input:</p><p><pre class="brush: csharp">
private void ProcessReceive(SocketAsyncEventArgs e)
{
    if (e.SocketError == SocketError.Success)
    {
        // Received data from server
        string dataFromServer = Encoding.UTF8.GetString(e.Buffer, 0, e.BytesTransferred);

        Socket sock = e.UserToken as Socket;
        sock.Shutdown(SocketShutdown.Send);
        sock.Close();
        clientDone.Set();

        // Respond to the client in the UI thread to tell him that data was received
        System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
        {
            ResponseReceivedEventArgs args = new ResponseReceivedEventArgs();
            args.response = dataFromServer;
            OnResponseReceived(args);
        });

    }
    else
    {
        clientDone.Set();
        throw new SocketException((int)e.SocketError);
    }
}
</pre></p><p>&nbsp;</p><p>Due to threading limitations, we had to use the dispatcher class to notify the UI about the fact that all data from the server was received and that it should be transformed to the position of the character on the map.</p><p>In the main page constructor, we are initializing the SocketHandler with the same values for the server as we did in the desktop client. Additionally, we're wiring an event handler that will handle the received string. Unlike ProcessReceive above, the wired event handler actually parses the string for required values and accordingly takes the appropriate action:</p><p><pre class="brush: csharp">
SocketHandler handler = new SocketHandler(&quot;192.168.1.6&quot;, 13001);
handler.ResponseReceived &#43;= new ResponseReceivedEventHandler(handler_ResponseReceived);

void handler_ResponseReceived(object sender, ResponseReceivedEventArgs e)
{
    previousPos = currentPos;

    string[] data = e.response.Split('|');
    int.TryParse(data[1], out currentPos);

    if (currentPos != previousPos)
    {
        targetIndex = currentPos;
    }
}
</pre></p><p>The data is sent back to the server with the help of a <strong>DispatcherTimer</strong> instance running every 300 milliseconds:</p><p><pre class="brush: csharp">
void timer_Tick(object sender, EventArgs e)
{
    handler.SendData(string.Format(&quot;p|{0}&quot;, curTriangleAngle.ToString(&quot;0&quot;)));
}
</pre></p><p>When the accelerometer detects a change in the current value, we make sure that the object is rotated in the right direction by checking the sign of the reading:</p><p><pre class="brush: csharp">
void accel_ReadingChanged(object sender, AccelerometerReadingEventArgs e)
{
    Dispatcher.BeginInvoke(new Action(() =&gt;
    {
        previousY = currentY;
        currentY = e.Y;

        if (e.Y &gt; .7 || e.Y &lt; -.7)
        {
            if (e.Y &gt; .7 &amp;&amp; !isTurnDirty)
            {
                isTurnDirty = true;
                Turn(1);
            }
            else if (e.Y &lt; -.7 &amp;&amp; !isTurnDirty)
            {
                isTurnDirty = true;
                Turn(-1);
            }
        }
        else
        {
            isTurnDirty = false;
        }
    
    }));
}

void Turn(double direction)
{
    currentTurnTime = DateTime.Now;
    TimeSpan diffResult = currentTurnTime.Subtract(lastTurnTime);
    if (diffResult.TotalSeconds &gt; 1)
    {
        lastTurnTime = currentTurnTime;
        targetTriangleAngle &#43;= direction * 90.0;
    }
}
</pre></p><p>The turn time is checked so that the character on the device screen doesn’t constantly rotate. Since the accelerometer is very sensitive and without a time limit, a slight tilt will have unexpected consequences on the rotation behavior.</p><h1>How to test</h1><p><a href="http://virtualrouter.codeplex.com/">Virtual Router</a> is a great way to test the set-up. Virtual Router allows the server computer to become a WiFi hotspot so that any connected device will be automatically registered as a part of the local subnet.</p><p>You will need:</p><ul><li><strong>A computer with a WiFi card (most laptops have them anyway)</strong> </li></ul><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B35%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B21%5D.png" alt="image" width="424" height="330" border="0"></a></p><p>Make sure that you have the WiFi card enabled and launch Virtual Router Manager. Set a new network name, as well as specify a password. It is worth mentioning that this network will act like a standard wireless network, so make sure you secure it with a strong password if you don't want it accessed from the outside.</p><p>Once you enable the hotspot, you can run the desktop client on the same machine. Connect the phone to the newly created wireless network and make sure that the proper IP is set in the code-behind for both the desktop client and the Windows Phone app.</p><p>The IP for the server machine can be found by running the ipconfig command in the console.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B5%5D-2.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B2%5D-2.png" alt="image" width="455" height="230" border="0"></a></p><p>The IP address for the Windows Phone device that is connected to the hotspot is shown in the main Virtual Router Manager window.</p><p>In case the router cannot be started, make sure that connection sharing is enabled for your main connection and that it points to the Miniport interface.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B42%5D.png"><img title="image" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B26%5D.png" alt="image" width="544" height="408" border="0"></a></p><p>Once the network is correctly set up, I would highly recommend launching the project components in the following order:</p><ol><li>Server </li><li>Desktop client </li><li>Phone client </li></ol><h1>Conclusion</h1><p>With the latest 7.1 SDK update for Windows Phone as well as the 7.5 (Mango) OS, it is fairly easy to set up a Kinect-to-WP communication layer through sockets. With small modifications and performance optimizations we can also send Kinect imagery (captured through the depth and video sensors) directly to the phone without major delays. The field of third-party games that interoperate with Kinect and run on mobile devices is yet to be fully developed, but we already made the first steps in that direction.</p><h1>About the author</h1><p>Dennis Delimarsky is a Windows Phone Development MVP. He enjoys technical writing as well as building cool stuff around the .NET platform. Besides Coding4Fun, he also blogs at <a href="http://dennisdel.com/">Den by default</a>. He can be contacted at <a class="linkification-ext" title="Linkification: mailto:ddelimarsky@live.com">ddelimarsky@live.com</a>.</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:a8028d44ac6d4e2dbbb29f07015cdce2">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/kinectophone</comments>
      <link>http://channel9.msdn.com/coding4fun/articles/kinectophone</link>
      <itunes:summary>A while ago we saw a demo from Microsoft that showed how it is possible to use Windows Phone to interact with a Kinect-powered game. During the Kinect Code Camp, right before the official release of the Kinect for Windows SDK beta, Adam Kinney, Rick Barazza, and I decided to work on a proof-of-concept project that would provide the same platform integration in a non-commercial development environment. Because it involved the main character hopping around collecting bonus items, we called the project Bunnyhop (codename KinectoPhone).Initial MashupThe project was divided into three major components:The desktop client – a Kinect-controlled 3D environment. It is only partially controlled by the motion sensor, since other responsibilities are delegate to the phone. Because it is a proof-of-concept and not a full-sized game, WPF is the primary sub-framework.The mobile client – a Windows Phone application that also is in charge of partially controlling the 3D environment on the desktop client. We decided to use Silverlight in favor of XNA because we didn&#39;t want complex graphics and all we needed was the bird&#39;s eye view of the playable area.The server – one of the most interesting (and issue-generating) components. This was the link between the desktop and the mobile client. Initially we planned on using a WCF service (and we actually did for a while), but then we decided to use sockets for better performance..Developing the communication layerSince we decided to remove support for WCF and focus on sockets, we needed to figure out a way to send appropriate data to both clients. Given the fact that the amounts of data that are being sent across clients are not really big, it seemed a good idea to make the server broadcast a dual data set—a collection of indicators that are used by both the phone and desktop clients. It will be the client&#39;s responsibility to select the required value.Here is the general structure of a data package broadcasted by the server:We tried to keep it</itunes:summary>
      <pubDate>Thu, 08 Sep 2011 22:07:45 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/kinectophone</guid>
      <dc:creator>Dennis Delimarsky</dc:creator>
  </item>
  <item>
      <title>Where’s My Car?</title>
      <description><![CDATA[<p>Most people are all too familiar with forgetting where they parked their car. Whether or not you’re one of these people, read on to learn about writing a location-aware Windows Phone app that can map, route, take pictures, and save state between invocations.</p><h3>Introduction</h3><p>Working with mobile phones gives you access to a completely different form factor, as well as a completely different set of functionality compared to web and desktop development environments. This project demonstrates GPS, camera, isolated storage, map display, web services, and advanced map features. Use it as a starting point for another project, or just learn from the techniques shown here.</p><p>You don’t need a Windows Phone to learn from this sample, but GPS simulation is only available in the emulator for the 7.1 beta developer tools, and interacting with the camera on the emulator is no fun at all, so it’s definitely a limited debugging/testing experience. You need to be a registered phone developer in order to debug on a physical phone, but the price ($99) is definitely reasonable if you end up releasing even a single paid app.</p><p>Go to <a href="http://create.msdn.com">create.msdn.com</a>, then click <strong>Download the free tools </strong>to download the Windows Phone Developer Tools (or use the direct download link provided above this Introduction section). This code is written for the Windows Phone Developer Tools 7.0, but has also been tested with Windows Phone SDK 7.1 Beta 2.&nbsp; Either way, it’s is a mostly online install, and it’s pretty big so expect it to take some time. Even if you don’t have any development tools, this will give you Visual Studio Express, Blend, and XNA Game Studio. If you have the full-version tools already, it will add new templates.</p><h3>Project Basics</h3><p>Upon launching the app, there’s not much to see.&nbsp; You can touch the car icon in the <em>Map</em> region in order to set your car’s parking location.&nbsp; To make things easier, you can also touch the camera icon to take a picture of your parking spot or nearby landmark to make it easier to find later.&nbsp; The data is saved between runs so you don’t need to leave it running.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B3%5D-1.png"><img title="MainPage - First time" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B1%5D.png" alt="MainPage - First time" width="292" height="484" border="0"></a></p><p>The application takes advantage of a small set of pages:</p><p>&nbsp;</p><ul><li><strong>MainPage</strong>: Summary screen to see the map and photo in the same place.&nbsp; Essentially, this uses two Image controls and a Map control.&nbsp; The upper region shows a small map if you’ve set your parking spot.&nbsp; It also caches a small version of the map in case you can’t get a GPS or data connection when you need to find your car. </li><li><strong>MapSet</strong>: Allows the user to set their car’s position on a map.&nbsp; It starts out centered on the current location and the user can swipe around to place their car. </li><li><strong>MapPage</strong>: A larger map with panning/zooming support.&nbsp; This is the one you see after locking in the parking spot.&nbsp; You can jump to your current position, the car’s position, or generate a route between them. </li><li><strong>Media</strong>: A large view of the photo taken of the parking spot. </li><li><strong>SettingsPage</strong>: Choice of imperial (miles) or metric (kilometers) for distance measurements, and map style (aerial or street).&nbsp; These are all data-bound to simplify managing the values. </li></ul><p>&nbsp;</p><p>It also uses a few <strong>IValueConverter </strong>classes to take data from my view model and make it look right in the UI:</p><h4>DistanceConverter</h4><p>Take a double value (assumed in meters), converts to miles if necessary, and appends the unit (km/mi).&nbsp; Notice that the code references the WheresTheCarSettings object.&nbsp; This is used to determine the measurement mode/unit.&nbsp; This should probably be passed in as a parameter, since this limits the portability for other projects, but I’ll leave that as an exercise for the reader!</p><pre><pre class="brush: csharp">public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    if (value == null ) return &quot;&quot;;

    double val = Double.Parse(value.ToString());
	string unit;
    if( WheresTheCarSettings.Instance.MeasurementMode == MeasurementMode.Imperial)
    {
        unit = &quot;miles&quot;;
        val = (val*3.2808399)/5280.0;
    }
    else
    {
        unit = &quot;km&quot;;
        val /= 1000.0;
    }

    return string.Format(&quot;{0:0.00} {1}&quot;, val, unit);
}
</pre></pre><h4>ImageConverter</h4><p>Takes an image path, checks for it in isolated storage, otherwise assumes it’s in the application XAP file, and then returns an <strong>BitmapImage </strong>for display.&nbsp; This is a pretty handy converter since the Source can’t be set to isolated storage otherwise.&nbsp; The <strong>Cache </strong>is very important since accessing isolated storage is more expensive than RAM access.&nbsp; Also, notice that the <strong>Dictionary </strong>object is holding <strong>WeakReference</strong> instances pointing to the image.&nbsp; This allows the garbage collector to trim the cache if memory gets tight.&nbsp; Be sure to always use the <strong>IsAlive</strong> property so you know if the object’s been released.</p><pre><pre class="brush: csharp">public static Dictionary Cache { get; private set; }

static ImageConverter()
{
    Cache = new Dictionary();
}

#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    if (value != null &amp;&amp; !string.IsNullOrEmpty(value.ToString()))
    {
        string fn = value.ToString();

        if (Cache.ContainsKey(fn))
            if (Cache[fn].IsAlive)
                return Cache[fn].Target;
            else
                Cache.Remove(fn);

        try
        {
            BitmapImage bs = null;
            using (var myStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (myStore.FileExists(fn))
                {
                    using (var photoStream = myStore.OpenFile(fn, FileMode.Open))
                    {
                        bs = new BitmapImage();
                        bs.SetSource(photoStream);
                    }
                }
                else
                    bs = (new BitmapImage(new Uri(fn, UriKind.Relative)));

                if( parameter == null || parameter.ToString() != &quot;no-cache&quot;)
                    Cache.Add(fn, new WeakReference(bs));
                return bs;
            }
        }
        catch
        {
            // Errors will be handled silently
        }
    }

	// If all else fails...
	return null;
}</pre></pre><h4>ValueToVisibilityConverter</h4><p>Returns <strong>Visibility.Collapsed</strong> or <strong>Visibility.Visible </strong>depending on whether a <strong>GeoCoordinate </strong>value is non-null and valid.&nbsp; This converter performs the simple action of making an element invisible if no coordinate is set.&nbsp; Very simple, but it makes for much more elegant code.</p><pre><pre class="brush: csharp">public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    var geo = value as GeoCoordinate;
	return (Utility.IsCoordNullOrUnknown(geo)) ? Visibility.Collapsed : Visibility.Visible;
}</pre></pre><h3>Location</h3><p>On Windows Phone, you determine your geographic location by using the <strong>GeoCoordinateWatcher</strong> class. When you instantiate it, you can specify an accuracy of <em>Default</em> or <em>High</em>. High accuracy comes at the cost of battery life. You can also set your movement threshold. The higher the threshold, the less often you’ll get position events. Call <em>Start</em> to wait for the sensor to turn on, or <em>TryStart</em> for asynchronous usage.</p><p>The <strong>GeoCoordinateWatcher</strong> raises an event for status changes such as starting or no data (<em>StatusChanged</em>), and an event to indicate a location change (<em>PositionChanged</em>). Locations are reported as <strong>GeoCoordinate</strong> objects, and include latitude, longitude, speed, bearing, and more. All distance measurements are in meters.</p><p>Note that like any GPS, the phone won’t be able to get a lock in underground parking, or even in many multilevel parking ramps. There’s not much you can do about this, but hopefully the photo comes in handy then!</p><h3>Maps</h3><p>Displaying a map on a Windows Phone application is really easy. The controls that come with the toolkit include a <strong>Map </strong>control. Simply drop this control onto a page and you are just about ready to go. The only other required step is to register as a developer on Bing. You can find out more information about the steps to follow to obtain your key and register your application <a href="http://msdn.microsoft.com/en-us/library/ff428642.aspx" target="_blank">here</a>.&nbsp; This gets you a credential key that you plug into the <strong>MAP_CREDENTIALS </strong>property of the <strong>RouteHelper </strong>class of the supplied code.&nbsp; Note that without this, you won’t even be able to view maps, let alone generate routes. By doing this, you will get a map centered on Latitude = 0, and Longitude = 0. This puts you in the Atlantic Ocean west of South Africa. Without doing anything else you can pan and zoom the map.</p><p>Unfortunately, due to a bug in the current build of the controls, you can’t create the Map control in XAML on multiple pages of the same app.&nbsp; The maps in Where’s My Car are created in the code-behind.&nbsp; A little ugly, but it works.&nbsp; Hopefully this will be resolved in Mango.&nbsp; In XAML, it’s as easy as a one line control declaration to add a map:</p><p>&nbsp;</p><pre class="csharpcode"><pre class="brush: xml">&lt;Map CredentialsProvider=&quot;XXXXXX&quot; /&gt;</pre></pre><p>You can set properties to hide the Bing logo (LogoVisibility=&quot;Collapsed&quot;), to hide the copyright (CopyrightVisibility=&quot;Collapsed&quot;), to set an explicit zoom level (ZoomLevel=&quot;15&quot;) and much more. You might notice that I set the zoom bar to be visible in the emulator, but not on the phone. Without having a touchscreen laptop, I wouldn’t be able to zoom the map in the emulator otherwise. My code-based map creation looks this this:</p><p><pre class="brush: csharp">return new Map
{

    CredentialsProvider = new ApplicationIdCredentialsProvider(MapHelper.MAP_CREDENTIALS),
    ZoomLevel = 15,
    Mode = s.UseAerialMode ? (MapMode) new AerialMode() : new RoadMode(),
    ZoomBarVisibility = (Environment.DeviceType == DeviceType.Emulator) ? Visibility.Visible : Visibility.Collapsed,
    CopyrightVisibility = Visibility.Collapsed,
    LogoVisibility = Visibility.Collapsed,
    Margin = new Thickness(0),
};</pre></p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B7%5D-2.png"><img title="Setting your location" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B3%5D-3.png" alt="Setting your location" width="292" height="484" border="0"></a></p><p>Another important part of working with a navigation-based map is to be able to set pushpins to indicate the locations of things (in this case, you and your car). The built-in pushpin visualization is fine, but not very special. Changing the look-and-feel is as simple as modifying the template for the <strong>Pushpin</strong> control.&nbsp; Here, we change it to use a bitmap image:</p><p><pre class="brush: xml">&lt;ControlTemplate x:Key=&quot;CarPushpinTemplate&quot; TargetType=&quot;mpc:Pushpin&quot;&gt;
    &lt;Image Source=&quot;/images/carPushpin.png&quot; Stretch=&quot;None&quot; Margin=&quot;-24, 0, 0, -24&quot; /&gt;
&lt;/ControlTemplate&gt;</pre></p><p>When you declare a <strong>Pushpin</strong>, just set its <em>Template </em>property, and add it as a child of the <strong>Map </strong>control. A <strong>Pushpin</strong> control knows where to place itself by its <em>Location</em> property. Note that if the location is <em>null</em>, the pushpin will just lurk in the upper-left corner. Make sure that you hide it when the location isn’t set. I do this with the <strong>ValueToVisibilityConverter </strong>covered above.&nbsp; To use it, just set the <em>Visibility </em>property to the same <em>Location </em>property while using my <strong>ValueToVisibilityConverter </strong>to handle the conversion.</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B30%5D.png"><img title="Location and photo set" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B14%5D-1.png" alt="Location and photo set" width="292" height="484" border="0"></a></p><h3>Routing</h3><p>The <strong>Map</strong> control has no ability to perform routing, but it supports adding child controls. I’ve already discussed the <strong>Pushpin </strong>control as a child. The other important child control is <strong>MapLayer</strong>.&nbsp; <strong>MapLayer</strong> acts as a container for other controls. By setting the <em>Location</em> properties of the nested items (in latitude/longitude), everything is displayed at the right location, regardless of panning or zooming the map (no scaling is done however).</p><p>In order to obtain the routing data, the user must first set their parking location point. The other point is the current phone location. The actual routing happens using the Bing web service. Generate a service reference pointing to the definition (WSDL):</p><p><pre class="brush: text">http://dev.virtualearth.net/webservices/v1/routeservice/routeservice.svc?wsdl</pre></p><p>Then, creating the request entails setting the <em>Credentials </em>property, and optionally setting <em>RouteOptions</em>. For walking directions, set <em>Mode</em> to <em>TravelMode.Walking </em>(though this still uses roads)<em>. </em>The <em>Waypoints </em>collection property holds <em>Waypoint </em>objects containing a label along with a <em>Location </em>object with <em>Altitude</em>/<em>Latitude</em>/<em>Longitude </em>properties. For the best performance, I use the <em>CalculateRouteAsync</em> call to get off the UI thread as quickly as possible.</p><p align="center"><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B22%5D.png"><img title="Routing from current position to car" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B10%5D-2.png" alt="Routing from current position to car" width="292" height="484" border="0"></a></p><p>In the response, you get the travel distance and a collection of points that make up the route. Create a <strong>MapPolyLine<em> </em></strong>instance, and then based on the <em>Waypoints </em>collection create and add <strong>GeoCoordinate </strong>objects to the <em>Locations </em>collection. The <strong>MapPolyLine </strong>object then gets added to a <strong>MapLayer </strong>object for rendering along with the map. The final step is to use the <em>Result.Summary.BoundingRectangle</em> property to center and size the map in order to show the whole route in one view.</p><h3>Taking and Storing Pictures</h3><p>Taking pictures is pretty easy. The built-in camera can be triggered using a <strong>CameraCaptureTask</strong> object. Just call the <strong>Show </strong>method and the camera will appear. It’s up to the user to actually take the picture. Note that there is no way to automatically take the photo, and there is at the moment no preview feature.&nbsp; This will change in Mango, but for now it works well enough for our needs.</p><p>An important thing to keep in mind is that showing the camera task causes your app to be tombstoned (deactivated). This means that you need to save any relevant state before triggering it. After the user either takes the photo or cancels it, the app is reactivated. The <em>Completed </em>event of the <strong>CameraCaptureTask</strong> fires, so be sure to subscribe to the event in the constructor of the page. The <em>Completed </em>event includes a <strong>PhotoResult </strong>event class. From this you can check the <em>TaskResult</em> property to see if there is actually a photo ready, and use the <em>ChosenPhoto</em> property to get a stream containing the photo data. You can get the stream to process or write to storage.&nbsp; Here we will open isolated storage and open the “parking.jpg” file, then call the <em>SaveJpeg</em> method of the <strong>WriteableBitmap</strong> class.</p><p>For the sake of efficiency, I prefer to resize the image to a maximum of 1024 width or 768 height, rather than loading a minimum 5MP image each time. The resize is very quick, and results in much less data transfer from isolated storage to memory.</p><h3>Settings</h3><p>Settings are kept track of in a custom class, <strong>WheresTheCarSettings</strong>.&nbsp; This class has <em>INotifyPropertyChanged</em> properties and <strong>Load</strong>/<strong>Save</strong> methods to keep things together.&nbsp; Saving is done with a data contract rather than raw serialization.&nbsp; This is an amazingly easy way to load and save an object, and it’s very resilient against changes.&nbsp; The<em> INotifyPropertyChanged</em> interface is used so disconnected parts of an application (between objects or objects and UI) can be notified of changes to a given object.&nbsp; This happens because the <em>PropertyChanged</em> event fires whenever a property’s value changes, thus giving related code a chance to react.</p><pre><pre class="brush: csharp">#region MeasurementMode (INotifyPropertyChanged Property)
private MeasurementMode _measurementMode;
[DataMember]
public MeasurementMode MeasurementMode
{
	get { return _measurementMode; }
	set
	{
		_measurementMode = value;
		RaisePropertyChanged(&quot;MeasurementMode&quot;);
	}
}
#endregion</pre></pre><p align="center"><strong>.</strong><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image%5B26%5D.png"><img title="Settings page" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/image_thumb%5B12%5D-1.png" alt="Settings page" width="292" height="484" border="0"></a></p><h3>Next Steps</h3><p>The application is fully functional as-is. It’s been in the Marketplace for a few months now.&nbsp; There are a number of complaints about not being able to get a GPS lock, or the route not being optimized for walking.&nbsp; These are true and valid complaints, but it’s difficult to do much about them.&nbsp; This is where good alerts and status indicators are important!&nbsp; Also, it could be useful to add a screen to see the walking route in a step-by-step view (already available in the route response). Integrating parking meter information might also be useful, though I’ve already implemented that in a different application—coming soon!</p><h3>Conclusion</h3><p>Being able to work with the location and camera enables some great scenarios that aren’t really available in other form factors. Get started by downloading the Windows Phone Developer Tools to see just how easy it is.</p><p><em><strong>About the Author</strong></em></p><p><a href="http://www.ariankulp.com/">Arian Kulp</a> is a software developer living in Western Oregon. He creates samples, screencasts, demos, labs, and articles, speaks at programming events, and enjoys hiking and other outdoor adventures with his family.</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Entry:RSSView:cd25045fba8940d3848e9f2b018a231d">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Wheres-My-Car</comments>
      <link>http://channel9.msdn.com/coding4fun/articles/Wheres-My-Car</link>
      <itunes:summary>Most people are all too familiar with forgetting where they parked their car. Whether or not you’re one of these people, read on to learn about writing a location-aware Windows Phone app that can map, route, take pictures, and save state between invocations.IntroductionWorking with mobile phones gives you access to a completely different form factor, as well as a completely different set of functionality compared to web and desktop development environments. This project demonstrates GPS, camera, isolated storage, map display, web services, and advanced map features. Use it as a starting point for another project, or just learn from the techniques shown here.You don’t need a Windows Phone to learn from this sample, but GPS simulation is only available in the emulator for the 7.1 beta developer tools, and interacting with the camera on the emulator is no fun at all, so it’s definitely a limited debugging/testing experience. You need to be a registered phone developer in order to debug on a physical phone, but the price ($99) is definitely reasonable if you end up releasing even a single paid app.Go to create.msdn.com, then click Download the free tools to download the Windows Phone Developer Tools (or use the direct download link provided above this Introduction section). This code is written for the Windows Phone Developer Tools 7.0, but has also been tested with Windows Phone SDK 7.1 Beta 2.&amp;nbsp; Either way, it’s is a mostly online install, and it’s pretty big so expect it to take some time. Even if you don’t have any development tools, this will give you Visual Studio Express, Blend, and XNA Game Studio. If you have the full-version tools already, it will add new templates.Project BasicsUpon launching the app, there’s not much to see.&amp;nbsp; You can touch the car icon in the Map region in order to set your car’s parking location.&amp;nbsp; To make things easier, you can also touch the camera icon to take a picture of your parking spot or nearby landmark to make it easi</itunes:summary>
      <pubDate>Thu, 04 Aug 2011 19:48:37 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Wheres-My-Car</guid>
      <dc:creator>atkulp</dc:creator>
      <category>silverlight</category>
      <category>tools</category>
      <category>windows+phone</category>
      <category>app</category>
      <category>application</category>
  </item>
  <item>
      <title>ScriptTD</title>
      <description><![CDATA[ <p>Script TD is an open-source tower defense game engine for Windows Phone. If you want to create a game, you can do so just by changing some XML, images, and audio files in the Script TD game engine.&nbsp; With this ability, you can create any number of Tower Defense games without having to do any programming!&nbsp; If you want to extend out the engine, it was designed to allow this as well!</p><p><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/HomeScreen%5B3%5D.png"><img title="HomeScreen" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/HomeScreen_thumb%5B1%5D.png" alt="HomeScreen" width="300" height="180" border="0"></a><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/Empty%5B3%5D.png"><img title="Empty" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/Empty_thumb%5B1%5D.png" alt="Empty" width="300" height="180" border="0"></a><a href="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/gamePlay%5B7%5D.png"><img title="gamePlay" src="http://files.channel9.msdn.com/wlwimages/1932b237046e4743a4e79e6800c0220f/gamePlay_thumb%5B5%5D.png" alt="gamePlay" width="300" height="180" border="0"></a></p><p>If you want to learn <a href="http://channel9.msdn.com/coding4fun/articles/ScriptTD-Tower-Defense-Made-Easy">how to extend the engine, check out the Coding4Fun article</a>!</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Project:RSSView:d88aa81942894c4abfad9efa012dfc13">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/projects/ScriptTD</comments>
      <link>http://channel9.msdn.com/coding4fun/projects/ScriptTD</link>
      <itunes:summary> Script TD is an open-source tower defense game engine for Windows Phone. If you want to create a game, you can do so just by changing some XML, images, and audio files in the Script TD game engine.&amp;nbsp; With this ability, you can create any number of Tower Defense games without having to do any programming!&amp;nbsp; If you want to extend out the engine, it was designed to allow this as well!If you want to learn how to extend the engine, check out the Coding4Fun article!</itunes:summary>
      <pubDate>Tue, 26 Jul 2011 18:24:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/projects/ScriptTD</guid>
      <dc:creator>Clint Rutkas, Larry Larsen</dc:creator>
      <category>windows+phone</category>
      <category>windows-phone-7</category>
      <category>xna</category>
  </item>
  <item>
      <title>Kinect Paint</title>
      <description><![CDATA[<p>Kinect Paint is a skeleton tracking application that allows you to become the paint brush!&nbsp; This application uses the Kinect for Windows SDK and its skeletal tracking feature to create a painting experience.&nbsp; Use several different tools, a simple color palette, and create a masterpiece!</p><p>&nbsp;</p><p><strong>Screenshots</strong></p><p>&nbsp;</p><p><strong><a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250084"><img title="Screen_HowToUse" src="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250085" alt="Screen_HowToUse" width="244" height="154" border="0"></a><a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250086"><img title="Paint_Screen1" src="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250087" alt="Paint_Screen1" width="244" height="154" border="0"></a><a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250090"><img title="Paint_Screen3" src="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250091" alt="Paint_Screen3" width="244" height="154" border="0"></a><a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250094"><img title="Paint_Screen5" src="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250095" alt="Paint_Screen5" width="244" height="154" border="0"></a><a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250096"><img title="Paint_Screen6" src="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=paint&amp;DownloadId=250097" alt="Paint_Screen6" width="244" height="154" border="0"></a></strong></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/coding4fun/rss&WT.dl=0&WT.entryid=Project:RSSView:07a4527eb7184c07a8689f04002cce04">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/projects/Kinect-Paint</comments>
      <link>http://channel9.msdn.com/coding4fun/projects/Kinect-Paint</link>
      <itunes:summary>Kinect Paint is a skeleton tracking application that allows you to become the paint brush!&amp;nbsp; This application uses the Kinect for Windows SDK and its skeletal tracking feature to create a painting experience.&amp;nbsp; Use several different tools, a simple color palette, and create a masterpiece!&amp;nbsp;Screenshots&amp;nbsp;</itunes:summary>
      <pubDate>Thu, 16 Jun 2011 16:23:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/projects/Kinect-Paint</guid>
      <dc:creator>Laurent Bugnion, Evan Lang, Stuart Mayhew</dc:creator>
      <category>kinect</category>
      <category>wpf</category>
  </item>    
</channel>
</rss>
