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

void loop() {

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


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"

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!)


Get every new post delivered to your Inbox.