I have recently started using an Arduino Deumilanove. It is an open source hardware  platform with a microprocessor, a number of digital and analog inputs, some digital outputs and a USB connection.

My five year-old, Aurora, and I put together the obligatory Blink sample yesterday and are due for some more ‘nventing tomorrow morning. This evening, in preparation, I put together a more useful example. Not one but two LEDs!!

I wanted to have the PC send messages (in this example a byte) to the prototyping board and have a visible result. Eventually I chose to have a red and a green LED as the output and the microprocessor ‘listen’ for an ‘R’, ‘G’ or ‘O’ on the USB port. (O being to turn off all lights.) I can see my self using something for indicating status of the build or test results.

The eventual solution requires sending the byte message from the PC to the Arduino. Here, I will use PowerShell to ‘new up’ a System.IO.Ports.SerialPort and WriteLine the commands from the shell.

 

Here is my sketch:

int redPin = 13;   
int greenPin = 7;   

void setup() {

  // set all the other pins you’re using as outputs:
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  //the usb connection
  Serial.begin(9600);
}

void loop() {

if (Serial.available())
{
   int c = Serial.read();
   switch (c)
   {
     case ‘R’:
       digitalWrite(redPin, HIGH);       //Light Red
       break;
     case ‘G’:
       digitalWrite(greenPin, HIGH);     //Light Green
       break;
     case ‘O’:
       digitalWrite(greenPin, LOW);      //Lights out
       digitalWrite(redPin, LOW);
       break;
   }
}

}

After hooking the Arduino up, I keyed the following into PowerShell.

$s = New-Object System.IO.Ports.SerialPort
$s.PortName = "COM4"
$s.BaudRate = "9600"
$s.Parity = "None"
$s.WriteLine('R')

The green light came on and my inner geek roared!

Realised it’s Friday morning and I am doing something that I do most Fridays that I thought I’d share. Cleaning up my working copies. Whilst this should not ever be too much of an issue I am a bit retentive about being able to drop into any of our projects and be quickly up to date.

Subversion is iterative about how it works; if you Update frequently they are short processes. If you have not touched the repository for a while and you have uncommitted changes they can take a while! The process never takes to long when I keep “my room” tidy.

My programming day is very rarely all success or all disappointments; in truth it probably looks like a sine wave with a very high frequency. Over the course of my career, I have become better at noticing and dealing with how these successes and disappointments affect me as a person.

When I have taken a few disappointments on the chin in any given period, I will often revisit my unit tests and refactor them to make them more clear and readable and then jump back at the task at hand. Sometimes I will notice how to improve the test to be more effective as well. I find this practice has two tangible benefits. Firstly, my tests across time become clearer, more concise and more effective as I tweak them. Secondly, the “refactor / run tests” cycle gives me some easy wins and set me back on my way in a much better frame of mind.

05022009300I am giving a training session on the use of ASP.NET MVC to a group of developers in Peterborough on the 9th of this month. Hopefully the weather will co-operate as we have had a fair amount of snow this week, with more forecast for the weekend.

It will nice to see John (a friend and ex-colleague) who works at the organisation where the training is being held. I find giving a training session on something enhances my understanding of the subject matter and the more training I conduct, the more I feel it might make up a bigger portion of my career down the line.

Finally got on to twitter!

Thanks very much to Scott Hanselman and his blog post here.

I hope to put our build server on later in the day!

Visual Studio can be quite viral in my life. When I am “into” something or having to pick up a new technology or methodology, it is where I reside. This Sunday morning; it is a comfortable place to be!

The new project I am working on and the Entity Framework, in particular, are the objects of my latest bout of obsession.

I have had a particularly good week; for the first time in my current role, I am writing tests prior to code. Logging in on the weekend when there is nothing that has to be done is a very good indication of my happiness in work.

Scoping a task in tests is one of my favorite elements of TDD (and software development as a whole.) The effort to make the test suite be the best documentation of the elements they test is one that makes perfect sense to me. Developers will write document business rules which will be validated each time the test suite is run. In addition, I like writing tests; they increase my understanding of what I am doing.

I had a torturous time trying to connect my new Windows Server 2008 (x64) install to the VPN at work. It just wouldn’t play dice. Thus far my best solution is an XP Pro (x86) VM. Whilst not being able to from the x64 box directly, I can still Remote Desktop the work box and mount network shares. Glad to be back in business (ED: Poor pun!)

I played with some new software development tools this weekend, TeamCity and Mingle.

TeamCity is a build server by the wonderful folks at JetBrains. It is a package I have wanted to take a look at for a few moons after Roy Oshergrove mentioned it in his blog. Using it this weekend as the build server for GameProject (my XNA adventure!) is the first time that I have put it through its paces. (More accurately I put it through a few baby steps!)

Mingle, is an agile planning & tracking tool by ThoughtWorks and it comes with a year evaluation license for five seats. Again GameProject was my guinea pig. The software at first glance is a bit more than I need as the one guy on the project but it looks shiny nonetheless. The best implementation of “cards” on screen I have seen yet. I shall be sticking to a combination of Google Notebooks and RSS for now.

I decided to draw a line under the Bouncy game this evening. Then I decided to resurrect it and make it the subject of my base project for Windows games. The education section of XNA Creator’s page yielded my next evenings jaunt through the merry fields of XNA; I am going to use the Game State Management example as the inspiration (basis?) for my template project.

The actual game (GameplayScreen.cs) will be where Bouncy lives on!

Star-128x128 Zara Grace is my youngest daughter. She is a bubbly, smiley six month old who loves sitting at daddy’s computer thumping his keyboard. With the release of the XNA Game Studio 3.0 in the last few weeks, I decided to spend my geek time this weekend putting her together a simple “bash the keyboard game.” And low, Bouncy was born!

Bouncy is a very simple 2d “game” which baby can interact with by hitting keys. It represent my first foray into game development with the XNA Framework and I am quite happy with it considering it is about a days worth of effort. For those who are new to XNA or have not tried it out yet, I hope this project will serve as a “quick start.” It demonstrates the rendering of a texture, sound effects and music, some simple physics and the handling of user input.

The binaries and source are available for download at Magoo Games.

Next Page »