Silverlight <> Firmata <> Arduino

User Controls

Image of custom Dependency Properties created for the Pin Controls

Custom Dependency Properties
written for the Pin Controls.

The Arduino Firmata Tester application featured on this site includes custom Silverlight User Controls that represent each of the Analog and Digital pins on the Arduino board.

The user controls were developed as self-contained Silverlight classes. They include custom Dependency Property code that make using them on the main page of the application very straightforward.

A number of custom C# classes and events were written to handle all of the events triggered by the Pin Controls. See the image below. These events are then listened for and handled in the code written for the main page interface.


Image of the files list from Expression Blend

Custom User Controls, C# classes
and events written for the
Arduino Firmata Tester application

The Silverlight Pin Controls set to Output modes fire events whenever user interacts with them or their state changes. These events then trigger the creation of and sending of messages, using the Firmata protocol, to the Arduino board - to turn pins on and off or set PWM values.

When the Silverlight application receives an input Firmata message from the Arduino board it will parse that message and if appropriate send on a value to one or more of the Pin Controls. For example a user pressing a button attached to a pin of the Arduino board will update the visual state of the Pin Control in the Silverlight application.

Creating self contained custom User Controls that trigger and respond to custom event code means the User Controls could easily be used in other applications. It is a simple matter of including references to them in the other applications.

This makes the controls and code created for the Arduino Firmata Tester easy to re-use for other projects.

To demonstrate the functionality of the Pin Controls that were created two interactive Silverlight application has been included below on this page. The first demonstrates the Analog Pin Control and the second the Digital Pin Control. The purple coloured sections of the applications can be thought of as representing the components attached to the Arduino in the physical world.

Analog Pin Control

The Silverlightht presentation below shows the working of the custom User Control that was created to represent an Analog pin in the Firmata Arduino Tester application. Read the instructions and use the controls provided to interact with the Analog Pin Control. The controls in the purple box simulate physical components attached to the Arduino board.

Digital Pin Control

The Silverlightht presentation below shows the working of the custom User Control that was created to represent a Digital pin in the Firmata Arduino Tester application. Read the instructions and use the controls provided to interact with the Digital Pin Control. The controls in the purple box simulate physical components attached to the Arduino board.

« Previous section: Silverlight and Firmata Next section: Bringing it all together »