Display pictures

Hello,

I’m trying to bring a bitmap to a TE35 with a Spider motherboard. I use VS 2012 with the latest SDK, programming in VB.net. Can anyone help me? Sorry for my english :wink:

Here is the code:

Public Sub ProgramStarted()
Dim bild As New GT.Picture(Resources.GetBytes(Resources.BinaryResources.Ladewagen), Gadgeteer.Picture.PictureEncoding.BMP)
Debug.Print(“Program Started”)
lcd.SimpleGraphics.DisplayImage(bild.MakeBitmap, 0, 0)
End Sub

There is always the error:

Found debugger!

Create TS.

Loading start at a0e00000, end a0e2f494

Assembly: mscorlib (4.3.1.0) Assembly: Microsoft.SPOT.Native (4.3.1.0) Assembly: Microsoft.SPOT.Security.PKCS11 (4.3
.1.0) Assembly: System.Security (4.3.1.0) Assembly: Microsoft.SPOT.Hardware (4.3.1.0)
Assembly: Microsoft.SPOT.Graphics (4.3.1.0) Assembly: Microsoft.SPOT.TinyCore (4.3.1.0)
Assembly: Microsoft.SPOT.IO (4.3.1.0) Assembly: System.IO (4.3.1.0) Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0) Assembly: Microsoft.SPOT.Touch (4.3.1.0)
Assembly: Microsoft.SPOT.Ink (4.3.1.0) Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)
Loading Deployment Assemblies.

Attaching deployed file.

Assembly: Microsoft.VisualBasic (1.0.0.0) Attaching deployed file.

Assembly: Gadgeteer (2.43.1.0) Attaching deployed file.

Assembly: GTM.GHIElectronics.DisplayTE35 (4.3.3.0) Attaching deployed file.

Assembly: GHI.Hardware (4.3.3.0) Attaching deployed file.

Assembly: GTM.GHIElectronics.Joystick (4.3.3.0) Attaching deployed file.

Assembly: GTM.GHIElectronics.USBClientDP (4.3.3.0) Attaching deployed file.

Assembly: GHI.Usb (4.3.3.0) Attaching deployed file.

Assembly: Microsoft.SPOT.Net (4.3.1.0) Attaching deployed file.

Assembly: GHIElectronics.Gadgeteer.FEZSpider (4.3.3.0) Attaching deployed file.

Assembly: Ztrol_2_0 (1.0.0.0) Resolving.

GC: 1msec 36648 bytes used, 7303020 bytes available

Type 0F (STRING ): 24 bytes

Type 15 (FREEBLOCK ): 7303020 bytes

Type 17 (ASSEMBLY ): 34788 bytes

Type 1E (BINARY_BLOB_HEAD ): 1332 bytes

Type 28 (MEMORY_STREAM_HEAD ): 36 bytes

Type 29 (MEMORY_STREAM_DATA ): 396 bytes

Type 34 (APPDOMAIN_HEAD ): 72 bytes

GC: performing heap compaction…

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\mscorlib.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Native.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Security.PKCS11.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.Security.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Graphics.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.TinyCore.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.IO.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.IO.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.Usb.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Touch.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Ink.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.VisualBasic.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Net.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies.NET Micro Framework 4.3\le\Gadgeteer.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\DisplayTE35\NETMF 4.3\le\GTM.GHIElectronics.DisplayTE35.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.3 SDK\Libraries\le\GHI.Hardware.dll” geladen
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\Joystick\NETMF 4.3\le\GTM.GHIElectronics.Joystick.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\USBClientDP\NETMF 4.3\le\GTM.GHIElectronics.USBClientDP.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.3 SDK\Libraries\le\GHI.Usb.dll” geladen
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Mainboards\FEZSpider\NETMF 4.3\le\GHIElectronics.Gadgeteer.FEZSpider.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Users\Herbert\Documents\Visual Studio 2012\Projects\Ztrol_2_0\Ztrol_2_0\bin\Release\le\Ztrol_2_0.exe” geladen, Symbole geladen.
Der Thread ‘’ (0x2) hat mit Code 0 (0x0) geendet.
Using mainboard GHI Electronics FEZ Spider version 1.0
Program Started
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
#### Message:
#### Microsoft.SPOT.Bitmap::.ctor [IP: 0000] ####
#### Gadgeteer.Picture::op_Explicit [IP: 000c] ####
#### Gadgeteer.Picture::MakeBitmap [IP: 0004] ####
#### Ztrol_2_0.Ztrol_2_0.Program::ProgramStarted [IP: 001e] ####
Eine Ausnahme (erste Chance) des Typs “System.NotSupportedException” ist in Microsoft.SPOT.Graphics.dll aufgetreten.
Eine nicht behandelte Ausnahme des Typs “System.NotSupportedException” ist in Microsoft.SPOT.Graphics.dll aufgetreten.
WARN: Total initialization time exceeds 10 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
Uncaught exception
Der Thread ‘’ (0x1) hat mit Code 0 (0x0) geendet.
Das Programm “[2] Micro Framework application: Verwaltet” wurde mit Code 0 (0x0) beendet.
[line] [title][/title]

