<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The WaterHobo</title>
	<atom:link href="http://waterhobo.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://waterhobo.com</link>
	<description>DIY Big Boy Toys</description>
	<lastBuildDate>Wed, 12 Sep 2012 16:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Testing WebOS, PhoneGap and Services</title>
		<link>http://waterhobo.com/?p=65</link>
		<comments>http://waterhobo.com/?p=65#comments</comments>
		<pubDate>Wed, 22 Feb 2012 19:47:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PhoneGap]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=65</guid>
		<description><![CDATA[I wrote earlier about creating a WebOS app that called a node.js service that also was written with PhoneGap.  However I did not go into how to test it.  I know this information is all over the place on the &#8230; <a href="http://waterhobo.com/?p=65">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wrote earlier about creating a WebOS app that called a node.js service that also was written with PhoneGap.  However I did not go into how to test it.  I know this information is all over the place on the web, however I posted it here so that I know where it is at and so that anybody else that is trying to develop for WebOS can also find it in one spot.</p>
<p>What I found that worked was to open 3 terminal windows, I should say that I am also using a Mac with lion.  Each of the windows are defined below.</p>
<ol>
<li>Terminal Window 1 – Change to the project directory where the Makefile is located.  In this window we will be running the command “Make” to compile, and deploy the app. to either the device or the emulator.</li>
<li>Terminal Window 2 – Change to the project directory.
<ol>
<li>Entered the command  -&gt; novaterm</li>
<li>Entered the command  -&gt; tail –f /var/log/messages   or tail –f /var/log/messages | grep &lt;packageid&gt;     What this command does is return all of the log messages to this terminal window, if you use the second  option with the grep command plus the package id it will only return the log message for this package id only</li>
</ol>
</li>
<li>Terminal Window 3 – Change to project directory.
<ol>
<li>Entered the command –&gt; novaterm</li>
<li>Entered the command –&gt; luna-send -P -n 1 –f palm://com.waterhobo.cancolor.service//sayhello &#8216;{&#8220;path&#8221;:&#8221;test&#8221;}&#8217;    In this example it has the name of your service (com.waterhobo.cancolor.service), the service id with the method (sayhello) and finally with the parameters (parm “name” and value “test”).  By using this command you can test the service without having the app loaded.</li>
</ol>
</li>
</ol>
<p>It is really simple to see what is happening both your app and services with these commands, being new to WebOS or a Unix/Linux environment I felt pretty helpless trying to debug the services or app until I found these.</p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=65</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhoneGap, WebOS and Services</title>
		<link>http://waterhobo.com/?p=62</link>
		<comments>http://waterhobo.com/?p=62#comments</comments>
		<pubDate>Tue, 21 Feb 2012 20:27:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[TouchPad]]></category>
		<category><![CDATA[WebOS]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=62</guid>
		<description><![CDATA[First let me say I love what PhoneGap offers; easy to get an app up and running on multiple devices in a relative short timeframe.  Having said that, what is lacking is a better understanding of using Plugins or in &#8230; <a href="http://waterhobo.com/?p=62">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First let me say I love what PhoneGap offers; easy to get an app up and running on multiple devices in a relative short timeframe.  Having said that, what is lacking is a better understanding of using Plugins or in the case of WebOS in using node.js services.   What I found out was if you are a noob with a particular OS and trying to learn what was needed to do a certain function it was either assumed that is was so simple and so no samples or it was so complex there were not any samples.  This was the case with me and WebOS, I needed to do a simple little file IO from a PhoneGap app, my app needed to save the canvas data to a local directory.  Sounds very simple, but for someone who is learning the front end (Javascript, Css, and Html) it turned into a very real frustrating experience.  My app which was original written for iOS ported over to WebOS with 1 line change, other than a plugin that I used to save the image/canvas data to the PhotoRoll it went very smoothly.  Don’t get me wrong, I had a similar experience with iOS and will blog about it soon.  I know that what I will write here is probable not the best way to do it, but it worked, I am always looking to learn so if you know how to do something better, please comment.  I put this out here to help me as much as everyone else that is trying to figure how speak to WebOS services from a PhoneGap app that was not written in enyo.</p>
<p>So first I will assume that you have followed the directions from <a href="http://www.phonegap.com">PhoneGap</a> on how to get started with WebOS.  I followed the steps and was able to get the sample app to work both in the emulator and on my touchpad (yes I scored one of the fire sale ones). From there I modified the existing sample app and this is what I will go over.</p>
<p>First, you will need to create a couple of directories,  WebOS requires a total of 3 main folders.  I kept the “framework” folder, this one holds all of the application code (www) that came with the sample, I then created a “service” folder this will hold all of the code needed for the backend or home for the node.js services and finally one called “pack”(will explain lower why I called it pack and not package) for package information that holds the information that ties the services and application code together.</p>
<p>In the framework folder there should be a file called appinfo.json, it is basically the configuration file for the app, not really any changes here and you can find examples all over the place .  This is a sample of mine.</p>
<p>{<br />
&#8220;id&#8221;: &#8220;com.phonegap.webossvctst&#8221;,<br />
&#8220;version&#8221;: &#8220;1.0.0&#8243;,<br />
&#8220;vendor&#8221;: &#8220;Palm&#8221;,<br />
&#8220;type&#8221;: &#8220;web&#8221;,<br />
&#8220;main&#8221;: &#8220;index.html&#8221;,<br />
&#8220;title&#8221;: &#8220;PhoneGap WebOS PG test&#8221;,<br />
&#8220;uiRevision&#8221;: 2<br />
}</p>
<p>In the “index.html” file,  since I knew that it worked, I commented out everything that I knew I did not need in the body, here is a copy of mine.</p>
<p>&lt;html lang=&#8221;en&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;<br />
&lt;title&gt;PhoneGap WebOS&lt;/title&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;phonegap-1.0.0.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
// create global var for sqlite database instance<br />
//    var db;<br />
&lt;/script&gt;</p>
<p>&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;menu.css&#8221;&gt;</p>
<p>&lt;/head&gt;<br />
&lt;body&gt;</p>
<p><span class="kwrd">&lt;</span><span class="html">button</span> <span class="attr">onclick</span><span class="kwrd">=&#8221;testtest();&#8221;</span><span class="kwrd">&gt;</span>test just service<span class="kwrd">&lt;/</span><span class="html">button</span><span class="kwrd">&gt;</span></p>
<p><span class="kwrd">&lt;</span><span class="html">script</span><span class="kwrd">&gt;</span><br />
document.addEventListener(&#8216;deviceready&#8217;, function () {<br />
// PhoneGap is ready, do all your stuf here<br />
}, false);</p>
<p>function testtest()<br />
{<br />
console.log(&#8220;############ ready to to the write service&#8221;);</p>
<p>this.service = navigator.service.Request(&#8216;palm://com.phonegap.webossvctst.service&#8217;,<br />
{<br />
method: &#8216;hello&#8217;, parameters: {&#8220;name&#8221;: &#8220;World&#8221; },<br />
onSuccess:  this.mySuccess.bind(this),<br />
onFailure:  this.myFailure.bind(this)<br />
});<br />
}</p>
<p>function mySuccess(thereturn)</p>
<p>{<br />
console.log(&#8220;write success&#8221;);<br />
navigator.notification.alert(&#8216;sucess webos call=&#8217; + thereturn.reply);<br />
}</p>
<p>function myFailure(thereturn)<br />
{<br />
console.log(&#8220;write failure&#8221;);<br />
navigator.notification.alert(&#8216;fail webos call=&#8217; + thereturn.reply);<br />
}</p>
<p>&lt;/script&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>The key part is in the testtest() function.  You will need to use the navigator.service.Request that PhoneGap offers.  you will also need to put your service id in along with the method calls and parameters that are needed.  In my case you see the method called “hello” being called it has one parameter called “name” and the value I am passing is “World”.   Yes I have basically incorporated the  “Hello World” services example from the developer’s site that is located <a href="https://developer.palm.com/content/api/dev-guide/js-services/creating-hello-world-service.html">here</a> into my phonegap example. It has two return callbacks one for success and one for failure.</p>
<p>&nbsp;</p>
<p>In the Service folder there are 3 files one “sources.json” that stores all of the file configuration data for the services.  One “service.json” that define all of the method calls and parameters for your service and finally in my case “HelloCommandAssistant.js” that stores all of the actual code of the service.</p>
<p>In the services.json file I have included the following.</p>
<p>{<br />
&#8220;id&#8221;: &#8220;com.phonegap.webossvctst.service&#8221;,<br />
&#8220;description&#8221;: &#8220;Hello World Demo Service&#8221;,<br />
&#8220;activityTimeout&#8221; : 30,<br />
&#8220;services&#8221;: [{<br />
"name": "com.phonegap.webossvctst.service",<br />
"description": "helloworld example",<br />
"commands": [{<br />
"name" : "hello",<br />
"assistant" : "HelloCommandAssistant",<br />
"public" : true<br />
}]<br />
}]<br />
}</p>
<p>There are other post on the site that break down what every thing is, but a few notes the id needs to be unique and MUST be under the app’s domain, so if you take the app id from the appinfo.json file and add “.service” to it you are done.  No in case you are wondering can I have a generic service that any other apps I might write can all use the same one, from all I found you can not.</p>
<p>My “sources.json” has the following lines included:</p>
<p>[{<br />
"library": {<br />
"name": "foundations",<br />
"version" : "1.0"<br />
}<br />
},<br />
{<br />
"source": "HelloCommandAssistant.js"<br />
}]</p>
<p>As you can see it identifies that my source code for the service is located in “HelloCommandAssistant.js” file, it also show that we will be using the “foundations” library that is part of the OS.</p>
<p>&nbsp;</p>
<p>In the “HelloCommandAssistant.js” file the following lines have been included.</p>
<p>var HelloCommandAssistant = function() {}</p>
<p>HelloCommandAssistant.prototype.run = function(future) {<br />
console.log(&#8220;***************Hello &#8220;+ this.controller.args.name);<br />
future.result = {reply: &#8220;Hello &#8221; + this.controller.args.name + &#8220;!&#8221;};<br />
}</p>
<p>Key things to note here.  You can see the “this.controller.args.name” is the parameter that was pasted in from the “testtest()” function.  and that the “future.result” is the return callbacks that were defined in the services.json file and index.html file.</p>
<p>&nbsp;</p>
<p>So at this time you have created the folder structure that is needed, you have created each of the files needed and now it is time to compile and test…</p>
<p>Now we need to edit the “Makefile” in the root folder of your project.  Now if you want you can call each of the commands in order, me I preferred to use the makefile.  My change was at the “Package:” label.  I changed it to this:</p>
<p>package:<br />
palm-package framework/www/ service pack</p>
<p>What you will notice is that I have the folder name to the “Application”, the folder name to the “service” and the folder name to the “pack” (package).  Here is also the reason that I named the folder “pack” and not package.  I kept getting an error “Package is up to date”, the second I renamed the folder to “pack” everything compiled and deployed with out any problems.</p>
<p>And that was it. when you ran the app and pushed the button it slide the notification out across the top with the message “Hello World”.  It took me about an hour to make my actual service that I needed for my app.  I have also included a zipped up file of the project that I talk about <a href="http://waterhobo.com/hobofiles/helloworld.zip">here</a>.</p>
<p>A few notes… looking back on the whole experience, this is pretty simple, the biggest problem was me not knowing a few things, I did ask for some help on Stack Overflow and the Nitobi support site as well as the palm developer site.  I did get some help, but it was still a frustrated struggle mainly due to the fact most of the answers were cryptic or too short, they did give me more paths to follow to find the answer, but if only one of them took the time to post something like above and included a example set of files the amount of hours of trial and error would have been about a quarter of what I had to spend.  This frustration has been felt by others as I also saw and have to agree with their comments.  I also understand if you are given everything there is nothing to learn, but that is why we have “Hello World” examples all over the place.  So this is exactly why I have made this post.  I am sure it can be improved on, as I learn a little bit more, I will try and keep it updated.</p>
<p>my next post will be on testing your app from the console, another thing that took me a little while to find from many different sources.  I think these type of problems will exist more and more as we move into cross device programming…</p>
<p>Anyway I still love PhoneGap and recommend it all of the time.  I suggest you follow a bunch of the Nitobi folks on twitter as there is a great deal of good information being past around.  And if you would like to see my app, currently it is in submission to BlackBerry, WebOS and iOS, I am currently working on the Android version. It is called “iCanColor” it is written in PhoneGap, and Jquery Mobile and allows you to use your finger to paint coloring book pages as you move it, do word searches, find your way through the mazes, connect the dots, and play games like hangman and Tic-Tac-Toe.</p>
<p><a href="http://waterhobo.com/wp-content/uploads/2012/02/icon-64.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="icon-64" src="http://waterhobo.com/wp-content/uploads/2012/02/icon-64_thumb.png" border="0" alt="icon-64" width="68" height="68" /></a> The support page is <a href="http://www.waterhobo.com/icancolor/html/index.html">here.</a> Happy PhoneGapping…</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><!-- .csharpcode, .csharpcode pre<br />
{<br />
font-size: small;<br />
color: black;<br />
font-family: consolas, "Courier New", courier, monospace;<br />
background-color: #ffffff;<br />
/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt<br />
{<br />
background-color: #f4f4f4;<br />
width: 100%;<br />
margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br />
--></p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=62</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pachinko Bubble Gumball Machine</title>
		<link>http://waterhobo.com/?p=53</link>
		<comments>http://waterhobo.com/?p=53#comments</comments>
		<pubDate>Thu, 04 Aug 2011 03:14:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Gumball]]></category>
		<category><![CDATA[Pachinko]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=53</guid>
		<description><![CDATA[So where did this idea come from?&#160; Well my wife loved playing pachinko when she was a child at her grandparent’s house.&#160; So when we found a old pachinko machine at a garage sale, it was bought.&#160; Well it sat &#8230; <a href="http://waterhobo.com/?p=53">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://waterhobo.com/wp-content/uploads/2011/08/24.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="24" border="0" alt="24" align="left" src="http://waterhobo.com/wp-content/uploads/2011/08/24_thumb.jpg" width="363" height="484"></a></p>
<p>So where did this idea come from?&nbsp; Well my wife loved playing pachinko when she was a child at her grandparent’s house.&nbsp; So when we found a old pachinko machine at a garage sale, it was bought.&nbsp; Well it sat for a few years and Christmas was coming; I decided it was time to do something with it besides tripping over it.&nbsp; </p>
<p>So the plan was always to build a case around it, but doing just that seemed kind of&nbsp; lame.&nbsp; I then started to think of other things she liked and bubble gumball machines came to mind, now to build it.&nbsp; Of course, I try to use some kind of CPU in my projects and a computer was overkill (ok so was a microprocessor) so I went with an Arduino type board.&nbsp; You have to love these little devices, they are cheap and have a great deal of possible uses.&nbsp; Plus there is a great community of developers for help or code snippets.&nbsp; </p>
<p>The first step was to build the case and not tip my wife off, so I told her I was building something for work, that worked as she was surprised at Christmas(of course I kept the pachinko out of the case until Christmas).&nbsp; The next step was to figure out what type of wood to use.&nbsp; I went with Oak plywood, it would be easy to work with and give me the look I wanted once it was stained and finished.&nbsp; I purchased a 4 x 8 sheet from Home Depot and drew a pattern on it with a pencil in the shapes I wanted.&nbsp; I did not want it perfectly straight and made it with a little angle on the sides.&nbsp;&nbsp; I also knew I would need a compartment where both the gumball mechanics and any electronics would need to be placed.&nbsp; In addition I wanted it to be locked and covered.&nbsp; So all of these parts would also need to be also cut from the Oak plywood.&nbsp; In building the compartment, it also would serve as a shelf for the pachinko machine to rest on so the weight of it would not rest solely on any screws from the sides or top.&nbsp; After cutting, gluing and measuring for the proper spacing for the pachinko machine I had a case I was starting to like.</p>
<p><a href="http://waterhobo.com/wp-content/uploads/2011/08/1.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="1" border="0" alt="1" src="http://waterhobo.com/wp-content/uploads/2011/08/1_thumb.jpg" width="183" height="244"></a>&nbsp;<a href="http://waterhobo.com/wp-content/uploads/2011/08/3.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="3" border="0" alt="3" src="http://waterhobo.com/wp-content/uploads/2011/08/3_thumb.jpg" width="244" height="183"></a><a href="http://waterhobo.com/wp-content/uploads/2011/08/5.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="5" border="0" alt="5" src="http://waterhobo.com/wp-content/uploads/2011/08/5_thumb.jpg" width="183" height="244"></a></p>
<p>&nbsp;</p>
<p>With the case starting to come together I turned my attention to the mechanics of the bubble gum machine.&nbsp; It needed to first work, second be refillable fairly easily and finally prevent the candy from just falling on the floor.&nbsp; To meet all of these requirements, PVC pipe came to mind.&nbsp; The reason is you can get it in different sizes, it is easy to put together, you can clean it and it is pretty cheap.&nbsp; I decided to go with the four inch pipe.&nbsp; This would hold a great deal of candy between refills, there were also plenty of reducers so I could “funnel” the candy down the chute. First I made a little dock to hold the reservoir straight up, next I cut a circle of wood and fashioned a thin piece of metal to act as the dispenser.&nbsp; The challenge here was to make the slot in the side to line up with the board.&nbsp; The best process was cut the slot in the pipe, put the circle board in the pipe, slide in the metal plate and then screw the wood circle in place from outside the pipe.&nbsp; I cut a one inch hole in both the wood circle and the metal plate this allowed for everything that I tested to work great. (Hot Tamales candy, Skittles, Gumballs).&nbsp; Screws on both sides of the metal plate acted as guides when the plate moved back and forth.</p>
<p><a href="http://waterhobo.com/wp-content/uploads/2011/08/13.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="13" border="0" alt="13" src="http://waterhobo.com/wp-content/uploads/2011/08/13_thumb.jpg" width="183" height="244"></a><a href="http://waterhobo.com/wp-content/uploads/2011/08/16.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="16" border="0" alt="16" src="http://waterhobo.com/wp-content/uploads/2011/08/16_thumb.jpg" width="183" height="244"></a><a href="http://waterhobo.com/wp-content/uploads/2011/08/21.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="21" border="0" alt="21" src="http://waterhobo.com/wp-content/uploads/2011/08/21_thumb.jpg" width="244" height="183"></a></p>
<p>Now with the candy ready to go we needed a way to dispense the “reward”.&nbsp; For this I used a cheap hobby servo.&nbsp; The concept, when the switch is triggered, the servo will move to the left for two seconds (open, holes in wood and metal plate lined up) and then move back to the right(closed, holes in wood and metal plate do not line up).&nbsp; I happened to have a <a href="http://www.adafruit.com/category/19&amp;zenid=f86cd34fc5f201566265168c78b13234">BoArduino</a> from another project I was doing so I used it, however any Arduino would work.&nbsp; If you can not soldier then do not use the BoArduino as it is a kit you have to put together.&nbsp;&nbsp; The code was very simple since all I was doing was looking for a “contact” from a switch that would trigger the servo to move back and forth.&nbsp; To power everything, my first thought was I had a 6 volt gel battery around and was going to use that, however after a month it would die and not run anything.&nbsp; So I modified the power setup and just used a 6 volt wall wart and have not had a single problem since then except reloading the balls for the game and refilling the payout… </p>
<p>Probably the single biggest challenge was the “switch”.&nbsp; My first thought was to use a simple contact switch.&nbsp; I needed to fabricate a mount for the switch, however what I found out was the mechanics of the levers were too good.&nbsp; Anything, no matter how light of a touch that interfered with the levers seemed to jam them and either always left it on or never paid out.</p>
<p><a href="http://waterhobo.com/wp-content/uploads/2011/08/9.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="9" border="0" alt="9" src="http://waterhobo.com/wp-content/uploads/2011/08/9_thumb.jpg" width="183" height="244"></a><a href="http://waterhobo.com/wp-content/uploads/2011/08/9b.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="9b" border="0" alt="9b" src="http://waterhobo.com/wp-content/uploads/2011/08/9b_thumb.jpg" width="183" height="244"></a><a href="http://waterhobo.com/wp-content/uploads/2011/08/9a.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="9a" border="0" alt="9a" src="http://waterhobo.com/wp-content/uploads/2011/08/9a_thumb.jpg" width="183" height="244"></a></p>
<p>After much trial and error, I remembered I had bought some conductive ribbon (for some future project <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://waterhobo.com/wp-content/uploads/2011/08/wlEmoticon-smile.png"> ) .&nbsp; With this I connected one wire to the pachinko machine with a screw and gave it a little loop.&nbsp; The other wire to the switch, I wrapped it around a length of the conductive ribbon and looped the other end of the ribbon&nbsp; to one of the levers that moved on a pay out.&nbsp; When the pay out happened, the ribbon touched the other looped wire and we have “contact”.&nbsp; The arduino was happy and so was I.&nbsp; I did however apply a little bit of electric tape looped around the other end of the lever to counter balance the touching of the ribbon to the wire this worked perfectly.&nbsp; </p>
<p>On the pachinko machine itself.&nbsp; I did have to take it completely apart and clean out the wasp nest, and other gunk that was gumming up the tracks that the balls followed.&nbsp; The Glass had been replaced with Plexiglas and that needed to be replaced as I was trying to keep the Pachinko experience as close to original as I could and the balls hitting glass sound much better than Plexiglas.&nbsp; The brass nails were tarnished, but luckily or not the Marine Corps taught us over and over how to use this stuff called “<a href="http://en.wikipedia.org/wiki/Brasso">brasso</a>” it is a pain, but it does work.&nbsp;&nbsp; In fact it worked like a champ and really cleaned up the brass nails that the balls would bounce on.&nbsp; I also had to change the locks as the keys for the pachinko machine’s lock were lost.&nbsp; Not a big deal as I wanted matching keys for locking the dispenser and the pachinko machine, these were easily found on the internet.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:8434f265-e826-48ec-b2c5-1490c4128f67" class="wlWriterEditableSmartContent">
<div><object width="448" height="252"><param name="movie" value="http://www.youtube.com/v/bqKkjC3AJXU?hl=en&amp;hd=1"></param><embed src="http://www.youtube.com/v/bqKkjC3AJXU?hl=en&amp;hd=1" type="application/x-shockwave-flash" width="448" height="252"></embed></object></div>
<div style="width:448px;clear:both;font-size:.8em">A short video of photos taken while making the project</div>
</div>
<p>&nbsp;</p>
<p>And there you have it a Pachinko Gum Ball dispenser.&nbsp; I had to cheat a great deal to test it; I found out I evidently am not a very good Pachinko player as I lost way more than I would ever win.&nbsp; Christmas came and my wife loved it, we have now gone through a huge bag of Skittles, Hot Tamales and a few bags of Gum Balls.&nbsp; So I would have to consider it a successful project&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=53</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>TN Games Vest Get Shot in C#</title>
		<link>http://waterhobo.com/?p=28</link>
		<comments>http://waterhobo.com/?p=28#comments</comments>
		<pubDate>Thu, 10 Feb 2011 19:47:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[TNGames Vest]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=28</guid>
		<description><![CDATA[&#160; I attended the Game Developers Conference (GDC)back in 2008 and saw this vest and fell in love with it.&#160;&#160; It has the ability to let you “Feel” when you get shot or fragged in a game.&#160; I quickly noticed &#8230; <a href="http://waterhobo.com/?p=28">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;<a href="http://waterhobo.com/wp-content/uploads/2011/02/thumb_3rd_space_vest.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="thumb_3rd_space_vest" border="0" alt="thumb_3rd_space_vest" src="http://waterhobo.com/wp-content/uploads/2011/02/thumb_3rd_space_vest_thumb.jpg" width="215" height="145"></a> </p>
<p>I attended the Game Developers Conference (GDC)back in 2008 and saw this vest and fell in love with it.&nbsp;&nbsp; It has the ability to let you “Feel” when you get shot or fragged in a game.&nbsp; I quickly noticed how you change the way you play when you wear it because you know the “pain” is coming when you get shot.&nbsp; Ok not really pain, but an air pocket inflates where you are shot.&nbsp;&nbsp; I was even more lucky when my wife decided to get me one for my birthday that year.&nbsp; I played it with many different game but of course in the Waterhobo fashion I wanted more.&nbsp;&nbsp;&nbsp; </p>
<p>I had hoped to have the vest connected and usable with the WiFi Warthogs at the PDC, but it was not meant to be.&nbsp; There is a SDK, but it is a C++ unmanaged code.&nbsp; On top of that it did not have any dlls but only the header and library file.&nbsp; Of course I am not a C++ person, my C skills are dated and I could not really get any help from TN Games or for that matter the internet.&nbsp; So it meant C++ here I come, so if you know C++ and see something that could be better please comment on a better way.&nbsp; I can say that what I put together did work.&nbsp; </p>
<p>First I needed to turn the C++ unmanaged code into a dll that could be imported into a C# managed dll.&nbsp; I happened to find a code snipped that kind of met my needs, not perfect, but&nbsp; it did put me on the right path.&nbsp;&nbsp; Below is the code that allowed me to make the unmanaged dll that I would need in order make the managed one.&nbsp; I got it to work fine, but I am not the most qualified to explain it.&nbsp; The parts to note are the linking of the tngaming.lib and the header file that explain the sdk from TN Games.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 110.14%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #008000">// vest.cpp : Defines the exported functions for the DLL application.</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000">//</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #cc6633">#include</span> <span style="color: #006080">"stdafx.h"</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #cc6633">#include</span> <span style="color: #006080">"vest.h"</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #cc6633">#include</span> <span style="color: #006080">"tngaming.h"</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #008000">/* --- link library */</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> <span style="color: #cc6633">#pragma</span> comment(lib,<span style="color: #006080">"tngaming.lib"</span>)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> <span style="color: #008000">// This is an example of an exported variable</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> VEST_API <span style="color: #0000ff">int</span> nvest=0;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> <span style="color: #008000">// This is an example of an exported function.</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span> VEST_API <span style="color: #0000ff">int</span> setupvest(<span style="color: #0000ff">void</span>)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>     <span style="color: #0000ff">return</span> SetUpJacket();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span> VEST_API <span style="color: #0000ff">void</span> shutdownvest(<span style="color: #0000ff">void</span>)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>      TearDownJacket();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span> VEST_API <span style="color: #0000ff">int</span> vestseteffect(<span style="color: #0000ff">int</span> nEffect)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>     <span style="color: #0000ff">return</span> SetEffect(nEffect);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span> VEST_API <span style="color: #0000ff">int</span> vestseteffect2(<span style="color: #0000ff">int</span> speed, <span style="color: #0000ff">int</span> actuator)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>     <span style="color: #0000ff">return</span> SetEffect2(speed,actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span> VEST_API <span style="color: #0000ff">int</span> vestgeterrorcode(<span style="color: #0000ff">void</span>)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45">  45:</span>     <span style="color: #0000ff">return</span> GetErrorCode();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46">  46:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47">  47:</span> VEST_API <span style="color: #0000ff">int</span> vestgeterrortext(<span style="color: #0000ff">void</span>)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48">  48:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49">  49:</span>     <span style="color: #0000ff">if</span> (SetUpJacket()  != GLIB_OK)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50">  50:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51">  51:</span>         <span style="color: #008000">//printf("Error: %s", GetErrorText());</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52">  52:</span>         <span style="color: #0000ff">return</span> 2;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53">  53:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54">  54:</span>     <span style="color: #0000ff">return</span> 42;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55">  55:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56">  56:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57">  57:</span> VEST_API <span style="color: #0000ff">void</span> vestflushbuffer(<span style="color: #0000ff">int</span> actuator)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58">  58:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59">  59:</span>     FlushBuffer(actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60">  60:</span>     </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61">  61:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62">  62:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63">  63:</span> <span style="color: #008000">// This is the constructor of a class that has been exported.</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64">  64:</span> <span style="color: #008000">// see vest.h for the class definition</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65">  65:</span> Cvest::Cvest()</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66">  66:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67">  67:</span>     <span style="color: #0000ff">return</span>;</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68">  68:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>&nbsp;</p>
<p>Now with the unmanaged code library built it is a simple matter of importing it into a C# wrapper.&nbsp; Then another simple process of&nbsp; creating a test harness to call our new dll and test all of the functionality.</p>
<p>A few notes on the dll building process, I put everything together as best as I could based my limited C++ knowledge and the included SDK documentation.&nbsp; The test harness works fine, but a few things I did notice.&nbsp; It is possible I did something wrong with the C++; so if you know C++ please let me know, but it seems as if the TN Games sdk does not match the documentation.&nbsp; The return codes did not come back as stated, enum did not work as stated, you do not get error statuses if you do not set the vest up first as stated in the documentation.&nbsp; Again I do not know if it is me, the documentation, the TN Games lib file or a combination of all that I did not get everything to match the documentation; so this is my only disclaimer.&nbsp; So on with the show&#8230;</p>
<p>In the code below I am importing the unmanaged code into my C# dll, I am also defining all the functions that will be called.&nbsp; They are a match to the C++ dll functions, so this is just a pass through from C# to C++.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> TNGamesVest</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #008000">//need to import all of the functions from TNGames.lib vest.dll is the C++ wrapper around the TNGames lib</span></pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>, EntryPoint = <span style="color: #006080">"?setupvest@@YAHXZ"</span>)] <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">int</span> setupvest();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>, EntryPoint=<span style="color: #006080">"?shutdownvest@@YAXXZ"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span>  <span style="color: #0000ff">void</span> shutdownvest();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>, EntryPoint=<span style="color: #006080">"?vestseteffect@@YAHH@Z"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">int</span> vestseteffect(<span style="color: #0000ff">int</span> nEffect);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>,EntryPoint=<span style="color: #006080">"?vestseteffect2@@YAHHH@Z"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">int</span> vestseteffect2(<span style="color: #0000ff">int</span> speed, <span style="color: #0000ff">int</span> actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>,EntryPoint=<span style="color: #006080">"?vestgeterrorcode@@YAHXZ"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">int</span> vestgeterrorcode();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>,EntryPoint=<span style="color: #006080">"?vestgeterrortext@@YAHXZ"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">int</span> vestgeterrortext();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     [DllImport(<span style="color: #006080">"vest.dll"</span>,EntryPoint=<span style="color: #006080">"?vestflushbuffer@@YAXH@Z"</span>)] <span style="color: #0000ff">static</span> <span style="color: #0000ff">extern</span> <span style="color: #0000ff">void</span> vestflushbuffer(<span style="color: #0000ff">int</span> actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> SetupVest()</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>         <span style="color: #0000ff">return</span> setupvest();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ShutDownVest()</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>         shutdownvest();</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> SetEffect(<span style="color: #0000ff">int</span> myEffect)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>         <span style="color: #0000ff">return</span> vestseteffect(myEffect);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">int</span> SetEffect2(<span style="color: #0000ff">int</span> speed, <span style="color: #0000ff">int</span> actuator)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>         <span style="color: #0000ff">return</span> vestseteffect2(speed, actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> FlushVestBuffer(<span style="color: #0000ff">int</span> actuator)</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>     {</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>         vestflushbuffer(actuator);</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>     }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> }</pre>
<p><!--CRLF-->
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>&nbsp;</p>
<p>Now that we have the dll made it is a simple process of importing the dll into our project and building a test harness. </p>
<p>This is a screen shot of our test harness.</p>
<p><a href="http://waterhobo.com/wp-content/uploads/2011/02/testharness.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="testharness" border="0" alt="testharness" src="http://waterhobo.com/wp-content/uploads/2011/02/testharness_thumb.jpg" width="270" height="355"></a> </p>
<p>At this point you can test the functionality of the vest.&nbsp; you will first plug the vest&nbsp; into the USB port&nbsp; and have everything setup like you would if you were playing a game.&nbsp; You are ready to now just step through each of the steps.&nbsp; First&nbsp; initialize the vest, you do this via the setup vest button.&nbsp; Next if you read the documentation from TN Games that comes with their SDK you will be able to select the different effects to see exactly what each means (machine gun, grenade, etc.).&nbsp; You will also be able to test each of the bellows to simulate being shot in different areas.</p>
<p>In summary, I really wished I was able to have gotten this ready for the PDC, I think it would have added a cool twist to the Wi-Fi Warthogs.&nbsp; So what is next?&nbsp; ARE YOU KIDDING… now that we have a C# dll the sky is the limited.&nbsp; How about getting shot from a web page?&nbsp; Or How about&nbsp; every time you get an email you also get a grenade effect.&nbsp; Maybe put a service in the cloud that allows me to play a SilverLight MMO game and when someone shoots me or hits me I know it.&nbsp; Of course XNA with XBox live would be fun, but TN Games appears to have beat me there, oh well there is SilverLight/XNA for Windows Phone 7, Bluetooth to pc and a service to the vest, yes that might work…</p>
<p>This is the source code that I&nbsp; <a href="http://www.waterhobo.com/hobofiles/TnGamesVest.zip" target="_blank">made</a>.&nbsp; I do ask if you decide to use this that you at least give me credit for figuring out this much.&nbsp; TN Games now if you are looking for a tester or someone to maybe take this in another direction drop me a line at <a href="mailto:tbh726@gmail.com">tbh726@gmail.com</a> i would love to play some more…</p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Waterhobo 2 – Strike Back</title>
		<link>http://waterhobo.com/?p=17</link>
		<comments>http://waterhobo.com/?p=17#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:26:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WaterHobo Fun]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Robotics]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=17</guid>
		<description><![CDATA[After fighting the rabbits all summer we needed to up the stakes.  The first version brought out many flaws.  First we could not turn the water pressure up all the way as it stretched some of the water lines and &#8230; <a href="http://waterhobo.com/?p=17">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: 'Comic Sans MS';">After fighting the rabbits all summer we needed to up the stakes.  The first version brought out many flaws.  First we could not turn the water pressure up all the way as it stretched some of the water lines and slowed and limited the range of the water gun.  Also it only went back and forth, and at night the IR was not very strong.  Sooooo…</span></p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:df80e699-dc08-4ad8-9f8d-1b3aac30d4d6" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div><object width="545" height="306"><param name="movie" value="http://www.youtube.com/v/T7bOBiXCTWE?hl=en&amp;hd=1" /><embed type="application/x-shockwave-flash" width="545" height="306" src="http://www.youtube.com/v/T7bOBiXCTWE?hl=en&amp;hd=1"></embed></object></div>
<div style="width: 545px; clear: both; font-size: .8em;">Hobo 2</div>
</div>
<p><span style="font-family: 'Comic Sans MS';">This year we also switched out a great deal of the electronics and software.  Last year a Phidgets single servo controller was used, this year I switch to a Polou 8 servo serial controller.  I also added a pan and tilt setup so that the gun could go up and down besides going from left to right.  The copper tubing was switched with a plastic ice maker hose,  and just to add to the fun two in ground pop up sprinklers were added. </span></p>
<p><span style="font-family: 'Comic Sans MS';">The pan and tilt setup came from </span><a href="http://www.servocity.com/"><span style="font-family: 'Comic Sans MS';">ServoCity</span></a><span style="font-family: 'Comic Sans MS';"> in fact the servos and any parts for the servos came from here.</span></p>
<p><span style="font-family: 'Comic Sans MS';">Again this year I used Andrew’s AForge libraries for the motion detection, he has moved to a new site it can be found </span><a href="http://www.aforgenet.com/"><span style="font-family: 'Comic Sans MS';">here</span></a><span style="font-family: 'Comic Sans MS';">.   I was able to modify his code and add in different functionality that I wanted. It also has some great examples and the forums are great for answers.</span></p>
<p><span style="font-family: 'Comic Sans MS';">One piece of code that made life very easy was written by Colin Karpfinger, his examples made the jump to the Polou servo controller a nice easy one.  He can be found </span><a href="http://colinkarpfinger.com/blog/2008/using-the-pololu-servo-controller-in-net/"><span style="font-family: 'Comic Sans MS';">here</span></a><span style="font-family: 'Comic Sans MS';">.</span></p>
<p><span style="font-family: 'Comic Sans MS';">For most of the parts(servo controller, wire, etc) I got them from Trossen Robotics they can be found </span><a href="http://www.trossenrobotics.com/"><span style="font-family: 'Comic Sans MS';">here</span></a><span style="font-family: 'Comic Sans MS';">.  Not only can you get the parts here, but you can get some great help from the community in their forums.</span></p>
<p><span style="font-family: 'Comic Sans MS';">How did it all fair? That will be in the next post.  There were some success and some failures.  At that time I will go more in the the code and some of the videos of it in action…</span></p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=17</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wi-Fi Warthogs have posted</title>
		<link>http://waterhobo.com/?p=16</link>
		<comments>http://waterhobo.com/?p=16#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:16:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WiFi WartHogs]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[PowerWheels]]></category>
		<category><![CDATA[Robotics]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=16</guid>
		<description><![CDATA[Coding4Fun has published my article on their site and  you can read it here.  It breaks down how I built them and has links to the code base and where I purchased most of the parts.  Also I found this &#8230; <a href="http://waterhobo.com/?p=16">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Coding4Fun has published my article on their site and  you can read it <a href="http://blogs.msdn.com/coding4fun/archive/2010/01/18/9950111.aspx" target="_blank">here</a>.  It breaks down how I built them and has links to the code base and where I purchased most of the parts.  Also I found this great video that someone created while out at the PDC on the cars.  It is me explaining everything in detail.</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:9426fc11-aef0-4cdb-ab34-df39bf6d572e" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div><object width="448" height="252"><param name="movie" value="http://www.youtube.com/v/sJDjQKR0kpg?hl=en&amp;hd=1" /><embed type="application/x-shockwave-flash" width="448" height="252" src="http://www.youtube.com/v/sJDjQKR0kpg?hl=en&amp;hd=1"></embed></object></div>
<div style="width: 448px; clear: both; font-size: .8em;">At PDC 09</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=16</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WiFi WartHogs</title>
		<link>http://waterhobo.com/?p=15</link>
		<comments>http://waterhobo.com/?p=15#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:14:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WiFi WartHogs]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[PowerWheels]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[WiFi]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=15</guid>
		<description><![CDATA[the water gun idea worked great for the most part, but now them rabbits are coming down the other side of the house and by passing the gun.  So I had a thought; what about going mobile.  But for this &#8230; <a href="http://waterhobo.com/?p=15">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: 'Comic Sans MS';">the water gun idea worked great for the most part, but now them rabbits are coming down the other side of the house and by passing the gun.  So I had a thought; what about going mobile.  But for this idea we were going to need a great deal more thought.  Well the idea got started and like most ideas it morphed into something that sounded like way to much fun not to build.  So I made the car, and mounted a water gun on it, and even shot water out of it, but in the end it never made it to the battle field.  Instead it was turned into WiFi Warthogs,  a Laser Tag game.  It can be played by a minimum of 2 players (one for each car), but can go to any number of players real quick, it all depends on the number of cars you wish to use.  Here is a video of it in play.</span></p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:6036a5b3-d54a-4af1-9838-98ba80cf639e" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div><object width="490" height="275"><param name="movie" value="http://www.youtube.com/v/eLUwF9S6qDc?hl=en&amp;hd=1" /><embed type="application/x-shockwave-flash" width="490" height="275" src="http://www.youtube.com/v/eLUwF9S6qDc?hl=en&amp;hd=1"></embed></object></div>
<div style="width: 490px; clear: both; font-size: .8em;">Pre PDC</div>
</div>
<p><span style="font-family: 'Comic Sans MS';"> </span></p>
<p><span style="font-family: 'Comic Sans MS';">In this video you see two cars and there were only two players.  The players are using XBox 360 controllers to control the cars.  A player can be either the driver or the gunner if there is only one player per car.  If there are two players per car then one is the driver one is the gunner.  When you see the cars stopped, it is because the driver has switched to gunner mode and is in the process of shooting.  Yes if your car gets hit you will get feedback in the form of the controller shaking and lights on the gun.</span></p>
<p><span style="font-family: 'Comic Sans MS';">The cars will be out at the PDC this year if you are going, stop by and try them out…  I will be breaking them down on exactly how I built them on the Coding4Fun site, the site can be found </span><a href="http://channel9.msdn.com/coding4fun"><span style="font-family: 'Comic Sans MS';">here</span></a><span style="font-family: 'Comic Sans MS';">.   It should appear there some time in December 09.</span></p>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=15</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How the WaterHobo got started&#8230;</title>
		<link>http://waterhobo.com/?p=8</link>
		<comments>http://waterhobo.com/?p=8#comments</comments>
		<pubDate>Thu, 10 Feb 2011 04:14:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WaterHobo Fun]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[robots]]></category>

		<guid isPermaLink="false">http://waterhobo.com/?p=8</guid>
		<description><![CDATA[This post was originally done back in 2007, everyone was after me to start blogging some of my projects so I converted the web page to a blog&#8230; the rest is history as they say&#8230; &#160; Ever Diligent Ever Watching &#8230; <a href="http://waterhobo.com/?p=8">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post was originally done back in 2007, everyone was after me to start blogging some of my projects so I converted the web page to a blog&#8230; the rest is history as they say&#8230;</p>
<p>&nbsp;</p>
<h4><span style="text-decoration: underline;">Ever Diligent Ever Watching </span></h4>
<p>&nbsp;</p>
<p><a href="http://waterhobo.com/hobofiles/1.jpg"><img style="display: inline; border-width: 0px;" title="1[1]" src="How-the-WaterHobo-got-startede280a6.aspx_files/image.jpg" border="0" alt="1[1]" width="194" height="244" /></a></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">Once upon a time a subdivision swimming pool caused a minor problem, but to a problem solving geek a problem is a problem that needs an answer.  So what were the problem and the solution?  Well for all you legal types it is rabbits eating in my garden.  So for the sake of this discussion we are talking about rabbits, however I must make a disclaimer that in motion detection and auto fire if an unwitting person is trespassing on my property and happens to walk into the field of fire&#8230; well we will refer to them as collateral damage.  Well the problem was Adult rabbits and little rabbits cutting between two houses instead of just walking an extra few feet to the pathway to the concrete pond. The little rabbits were never really the problem, it was the adults, there is nothing like being on your deck and some adult rabbit cutting between your house and the neighbor&#8217;s and they just look at you like &#8220;What is there something wrong?&#8221; Never asking if it was ok, just doing it.  Some how I have to believe they would have an issue if I say ran laps around their house for my exercise program, but I digress&#8230; So I have this problem of rabbits cutting in my yard, it does not matter the time and of course it is from Memorial day to Labor day, before and after that time frame the traffic reduces greatly.  Of course the most active time is during swim meet season when I also have to deal with an extra 100 rabbits or so from different subdivisions.  Ok I have a problem, so I must have goals or objectives that have to be met in order for the ROI to be there.  So my defined goals were:</span></p>
<ul>
<li>
<ul>
<li>
<ul>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must have automatic fire ability </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to detect motion </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to record the event </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to turn off auto fire mode and take on manual control </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to &#8220;Water the Lawn&#8221; </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to cover a 30 foot field of fire </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must have a range of about 25 to 35 feet </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must have the ability to work at night with all of the above features </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Must be able to Play back any recordings and laugh while sitting on the deck drinking a beer. </span></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">So what was the solution?  This I pondered and opened up my book of knowledge called the Internet and using the glorious thing called searching, I started to come up with an idea.  The picture above is actually prototype number two.  I will briefly talk about Prototype one, but since media player in a browser has a 5 second buffer(yes I tried to override it, but it ignored my override values) that I can not override anywhere, I had to move on to version two.  To meet the requirements/objectives I decided the first prototype needed the following items.</span></p>
<ul>
<li>
<ul>
<li>
<ul>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">X10 120 volt outlet </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">X10 Transmitter and Receiver </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">X10 Libraries that would work with </span><a href="http://brian.vallelunga.com/code/x10/"><span style="font-family: 'Comic Sans MS'; font-size: small;">C#</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">In ground sprinkler solenoid </span></li>
<li><a href="http://www.trossenrobotics.com/store/c/2665-Servo-Controllers.aspx"><span style="font-family: 'Comic Sans MS'; font-size: small;">Phidget single servo board with servo</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Phidget C# </span><a href="http://www.phidgets.com/downloads.php?os_id=1"><span style="font-family: 'Comic Sans MS'; font-size: small;">libraries</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">PVC pipe, Copper Ice maker pipe, and a few other plumbing parts </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Old computer, 1.7 GHz with a gig of ram </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">USB Web camera </span></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">Like I said above I ran into a problem with media player in a browser, so if anyone know the answer to this problem please let me know.  Here is some photos and video of prototype one.</span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"><img src="http://waterhobo.com/hobofiles/2.jpg" border="0" alt="" hspace="0" width="493" height="311" /></span></p>
<p><a href="http://waterhobo.com/hobofiles/video_003_pc.avi"><span style="font-family: 'Comic Sans MS'; font-size: small;">Video of version 1 from the console, note the delay in the video </span></a></p>
<p><strong><span style="font-family: 'Comic Sans MS'; font-size: small;">**** Video is a 6 meg file, still learning on making the format &#8220;Web&#8221; friendly  *** </span></strong></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">As you can see I have met a bunch of my goals in prototype 1, I can shoot about 30 feet and can cover a field of fire of about 30 feet.  I can also control the movement of the barrel by a servo and a Phidget device.  In this version in the top bunker &#8220;Window&#8221; I have a web camera mounted to the barrel and it shows the video of what it sees as the barrel moves. I control this all via a web page that was written in C# and using ASP 2.0 with a little bit of Ajax thrown in.  But as I have said before media player force me to version 2.</span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">One issue that I did want to point out is when dealing with controlling your phidget devices from a web page, I ran into a state problem.  the solution was to declare the phidget variable as a static variable.  This allowed me to maintain control over the servos between postbacks.  I do believe a better answer which I am working on is to create all calls to the servo and X10 from a web service.  I have included the code to the web service, it still needs some work on it, namely turning everything into a singleton type call, I do not want multiple instances of the object.</span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">static Phidgets.Servo enc1;</span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"><img src="http://waterhobo.com/hobofiles/hose.JPG" border="0" alt="" hspace="0" width="474" height="239" /></span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">So what is version 2 and what lessons did we learn in version 1?  Well in version 1, I found out latency is not your friend; you have about 6 seconds to before target was out of range and also that cheap water hoses will burst under pressure. &#8220;Rabbits&#8221; are stupid, if they walk to close to either house they feel enclosed, so they walk right down the middle, giving a great field of fire.  They also react to sound, it will either make them stop and look for the sound or at the least keep walking but look for the sound, and this offers great photo shoot opportunities.    Another lesson learnt was that X10 works, but could work better, in time I will just switch to relays.  The in ground sprinkler solenoid worked great, it offered almost instant on, and has only a 2 second wait to turn off (time for solenoid to release). Version 2 needed to do everything version 1could do and then some, so back to the drawing board. </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">I decided to go back to a thick client, dump the web camera and moved to an Infrared camera.  The most important upgrade was to an open source library that I found called Aforge.  Andrew Kirillov has done a fantastic job with his </span><a href="http://code.google.com/p/aforge/"><span style="font-family: 'Comic Sans MS'; font-size: small;">library</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> .  It held the foundation of version 2&#8242;s code base.  It provided me with the motion detection I needed plus had an avi writer sample.  He also had some great topics on &#8220;codeproject.com&#8221; on uses of his library.  This is what had me replace the web camera with an IP camera. Other thing that I did was replace all hoses with PVC pipe, I liked the easy setup and flexibility of the hose, but they can not hold up to the pressure day after day.  So to recap I still am using the same turret concept in version 1 that was in version 2.  I removed the mobile web camera and now have a fixed infrared camera, replaced all hoses with PVC pipes.  Added Aforge libraries and his Camera control.  Added in sound and ability to record from the point of motion to a fixed time after motion is no longer detected.  And finally switched to a thick windows client.  This is some finished photos: </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"><img src="http://waterhobo.com/hobofiles/3.jpg" border="0" alt="" hspace="0" width="722" height="316" /></span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"><img src="http://waterhobo.com/hobofiles/4.jpg" border="0" alt="" hspace="0" width="591" height="420" /></span></p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:888de06b-3afe-44ac-880c-799758b46e3b" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div><object width="579" height="324"><param name="movie" value="http://www.youtube.com/v/FNP6cAg4X7s?hl=en&amp;hd=1" /><embed type="application/x-shockwave-flash" width="579" height="324" src="http://www.youtube.com/v/FNP6cAg4X7s?hl=en&amp;hd=1"></embed></object></div>
<div style="width: 579px; clear: both; font-size: .8em;">This how to train the rug rats…</div>
</div>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:030d49a3-4c29-45ce-bdde-5d2eba5440d5" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div><object width="574" height="322"><param name="movie" value="http://www.youtube.com/v/irqHWEPM1OE?hl=en&amp;hd=1" /><embed type="application/x-shockwave-flash" width="574" height="322" src="http://www.youtube.com/v/irqHWEPM1OE?hl=en&amp;hd=1"></embed></object></div>
<div style="width: 574px; clear: both; font-size: .8em;">All of the random shots…</div>
</div>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">Yes I know that the plumbing could be better, but this is only a prototype, in fact some of it will disappear based on lessons/enhancements that will be made to version 2 that is why it is called a prototype so we can learn. </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">The code is very simple most of the complexity was already done for me by some of the others who created the libraries that I am using.  I simply put a bunch of parts together, some of the things that I did, plus some of the changes to the libraries; I will go over.  Like I stated before, each of the libraries have good working samples and I would suggest you start there.  From that point you can work any of the code I did into your projects as you like. </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">This method shows all of the functionality in one call so I am showing it for its simplicity.</span></p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 111.83%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;">   1:</span> MyGun myGun = <span style="color: #0000ff;">new</span> MyGun();  <span style="color: #008000;">//defined at the form level as I use this object for manual control also.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 99.58%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 16px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;">   2:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;">   3:</span>          <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> HolyHandGrenade()</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;">   4:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;">   5:</span>             log += <span style="color: #006080;">"In Holy Grenade "</span> + DateTime.Now.ToString() + <span style="color: #006080;">" ,"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;">   6:</span>             SoundPlayer sp = <span style="color: #0000ff;">new</span> SoundPlayer(<span style="color: #006080;">"Daffy04.wav"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 95.41%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 16px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060;">   7:</span>             sp.Play();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum8" style="color: #606060;">   8:</span>             myGun.Grenade();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum9" style="color: #606060;">   9:</span>             sp = <span style="color: #0000ff;">new</span> SoundPlayer(<span style="color: #006080;">"Sam35.wav"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum10" style="color: #606060;">  10:</span>             sp.Play();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum11" style="color: #606060;">  11:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum12" style="color: #606060;">  12:</span>             <span style="color: #008000;">// leave  on for 10 seconds, servo is moving back and forth at this time </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum13" style="color: #606060;">  13:</span>             Thread.Sleep(10000);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum14" style="color: #606060;">  14:</span>             <span style="color: #0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum15" style="color: #606060;">  15:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum16" style="color: #606060;">  16:</span>                 <span style="color: #0000ff;">if</span> (thread.IsAlive)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum17" style="color: #606060;">  17:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum18" style="color: #606060;">  18:</span>                     thread.Abort();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum19" style="color: #606060;">  19:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum20" style="color: #606060;">  20:</span>                 <span style="color: #008000;">// kill the current thread </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum21" style="color: #606060;">  21:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum22" style="color: #606060;">  22:</span>             <span style="color: #0000ff;">catch</span> (Exception e)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum23" style="color: #606060;">  23:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum24" style="color: #606060;">  24:</span>                 bridgeErrMsg += <span style="color: #006080;">",BridgeViewer.HolyGrenade =&gt; "</span> + e.Message + <span style="color: #006080;">" "</span> + myGun.errmsg;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum25" style="color: #606060;">  25:</span>                 log += <span style="color: #006080;">"In Holy Grenade execp "</span> + DateTime.Now.ToString() + <span style="color: #006080;">" ,"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum26" style="color: #606060;">  26:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum27" style="color: #606060;">  27:</span>             <span style="color: #0000ff;">finally</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum28" style="color: #606060;">  28:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum29" style="color: #606060;">  29:</span>                 myGun.ReLoadGun();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum30" style="color: #606060;">  30:</span>                 log += <span style="color: #006080;">"In Holy Grenade finally "</span> + DateTime.Now.ToString() + <span style="color: #006080;">" ,"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum31" style="color: #606060;">  31:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum32" style="color: #606060;">  32:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum33" style="color: #606060;">  33:</span></pre>
<p><!--CRLF--></p>
</div>
</div>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span><span style="font-family: 'Comic Sans MS'; font-size: small;">One of the more important things (this is also demonstrated in the Aforge samples, it is what I followed ) is that you will need to setup some events in your code that will be triggered by the Camera control.  The events that I am currently using are the &#8220;NewFrame&#8221; and &#8220;Alarm&#8221; events. They are setup by the OpenVideoSource and CloseVideoSource method calls.  Needless to say the Alarm event is fired every time motion is detected.  The key thing to remember here is that the alarm is firing with every new frame that the camera takes that is many in a second.  I only want to fire the gun if it is not currently firing and motion is detected.  In the NewFrame event this is fired every time the camera takes a picture, again remember this is many times a second.  This event is where the code is writing to an AVI file frame by frame, but this too I wanted to control, so if I did not want to capture everything to video I could override the defaults.  My future plan here will be to replace the current AVI writer with one using Directx so I will be able to capture video and sound.  Also I plan to add a gun site to the frames here so in manual mode you will be able to see a cross hair and it would move as you would move a joystick.</span></p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 110.45%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;">   1:</span> <span style="color: #008000;">// On alarm Event </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;">   2:</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> camera_Alarm(<span style="color: #0000ff;">object</span> sender, System.EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;">   3:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;">   4:</span>         timeLastAlarm = DateTime.Now;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;">   5:</span>         AlarmOn = <span style="color: #0000ff;">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;">   6:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060;">   7:</span>         <span style="color: #0000ff;">if</span> (AutoFire == <span style="color: #0000ff;">true</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum8" style="color: #606060;">   8:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum9" style="color: #606060;">   9:</span>            <span style="color: #0000ff;">if</span> (gunOn == <span style="color: #0000ff;">false</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum10" style="color: #606060;">  10:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum11" style="color: #606060;">  11:</span>                 log += <span style="color: #006080;">"Gun on "</span> + DateTime.Now.ToString() + <span style="color: #006080;">" ,"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum12" style="color: #606060;">  12:</span>                 gunOn = <span style="color: #0000ff;">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum13" style="color: #606060;">  13:</span>                 thread = <span style="color: #0000ff;">new</span> Thread(<span style="color: #0000ff;">new</span> ThreadStart(HolyHandGrenade));</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum14" style="color: #606060;">  14:</span>                 thread.Start();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum15" style="color: #606060;">  15:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum16" style="color: #606060;">  16:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum17" style="color: #606060;">  17:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum18" style="color: #606060;">  18:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum19" style="color: #606060;">  19:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum20" style="color: #606060;">  20:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum21" style="color: #606060;">  21:</span>     <span style="color: #008000;">// On new frame </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum22" style="color: #606060;">  22:</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> camera_NewFrame(<span style="color: #0000ff;">object</span> sender, System.EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum23" style="color: #606060;">  23:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum24" style="color: #606060;">  24:</span>         DateTime now = DateTime.Now;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum25" style="color: #606060;">  25:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum26" style="color: #606060;">  26:</span>         <span style="color: #0000ff;">if</span>(timeLastAlarm.AddMinutes(minsAfterLastAlarm) &lt; now &amp;&amp; writer != <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum27" style="color: #606060;">  27:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum28" style="color: #606060;">  28:</span>             writer.Close();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum29" style="color: #606060;">  29:</span>             writer.Dispose();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum30" style="color: #606060;">  30:</span>             writer = <span style="color: #0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum31" style="color: #606060;">  31:</span>             AlarmOn = <span style="color: #0000ff;">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum32" style="color: #606060;">  32:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum33" style="color: #606060;">  33:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum34" style="color: #606060;">  34:</span>         <span style="color: #0000ff;">if</span> (Rec == <span style="color: #0000ff;">true</span> &amp;&amp; AlarmOn == <span style="color: #0000ff;">true</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum35" style="color: #606060;">  35:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum36" style="color: #606060;">  36:</span>             <span style="color: #008000;">// lets save the frame</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum37" style="color: #606060;">  37:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum38" style="color: #606060;">  38:</span>             <span style="color: #0000ff;">if</span> (writer == <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum39" style="color: #606060;">  39:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum40" style="color: #606060;">  40:</span>                 <span style="color: #008000;">// create file name </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum41" style="color: #606060;">  41:</span>                 DateTime date = DateTime.Now;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum42" style="color: #606060;">  42:</span>                 String fileName = String.Format(<span style="color: #006080;">"{0}-{1}-{2} {3}-{4}-{5}.avi"</span>,</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum43" style="color: #606060;">  43:</span>                     date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum44" style="color: #606060;">  44:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum45" style="color: #606060;">  45:</span>                 <span style="color: #0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum46" style="color: #606060;">  46:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum47" style="color: #606060;">  47:</span>                     OpenWriter(fileName, cameraWindow.Camera.Width, cameraWindow.Camera.Height);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum48" style="color: #606060;">  48:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum49" style="color: #606060;">  49:</span>                 <span style="color: #0000ff;">catch</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum50" style="color: #606060;">  50:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum51" style="color: #606060;">  51:</span>                     <span style="color: #0000ff;">if</span> (writer != <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum52" style="color: #606060;">  52:</span>                     {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum53" style="color: #606060;">  53:</span>                         writer.Dispose();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum54" style="color: #606060;">  54:</span>                         writer = <span style="color: #0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum55" style="color: #606060;">  55:</span>                     }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum56" style="color: #606060;">  56:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum57" style="color: #606060;">  57:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum58" style="color: #606060;">  58:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum59" style="color: #606060;">  59:</span>             <span style="color: #008000;">// save the frame </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum60" style="color: #606060;">  60:</span>             <span style="color: #0000ff;">try</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum61" style="color: #606060;">  61:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum62" style="color: #606060;">  62:</span>                 <span style="color: #008000;">// save the frame </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum63" style="color: #606060;">  63:</span>                 MotionDetector.Camera camera = cameraWindow.Camera;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum64" style="color: #606060;">  64:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum65" style="color: #606060;">  65:</span>                 camera.Lock();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum66" style="color: #606060;">  66:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum67" style="color: #606060;">  67:</span>                 <span style="color: #008000;">// dispose old frame </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum68" style="color: #606060;">  68:</span>                 <span style="color: #0000ff;">if</span> (bmpLastFrame != <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum69" style="color: #606060;">  69:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum70" style="color: #606060;">  70:</span>                     bmpLastFrame.Dispose();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum71" style="color: #606060;">  71:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum72" style="color: #606060;">  72:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum73" style="color: #606060;">  73:</span>                 Bitmap bmpSource = camera.LastFrame;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum74" style="color: #606060;">  74:</span>                 bmpLastFrame = (Bitmap)bmpSource.Clone();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum75" style="color: #606060;">  75:</span>                 writer.AddFrame(bmpLastFrame);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum76" style="color: #606060;">  76:</span>                 camera.Unlock();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum77" style="color: #606060;">  77:</span>                 timeLastSavedFrame = DateTime.Now;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum78" style="color: #606060;">  78:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum79" style="color: #606060;">  79:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum80" style="color: #606060;">  80:</span>             <span style="color: #0000ff;">catch</span> (Exception ex)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum81" style="color: #606060;">  81:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum82" style="color: #606060;">  82:</span>                 System.Diagnostics.Trace.WriteLine(ex.ToString());</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum83" style="color: #606060;">  83:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum84" style="color: #606060;">  84:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum85" style="color: #606060;">  85:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum86" style="color: #606060;">  86:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum87" style="color: #606060;">  87:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum88" style="color: #606060;">  88:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum89" style="color: #606060;">  89:</span>     <span style="color: #008000;">// Open video source </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum90" style="color: #606060;">  90:</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> OpenVideoSource(IVideoSource source)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum91" style="color: #606060;">  91:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum92" style="color: #606060;">  92:</span>         <span style="color: #008000;">// set busy cursor </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum93" style="color: #606060;">  93:</span>         <span style="color: #0000ff;">this</span>.Cursor = Cursors.WaitCursor;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum94" style="color: #606060;">  94:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum95" style="color: #606060;">  95:</span>         <span style="color: #008000;">// close previous video source </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum96" style="color: #606060;">  96:</span>         CloseVideoSource();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum97" style="color: #606060;">  97:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum98" style="color: #606060;">  98:</span>         <span style="color: #008000;">// create camera </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum99" style="color: #606060;">  99:</span>         MotionDetector.Camera camera = <span style="color: #0000ff;">new</span> MotionDetector.Camera(source, detector);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum100" style="color: #606060;"> 100:</span>         <span style="color: #008000;">// start camera </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum101" style="color: #606060;"> 101:</span>         camera.Start();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum102" style="color: #606060;"> 102:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum103" style="color: #606060;"> 103:</span>         <span style="color: #008000;">// attach camera to camera window </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum104" style="color: #606060;"> 104:</span>         cameraWindow.Camera = camera;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum105" style="color: #606060;"> 105:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum106" style="color: #606060;"> 106:</span>         <span style="color: #008000;">// set event handlers </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum107" style="color: #606060;"> 107:</span>         camera.NewFrame += <span style="color: #0000ff;">new</span> EventHandler(camera_NewFrame);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum108" style="color: #606060;"> 108:</span>         camera.Alarm += <span style="color: #0000ff;">new</span> EventHandler(camera_Alarm);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum109" style="color: #606060;"> 109:</span>         camera.VideoSourceError += <span style="color: #0000ff;">new</span> EventHandler(camera_VideoSourceError);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum110" style="color: #606060;"> 110:</span>         <span style="color: #008000;">// start timer </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum111" style="color: #606060;"> 111:</span>         timer.Start();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum112" style="color: #606060;"> 112:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum113" style="color: #606060;"> 113:</span>         <span style="color: #0000ff;">this</span>.Cursor = Cursors.Default;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum114" style="color: #606060;"> 114:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum115" style="color: #606060;"> 115:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum116" style="color: #606060;"> 116:</span>     <span style="color: #008000;">// Close current video source </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum117" style="color: #606060;"> 117:</span>     <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> CloseVideoSource()</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum118" style="color: #606060;"> 118:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum119" style="color: #606060;"> 119:</span>         MotionDetector.Camera camera = cameraWindow.Camera;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum120" style="color: #606060;"> 120:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum121" style="color: #606060;"> 121:</span>         <span style="color: #0000ff;">if</span> (camera != <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum122" style="color: #606060;"> 122:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum123" style="color: #606060;"> 123:</span>             <span style="color: #008000;">// stop timer </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum124" style="color: #606060;"> 124:</span>             timer.Stop();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum125" style="color: #606060;"> 125:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum126" style="color: #606060;"> 126:</span>             camera.NewFrame -= <span style="color: #0000ff;">new</span> EventHandler(camera_NewFrame);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum127" style="color: #606060;"> 127:</span>             camera.Alarm -= <span style="color: #0000ff;">new</span> EventHandler(camera_Alarm);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum128" style="color: #606060;"> 128:</span>             camera.VideoSourceError -= <span style="color: #0000ff;">new</span> EventHandler(camera_VideoSourceError);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum129" style="color: #606060;"> 129:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum130" style="color: #606060;"> 130:</span>             <span style="color: #008000;">// detach camera from camera window </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum131" style="color: #606060;"> 131:</span>             cameraWindow.Camera = <span style="color: #0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum132" style="color: #606060;"> 132:</span>             Application.DoEvents();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum133" style="color: #606060;"> 133:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum134" style="color: #606060;"> 134:</span>             <span style="color: #008000;">// signal camera to stop </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum135" style="color: #606060;"> 135:</span>             camera.SignalToStop();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum136" style="color: #606060;"> 136:</span>             <span style="color: #008000;">// wait 2 seconds until camera stops </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum137" style="color: #606060;"> 137:</span>             <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">int</span> i = 0; (i &lt; 20) &amp;&amp; (camera.IsRunning); i++)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum138" style="color: #606060;"> 138:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum139" style="color: #606060;"> 139:</span>                 Thread.Sleep(100);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum140" style="color: #606060;"> 140:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum141" style="color: #606060;"> 141:</span>             <span style="color: #0000ff;">if</span> (camera.IsRunning)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum142" style="color: #606060;"> 142:</span>                 camera.Stop();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum143" style="color: #606060;"> 143:</span>             camera = <span style="color: #0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum144" style="color: #606060;"> 144:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum145" style="color: #606060;"> 145:</span>             <span style="color: #008000;">// reset motion detector </span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum146" style="color: #606060;"> 146:</span>             <span style="color: #0000ff;">if</span> (detector != <span style="color: #0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum147" style="color: #606060;"> 147:</span>                 detector.Reset();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum148" style="color: #606060;"> 148:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum149" style="color: #606060;"> 149:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum150" style="color: #606060;"> 150:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum151" style="color: #606060;"> 151:</span></pre>
<p><!--CRLF--></p>
</div>
</div>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span><span style="font-family: 'Comic Sans MS'; font-size: small;">Like I have already stated, most all of the samples from AForge are pretty straight forward and easy to use, almost all of the above snipit of code came from one of the samples.  One thing I did do was break the camera control out into a project by itself.  Once this was created I just had to simply drag and drop the control on a form like any other .Net control and do whatever I wanted from with in my application.  One change I did implement in the Camera control was to setup a property to give me more control on the sensitivity for motion detection, I felt the default was way to sensitive for my needs and wanted a way to adjust it. </span></p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 109.85%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;">   1:</span> <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">double</span> AlarmLevel</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;">   2:</span>        {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;">   3:</span>            get</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;">   4:</span>              {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;">   5:</span>                 <span style="color: #0000ff;">return</span> alarmLevel;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;">   6:</span>              }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060;">   7:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum8" style="color: #606060;">   8:</span>              set</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum9" style="color: #606060;">   9:</span>              {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum10" style="color: #606060;">  10:</span>                  alarmLevel = <span style="color: #0000ff;">value</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum11" style="color: #606060;">  11:</span>              }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum12" style="color: #606060;">  12:</span>        }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum13" style="color: #606060;">  13:</span></pre>
<p><!--CRLF--></p>
</div>
</div>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;"> </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">As for my Gun class, it is made up of two other classes.  One of these classes handles the Phidget devices the other handles the X10 devices.  The Gun Class just puts it all together.  The web service I have enclosed demostrates all of this and it is pretty straight forward to understand.  If you still have questions feel fee to send me an email.  web service code is </span><a href="http://www.waterhobo.com/hobofiles/Bridge.zip"><span style="font-family: 'Comic Sans MS';">here</span></a><span style="font-size: small;"> </span><span style="font-family: 'Comic Sans MS'; font-size: small;"> . </span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">So with version 2 where are we and what did we learn? </span></p>
<ul>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Motion detection works great, sometimes to good. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">We now have video and it is meeting the goal of having something to laugh about. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Auto fire works and combine it with &#8220;Holy Hand Grenade&#8221; mode and you cover a lot of territory. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">You can teach &#8220;Rabbits&#8221; new tricks. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">PVC was the right move. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Servo controller boards do not like thunder storms, keep it water tight </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">A lot more &#8220;Rabbits&#8221; cut through than I thought, some even riding bikes on my lawn </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Do not shoot your wife, even by accident (might not be a version 3 <img src='http://waterhobo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Your kid will use it like running through a lawn sprinkler </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Using sound effects from </span><a href="http://waterhobo.com/hobofiles/kirk04.wav"><span style="font-family: 'Comic Sans MS'; font-size: small;">Star Trek</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;">, </span><a href="http://waterhobo.com/hobofiles/mat-dontrun.wav"><span style="font-family: 'Comic Sans MS'; font-size: small;">Mars Attacks</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;">, </span><a href="http://waterhobo.com/hobofiles/Daffy04.wav"><span style="font-family: 'Comic Sans MS'; font-size: small;">Daffy Duck</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> and </span><a href="http://waterhobo.com/hobofiles/Sam35.wav"><span style="font-family: 'Comic Sans MS'; font-size: small;">Yosimini Sam</span></a><span style="font-family: 'Comic Sans MS'; font-size: small;"> added to the fun </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Infrared camera&#8217;s are not all built the same </span></li>
</ul>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">Ok so what type of enhancements are we talking here (some of these are already in the works)?  Well just brain storming&#8230;</span></p>
<ul>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Create a click once client so I can deploy to friends to have manual fun. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Add in Microsoft&#8217;s new Robot SDK </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Put functionality of servo and X10 control in a web service (already did this and it opens oh so many ideas. cell phones come to mind&#8230;also what waterhobo.com is needed for&#8230;) </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Have motion detection that goes to motion tracking. </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Switch from only horizontal to both horizontal and vertical (Pan and Tilt) for barrel </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Switch to directX avi recording, I want to record sound and video </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Using directX, add in Joystick capability even from remote over the web (using web service) </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Make it more portable </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Add in pop up in ground sprinklers </span></li>
<li><span style="font-family: 'Comic Sans MS'; font-size: small;">Create Infrared Spot light to help cameras at night. </span></li>
</ul>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">In closing I have learnt a great deal and have a great deal of rework to do, in some cases things were to complex and in others there was just not enough functionality for what I wanted to do, but I do know it can be done, and I do love a challenge, so it will be. And finally a note from the WaterHobo, well I did not catch any rabbits, but man you would not believe all of the collateral damage or people that &#8220;Just&#8221; happened to trespass on my yard, some as late as 11:30 at night.  They choose to ignore my &#8220;Pest&#8221; control signs, I guess that is why we call them collateral damage&#8230;.</span></p>
<p><span style="font-family: 'Comic Sans MS'; font-size: small;">Stay tuned for more videos and version 3, its coming&#8230;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://waterhobo.com/?feed=rss2&#038;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://waterhobo.com/hobofiles/video_003_pc.avi" length="6850560" type="video/avi" />
<enclosure url="http://waterhobo.com/hobofiles/kirk04.wav" length="14232" type="audio/wav" />
<enclosure url="http://waterhobo.com/hobofiles/mat-dontrun.wav" length="73835" type="audio/wav" />
<enclosure url="http://waterhobo.com/hobofiles/Daffy04.wav" length="23790" type="audio/wav" />
<enclosure url="http://waterhobo.com/hobofiles/Sam35.wav" length="36990" type="audio/wav" />
		</item>
	</channel>
</rss>

<!-- Served from: waterhobo.com @ 2013-05-26 03:08:04 by W3 Total Cache -->