Main Site Documentation

G120 with touch LCD


#1

Hi,
Does anyone have T35 and touch working on a G120 - if so any chance of some sample code and wiring requirments?

Thanks

Mike


#2

It works in cobra which is based on G120. Take a look at the gadgeteer driver.


#3

Have a look at the G120GDR, this one has the sockets wired as you need then:

https://www.ghielectronics.com/catalog/product/431


#4

@ michaelo -

I also have a simple example code to test Touch,
Before deploy them, use FEZ config to config the T35 LCD screen!

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;
using GHI.Premium.Hardware;

namespace G400_TestTouch
{
    public class Program : Microsoft.SPOT.Application
    {
        public static Bitmap bmp = new Bitmap(320, 240);

        static Program myDisplayTestApp;

        public static void Main()
        {
            if (SystemMetrics.ScreenHeight == 0 || SystemMetrics.ScreenWidth == 0)
              Debug.Print("Use FEZ config to config the T35 LCD screen!");

            myDisplayTestApp = new Program();

            Microsoft.SPOT.Touch.Touch.Initialize(myDisplayTestApp);

            myDisplayTestApp.MainWindow = new Microsoft.SPOT.Presentation.Window();

            myDisplayTestApp.MainWindow.TouchDown += new TouchEventHandler(MainWindow_TouchDown);
            myDisplayTestApp.MainWindow.TouchUp += new TouchEventHandler(MainWindow_TouchUp);
            myDisplayTestApp.Run();

        }

        static void MainWindow_TouchUp(object sender, TouchEventArgs e)
        {
            Debug.Print("X: " + e.Touches[0].X + " Y: " + e.Touches[0].Y);
            bmp.DrawText("(" + e.Touches[0].X + "," + e.Touches[0].Y + ")", Resources.GetFont(Resources.FontResources.NinaB),
               Colors.Green, e.Touches[0].X, e.Touches[0].Y);
            bmp.Flush();
        }

        static void MainWindow_TouchDown(object sender, TouchEventArgs e)
        {
            bmp.Clear();
            Debug.Print("X: " + e.Touches[0].X + " Y: " + e.Touches[0].Y);
            bmp.DrawText("(" + e.Touches[0].X + "," + e.Touches[0].Y + ")", Resources.GetFont(Resources.FontResources.NinaB),
                Colors.Red, e.Touches[0].X, e.Touches[0].Y);
            bmp.Flush();
        }
      
    }
}