Can you show your code?

Use the FORMAT option when you post it. It’s the icon above the edit box with 101010

here the code:

Public Sub ProgramStarted()
Dim bild As New GT.Picture(Resources.GetByte (Resources.BinaryResources.Ladewagen), Gadgeteer.Picture.PictureEncoding.BMP)
Debug.Print(“Program Started”)
lcd.SimpleGraphics.DisplayImage(bild.MakeBitmap, 0, 0)
End Sub



I tried with an without MakeBitmap.

Changing the format to jpeg brought the pictures to my display.

@ hzjun - Yes, you have to specify the correct format. I have a small method that automatically converts byte resources or files to the right type for me. If you message me a reminder, I’ll send it along.

Hi everyone,
I have FEZ Hydra kit. I want to do some projects. But i have not experiance.

I have T43 display and serial camera. I want to see only a image on display.

So, in visual studio; whih option can i choose? c# > microframework or C# > gadgeteer ?

and could it be transport: USB, device: my device ?
help me please.

Select gadgeteer. Drag and drop your hardware. Write the small code for showing the image.

For transport, make sure your device is connected. Select USB, select your device.

:slight_smile:

@ trkr - still rough around the edges, but a great place for getting started:

https://www.ghielectronics.com/downloads/man/Introduction_to_NET_Gadgeteer.pdf

If you use it and have any suggestions or comments, please let me know.

Thanks for answers…

I want to see a string on display. is it true?

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

public partial class Program : Gadgeteer.Program {
   private Gadgeteer.Modules.GHIElectronics.USBClientDP usbClientDP;
   private Gadgeteer.Modules.GHIElectronics.DisplayT43 displayT43;
   protected new static GHIElectronics.Gadgeteer.FEZHydra Mainboard {
        get {
            return ((GHIElectronics.Gadgeteer.FEZHydra)(Gadgeteer.Program.Mainboard));
        }
        set {
            Gadgeteer.Program.Mainboard = value;
        }
    }
    
    /// <summary>This method runs automatically when the device is powered, and calls ProgramStarted.</summary>
    public static void Main() {
        // Important to initialize the Mainboard first
        Program.Mainboard = new GHIElectronics.Gadgeteer.FEZHydra();
        Program p = new Program();
        p.InitializeModules();
        p.ProgramStarted();
        Debug.Print("zxcvbn");
        // Starts Dispatcher
       // p.Run();

    }
    public Window CreateWindow()
    {
        mainWindow = new Window();
        mainWindow.Height = SystemMetrics.ScreenHeight;
        mainWindow.Width = SystemMetrics.ScreenWidth;

        Text text = new Text();

        text.Font = Resources.GetFont(Resources.FontResources.small);
        //text.TextContent = Resources.GetString(Resources.StringResources.String1);
        text.TextContent = "EVERYTHING IS UNDER CONTROL!!!";
        text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
        text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

        mainWindow.Child = text;

        // Connect the button handler to all of the buttons.
        mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);

        // Set the window visibility to visible.
        mainWindow.Visibility = Visibility.Visible;

        // Attach the button focus to the window.
        Buttons.Focus(mainWindow);

