Main Site Documentation

T43 on Raptor - how to calibrate touchscreen


I am playing around with my touchscreen so that I would have some buttons to touch :slight_smile:

Problem is that touch input is way of and I need to calibrate. I guess, unless I am doing something wrong in code off course.

Seen some articles and samples on this topic but I don’t seem to grasp how it works…

            StackPanel panel = new StackPanel(Orientation.Vertical);
            Border b = new Border()
                 Background = new SolidColorBrush(Color.Black),
                 BorderBrush = new SolidColorBrush(Color.White),
                 Width = 50,
                 Height = 30,

            Text buttonText = new Text(UIManager.MainFont, "Button") { 
                ForeColor = Color.White,
                Height = b.Height - 2,
                Width = b.Width - 2,
                TextAlignment = TextAlignment.Center
            b.Child = buttonText;
            b.TouchDown += b_TouchDown;

            label = new Text(UIManager.MainFont, "Label")
                ForeColor = Color.White,
                Height = b.Height - 2,
                Width = b.Width - 2,
                TextAlignment = TextAlignment.Center


Any tips, ideas?



@ xavierk - Microsoft has an example of how to calibrate found under Documents\Microsoft .NET Micro Framework 4.x\Samples\TouchClibration

You can sift through the code to find out how it works and then save the variables to re calibrate each time the system is turned on. Currently NetMF does not store the calibration coordinates for touch.


I did take a look at the sample, ran it and yes I did get the calibrationpoints. The point is that the sample is a SPOT.Application and I get lost how I use the resulting calibration points in a regular gadgeteer.Program…

Still not sure what exactly is the difference between a Microsoft.SPOT.Application and Gadgeteer.Program…

Newbie and still some way to go :wink:



@ xavierk - One big difference is Gadgeteer is a wrapper around the regular NetMF. It is event driven so you set up events to run code. You should still be able to run standard code that is not encompassed in the wrapper like for instance, the spot applications, but it will depend on how you set them up in the program.

Navigating Gadgeteer can be challenging but fun.


@ Aron - After a couple of days and a weekend of diving in the NETMF and Gadgeteer code I see the light… The gadgeteer program contains the Application as a member and is just that what one needs to calibrate the display… maybe you guys should expose it as a property

Diving in some deeper I can’t stop wondering what the extra’s are - besides the VS designer add-on - that brings us to use gadgeteer program instead of the spot app. Could you point out what the specifics exactly are?

Guessing that it has to do with the hardware stuff …



@ xavierk - I am unfamiliar with how that program works. I have used it before but never analyzed it before. Perhaps if you discovered more of the specifics you could post your findings here on the forum. I am sure your analysis would be very helpful for others that need this information.


Yes, Gadgeteer provides a level of interface above the pins, communications protocols (UART, SPI, I2C), and so on. When you use the designer & gadgeteer it allows you to quickly build your application using the simple APIs provided by the Gadgeteer module drivers.


@ xavierk - My apologies. I misread what you wrote. I thought you were referring to the calibration program and not the Gadgeteer framework when I suggested for you to explore it. :-[


@ Aron, no prob :wink: And sure I’ll share!

@ Jeff, I was aware of that but I’ve been taking a closer look at the program class and what I actually was referring to is that in my view you could just as well use the SPOT.Application as a starting point (rather than the Program) and ref all the GHI Gadgeteer specifics like the modules and the mainboard.

What I am unsure about is if there is any code (besides the referenced mainboard and modules) in the Program class that is essential for the hardware to work correctly. Seeing my experience is c# in web and Win Apps and total newbie to hardware (although I have a engineer degree in electronics but never did anything with it :-[ ) I am not sure on that.

Not that the stuff is not working, but I can see some tweaks here and there that would make it even more easy to work with.