Posts

C# IOIO and I2C devices

Image
The IOIO C# library on GitHub now has basic I2C support.  Protocol support and resource management is lifted from the Java library.  The upper API is message based rather than object based. TWI/I2C/SPI is managed via outbound messages. Data from I2C devices and message acknowledgements from the IOIO come back asynchronously via inbound Messages. Hardware This was tested with an IOIO V1, Bluetooth module, a  JeeLabs Expander Plug  and an old Computer power LED.   I2C device The Expander Plug is based on the  MicroChip MCP23008  port expander.  Programming examples are available on the Jee Labs web site. The Microchip web site has the chip programming guide. The LED assembly already had a current limiting resistor. I just plugged it in across the "+" pin on the expansion port and the port pin next to the power pin. The port expander default address is 0x20.  It has 10 registers that control behavior and transfer data. ...

Sometimes your first impressions are correct

Sometimes you run across interesting outfits when interviewing or working with other organizations.

Controlling a Servo attached to an IOIO from Windows WPF application

Image
The IOIO C# library on GitHub now includes a very basic Windows WPF application that lets you control a Servo with your mouse. The program assumes your IOIO is attached to your PC via Bluetooth and that you have a servo on Pin 3. Run the program from inside Visual Studio. Step through the disconnect exception if you run this with debugging enabled.

Backup the drivers when installing Windows 10 on a Winbook TW100

Yes, you can install Windows 10 on a Winbook TW100 or other BayTrail tablet.  There are postings on the Microcenter support web site where folks describe how to to this on other WinBook tablets like the tw700. I have only a couple minor things to add. The tablet has a 64 bit processor and a 32 bit BIOS/EFI.  Use the 32 bit Windows 10 ISO available from Microsoft. Windows 10 32 bit ISOs became available in January 2015. It only has 2GB of memory so a 32 bit OS is fine. I installed the enterprise version.  The standard version didn't work for me but it was probably pilot error Build a restore medea or backup the TW100 driver directory using one of the available tools. It would be best to build a restore media instead of backing up the drivers. This would let you go back to Windows 8.  I was unable to do this with any of my flash drives. I instead used a tool off of sourceforge to back up the drivers. I now Windows 10+ forever. Make a copy of TouchSettings.gt in C:...

Message Routing using Double Dispatch with C#

Image
This post describes message routing inside an application. It does not describe message routing across message brokers or across systems. Message driven, or push based notification, systems stream Messages from message sources to interested parties ( Observers) .  There are often multiple message types  routed to multiple observers.  Message types are represented in code as Message interfaces/classes. Message Observers are often interested in some subset of the messages and implement some type of interface or registration scheme that tells the message routing module which message types they are interested in. Scenarios One use case for this is a User Interface that streams UI events (M essages ) from various components to event handlers (O bservers ).  The message sources create messages specific to that event type. The event handlers may receive and process messages of one or more types. Another use case might be some type of IoT device like an IOIO that c...

Extremely Rough Cut at C# based IOIO Library

Image
I've pushed a very rough C# port of the Java IOIO library to GitHub github.com/freemansoft/IOIODotNet/   It communicates with the IOIO as a COM device over Bluetooth. IOIODotNet is a plain old Windows Library. I tried making it a Portable library but .Net portable libraries to don't support Serial devices. The library is a mess of pieces-parts right now with some unit tests that show how it works. There is also a WPF app. Tests and the WPF app poll serial ports to find a Bluetooth attached IOIO. This is a message based API Inbound traffic packed into messages and  routed to inbound handlers. You can add your own or you can poll the ones that exist. Outbound traffic can be sent directly via the API or through a message based API.  I intend that the Message API is the future of the library once resource management has been added. Look at the Integration tests to play with it. They expect at least one IOIO V5xx on a COM port with pins 31 and 32 tied togethe...

log4net configuration with MSTest and Visual Studio 2013

Image
I use log4net because it gives me easy class level control over logging levels and it has a lot of outbound (appender) types.  Folks that dislike log4net will not find this post useful. Visual Studio test output can be pretty confounding. There are way to many forum discussions around viewing test logs in Visual Studio. It sort of makes sense because some of the normal logging channels don't make sense in the test environment.  Phones, web apps, console apps, services all log in different environments.  The Visual Studio team changed the location of the logging views in VS2013 (or possibly 2012). Here is my "how did I do that last time" version of configuring log4net logging for unit tests.   Viewing Test Output Visual studio has an Output  window and an Immediate  window buty my output never shows up in either. I've tried routing the console output to the Immediate  window via the preferences. My output never shows up there. It seems l...

Energia: Code on a Timer with Tiva / Stellaris Launchpads

Image
Do you wish you could smoothly fade LEDs without having to code that into the main loop of your program?  Do you wish you could sample sensors or input ports an a regular basis while doing other activities in the main part of your Energia program?  Are you looking for simple ways of creating periodic activities without having to worry about timing loops or how long other processing takes in your loop() function?  If so, then you want to use a timer interrupts! This post describes how to run time based code in a Tiva/Stellaris Launchpad with 1ms precision. The same code runs on the MSP430 Launchpad with 2ms precision. Your function will be invoked at the interval you register without having to integrate any code in your run loop. The timer is in github along with a simple blinking light demo program. Usage AnyMsTimer calls a function()  on regular intervals independent of work you are doing in the the loop() function or the functions it calls. Register...

Web Integration and BDD testing with Selenium, Specflow and MSTest

I occasionally participate in a workshop the LitheSpeed folks where we teach Test First Development using standard unit tests and Business Driven Development using Gherkin.  C# and Java developers participate in a mixed class. The first set of labs involves building a library first using developer style unit tests. The second set of labs involves building a library using BDD techniques.  The class wraps up with building a BDD style set of tests against an existing web site. I've created a small shell project on GitHub that contains both a basic Selenium unit test and a basic Specflow driven BDD style Selenium test. This makes it easy to start testing without the overhead of creating a new VS solution.  I built this project in VS2013 which has good NuGet, Specflow and Selenium plugin and Nuget support. The project uses NuGet Package Restore  to pull down the necessary dependencies in an almost Maven like fashion . The Selenium Web Testing development team co...

Building a development cloud using nested virtualization.

Image
This article is not for you if you are happy developing/testing with at most two machines, your developer machine and a machine under test.  It is not for you if you do all your product evaluation, training and test can only be done in Azure or some other cloud environment that doesn't support nested virtualizaiton. This is really about building your own virtual labs or data centers to simulate larger installations or to use as training environments.  Microsoft applications or machine clusters often include Active Directory, a database and some application servers. You can some times install all this on single machines.  Multiple machines make sense if you are working on clustering or wish to leverage portions of your setup for future projects. Microsoft often provides VHDs for some of their more complicated products that save you configuration time. These machines are often more interesting when integrated into to some type of application including AD databases or...