        return mainWindow;
    }
    
    private void InitializeModules() {
        this.usbClientDP = new GTM.GHIElectronics.USBClientDP(2);
        this.displayT43 = new GTM.GHIElectronics.DisplayT43(10, 11, 12, 13);
    }
}

}

or this code is correct?

but I have six errors. I dont understand. Help me please.

“”""""""""""""

namespace testFEZHydra1
{
    public class Program : Microsoft.SPOT.Application
    {
        public static void Main()
        {
            Program myApplication = new Program();
 
            Window mainWindow = myApplication.CreateWindow();
 
            // Create the object that configures the GPIO pins to buttons.
            GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);
 
            // Start the application
            myApplication.Run(mainWindow);
        }
 
        private Window mainWindow;
 
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;
 
            // Create a single text control.
            Text text = new Text();
 
            text.Font = Resources.GetFont(Resources.FontResources.small);
            //text.TextContent = Resources.GetString(Resources.StringResources.String1);
            text.TextContent = "EVERYTHING IS UNDER CONTROL!!!";
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;
 
            // Add the text control to the window.
            mainWindow.Child = text;
 
 
  /*          Microsoft.SPOT.Presentation.Controls.Image image = new Image();
            image.Bitmap = Resources.GetBitmap(Resources.BitmapResources.dashboard);
            image.HorizontalAlignment = HorizontalAlignment.Left;
            image.VerticalAlignment = VerticalAlignment.Top;
 
            mainWindow.Child = image;
    */       
 
 
            // Connect the button handler to all of the buttons.
            mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);
 
            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;
 
            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);
 
            return mainWindow;
        }
 
        private void OnButtonUp(object sender, RoutedEventArgs evt)
        {
            ButtonEventArgs e = (ButtonEventArgs)evt;
 
            // Print the button code to the Visual Studio output window.
            Debug.Print(e.Button.ToString());
        }
    }
}

@ andre.m - thank you. I modified my post, sorry for this.

I think your are mixing wpf with gadgeteer. I would not do this and use simple graphics for now. The book should have examples on doing so.

Then when you need to do more graphics, use glide.

I am very beginner, you know :slight_smile:

but I wanto to do this,
only to see"HELLO WORLD" on the displayT43. But which code :s

thank you.

using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;

namespace your_namespace
{
    public class Program
    {
        public static void Main()
        {
            Font font = Resources.GetFont(Resources.FontResources.NinaB);
            Bitmap lcd = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);

            lcd.DrawText("Hello, World!", font, Colors.White, 0, 0);

            lcd.Flush();
        }
    }
}

I have 2 errors.

The name ‘Resources’ does not exist in the current context C:\Users\TURKER\AppData\Local\Temporary Projects\GadgeteerApp1\Program.cs 33 25 GadgeteerApp1

Keep the namespace unchanged. You changed it and it is why it is not working.

I only did this.

I want to do only to write a string on displayT43

thank you so much.

I am trying to learn. I did it, I saw my string on the displayT43…

but I searched so much, and I found you. I dont know nothing about C# - Visual Studio and .Net Micro Frameworks. I try to learn.Have a nice day.

hi there Trkr,

we are always welcoming for new people, and we’re always happy to help. I think however that you’ve bitten off what has turned out to be a challenging first step.

I think what many people would first suggest is to take a few steps back and take teh journey slowly. First you want to get to know Visual Studio, and Gadgeteer, and C# - the PDF “Introduction to .Net Gadgeteer” from the top section of https://www.ghielectronics.com/docs?tags=gadgeteer is still in beta but is a good start of helping you start this journey and will probably be a great resource to work through - we’re more than happy helping you through anything you can’t figure out, but I’d suggest you focus on following along in the above as much as possible to start, so you don’t get too deep too quick :slight_smile:

@ Brett - thank you so much for your advise :wink:

Sorry, I have a problem again :slight_smile:

I want to see that when my code is debugging, how many cycle has got?
and I want to see last 10 cycle on the display with elapsed time for each cycle.

I must use doubleword variable in Main. I searced but I didnt find. You dont give a fish to me. Can you teach fishing teorically :slight_smile: