Cobra II + TE35 and Assemblies

I have copied the code from the tutorial documentation for the T35. Yet it is hightlighting in red resources and configuration. I note that GHIElectronics.Hardware is missing … This does not appear to availble to add?

can anyone advise the way forward?

Thanks

it has been renamed GHI.Premium.Hardware

I have this and this resolved the configuration errror but not the resources and also then commands changed to red.

it is 4.2 … please explain about the namespaces … what am I looking for … I am new to .netmf.

https://www.ghielectronics.com/docs/35/namespaces skimming through sections of https://www.ghielectronics.com/downloads/FEZ/Beginners%20guide%20to%20NETMF.pdf might be useful. And there is a section on assemblies in https://www.ghielectronics.com/docs/21/first-netmf-project

That was very helpful … I now have managed to get a number of tutorials running. So I have returned to the TE35 tutorial. I have made progress … however, I have a compile error that I do not understand. I have attached the project and image if anyone can tell me what I need to do to correct this.

Many thanks

Can attached projects? It would not accept a zip file.

No, you can’t attach zip files. Just paste code snippets around the relevant parts of the error, into a message here.

Thanks … I have attached images

.NET Gadeteer Application

See code below … I made the change but it did resolve … is there any way to submit the solution? When you copy the code, the IDE colouring is lost?

//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.1008
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------

namespace Display_Troubleshooting_NETMF {
using Gadgeteer;
using GTM = Gadgeteer.Modules;

public partial class Program : Gadgeteer.Program {
    
    private Gadgeteer.Modules.GHIElectronics.Display_TE35 display_TE35;
    
    public static void Main() {
        // Important to initialize the Mainboard first
        Program.Mainboard = new GHIElectronics.Gadgeteer.FEZCobra_II();
        Program p = new Program();
        p.InitializeModules();
        p.ProgramStarted();
        // Starts Dispatcher
        p.Run();
    }
    
    private void InitializeModules() {
        this.display_TE35 = new GTM.GHIElectronics.Display_TE35(3, 2, 1, 4);
    }
}

}

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GHI.Premium.Hardware;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace Display_Troubleshooting_NETMF
{
    public partial class Program
    {
        public static Bitmap bmp = new Bitmap(320, 240);
 
        static Program myDisplayTestApp;
 
        public static void Main()
        {
            if (SystemMetrics.ScreenHeight == 0 || SystemMetrics.ScreenWidth == 0)
                ResetDisplay();
 
            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();
        }
 
        static void ResetDisplay()
        {
            Debug.Print("Display not configured. Configuring mainboard to use display.");
            Debug.Print("Mainboard will need to be rebooted when finished");
 
            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
 
            lcdConfig.Width = 320;
            lcdConfig.Height = 240;
 
            // Only use if needed, see documentation.
            lcdConfig.PriorityEnable = false;
 
            lcdConfig.OutputEnableIsFixed = true;
            lcdConfig.OutputEnablePolarity = true;
 
            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;
            lcdConfig.PixelPolarity = true;
 
            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch = 27;
            lcdConfig.HorizontalFrontPorch = 51;
            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch = 8;
            lcdConfig.VerticalFrontPorch = 16;
 
            lcdConfig.PixelClockDivider = 8;
 
            bool bNeedReset = Configuration.LCD.Set(lcdConfig);
 
            Debug.Print("Mainboard can now be reset");
 
            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
    }
}

Also, this shows you’ve been cutting code into potentially wrong areas. Fundamentally, you should always create your own fresh application, and move over just the example code you need, nothing more. And program.generated.cs is definitely off-limits, like the warning says. One of the challenges you’re seeing here is the problem with taking an example that’s potentially non-Gadgeteer and trying to put it into Gadgeteer. If at all possible, use example code from the same type of project and don’t get em confused… Gadgeteer handles a lot of the background setup tasks for you, but that means you have to program slightly differently than a console app does, for example a console app the main() method should never exit but in a Gadgeteer app, the ProgramStarted() is your equivalent method, but it MUST exit for the Gadgeteer core to take over.

Hi Andre,

Code Tags ???

I come form a Delphi backgpround … so I have lots to learn.

It is a shame that the tutorial documents cannot be copied into the IDE and run so I can learn by stepping through them …

12 months ago I invested in alot of GHI parts … but after too long trying to get going I switched to the Arduino Mega … and I have quite an impressive project running on it. It was a breeze to get going, the tutorials and documents just worked.

However, I never saw it as something I could use commercially and thus I have now returned to the GHI offering and have invested in some Cobra boards and all the gadgets to go with it.

I understand my lack of knowledge is my frustration, I am now committed to developing my project to the commercial level with this kit and to migrate my Arduino project and build upon it.

I dont mean to moan, no doubt once I understand better this will all fall into place. Is there tutorial code that is complete and will just simply run on my setup or is there a way to send the solution so you or others and can point out my errors. I bet its very simple it normally is.

Thanks