Main Site Documentation

How can I write


#1

Hi,

How can I write a “hello world” or more chars on the screen T35 of FEZ Spider?

and how can I write “hello world” or more chars on a website with Ethernet.

where can I find the afull document about it?

Can you give me suggestion?

Thanks.


#2

I’m not sure about a manual, but this is some code you can pick apart which will show how to do it.

        void FatalError(string msg)
        {
            AddError("FATAL ERROR:");
            AddError(msg);
            Thread.Sleep(Timeout.Infinite);
        }

        void AddError(string msg)
        {
            msg = "!" + msg;
            AddText(msg);
        }

        void AddText(string msg)
        {
            if (row >= 23)
            {
                for (uint lp = 0; lp <= 22; lp++)
                {
                    DrawTextLine(textDisplay[lp], lp, true);
                    textDisplay[lp] = textDisplay[lp + 1];
                    DrawTextLine(textDisplay[lp], lp, false);
                }
                DrawTextLine(textDisplay[23], 22, true);
                textDisplay[23] = msg;
                DrawTextLine(msg, 22, false);
            }
            else
            {
                textDisplay[row] = msg;
                DrawTextLine(msg, row, false);
                row++;
            }
        }

        void DrawTextLine(string msg, uint line, bool erase)
        {
            if (msg == "")
                msg = " ";
            bool error = false;
            if (msg.Substring(0, 1) == "!")
            {
                error = true;
                msg = msg.Substring(1);
            }
            GT.Color colour;
            if (erase == true)
                colour = GT.Color.Black;
            else
            {
                if (error == true)
                    colour = GT.Color.Red;
                else
                    colour = GT.Color.Yellow;
            }

            DrawTextLine(msg, line, colour);
        }

        void DrawTextLine(string msg, uint line, GT.Color colour)
        {
            display.SimpleGraphics.DisplayText(msg, Resources.GetFont(Resources.FontResources.small), colour, 0, (line * 10));
        }

Cheers,

Jas


#3

The piece of code you are looking for is

display.SimpleGraphics.DisplayText(....)

#4

Thanks a lot!


#5

Hello, thanks again to your answer!

my question is not finished.

I have writen the codes as fellow:


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

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

namespace Display_Troubleshooting
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            display.SimpleGraphics.DisplayText("Temperatur1:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, 1, 1);
            display.SimpleGraphics.DisplayText("Temperatur2:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, 150, 1);
            display.SimpleGraphics.DisplayText("Temperatur3:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, 1, 20);
            display.SimpleGraphics.DisplayText("Temperatur4:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, 150, 20);

            Debug.Print("Program Started");
        }


    }
}


Now I can see the chars from LCD.

How can I show these chars on a Website.

I mean, for example if I open a “firefox” webbrowser and type “192.168.1.200”, I can also see these chars from a webpage.

Can you give me some suggestions?

I look forward to your answer!


#6

Please code tag your code so it is readable.


#7

The Codes are wrapped with code tags now


#8

Hi workhard10,

Try looking at this in the Downloads & Tutorials section:

http://wiki.tinyclr.com/index.php?title=Webserver

It should give you a start on how to do it.

Jas


#9

A verse from Simon and Garfunkel’s “Mrs. Robinson”…

[quote]We’d like to know a little bit about you for our files
We’d like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home [/quote]

Good song! The second line above would be my main point…


#10

hello, I have got a problem. I am not good at “C#”, I am trying the Ethernet Module.

I have written a very simple. But I find the the thread "ethernet_NetworkUp"doesn’t work. the Codes ars as follow, Can you help me and tell me where I am wrong?


using System;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Text;

using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

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

 

namespace Ethernet_test
{
    public partial class Program
    {
        

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {

            ethernet.UseDHCP();

            ethernet.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(ethernet_NetworkUp);
                       
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");


        }

        void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Connected to network.");
            Debug.Print("IP address: " + ethernet.NetworkSettings.IPAddress);
            WebServer.StartLocalServer("192.168.1.200", 80);
        }

    }
}

In windows output show something as follow:


“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Programme\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\Ethernet_J11D\NETMF 4.1\le\GTM.GHIElectronics.Ethernet_J11D.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Programme\GHI Electronics\GHI NETMF v4.1 SDK\Assemblies\le\GHIElectronics.NETMF.Hardware.dll” geladen
"Microsoft.SPOT.Debugger.CorDebug.dll" (Verwaltet): “C:\Programme\GHI Electronics\GHI .NET Gadgeteer SDK\Mainboards\FEZSpider\NETMF 4.1\le\GHIElectronics.Gadgeteer.FEZSpider.dll” geladen, Symbole geladen.
“Microsoft.SPOT.Debugger.CorDebug.dll” (Verwaltet): “C:\Dokumente und Einstellungen\Zalud\eigene dateien\visual studio 2010\Projects\Ethernet_test\Ethernet_test\bin\Debug\le\Ethernet_test.exe” geladen, Symbole geladen.
Der Thread ‘’ (0x2) hat mit Code 0 (0x0) geendet.
Using mainboard GHIElectronics-FEZSpider version 1.0
Program Started


#11

2 questions = 2 topics. Best to start a new topic for your ethernet question.


#12

@ ransomhall: that’s why he choose a generic topic title like ‘how can I write’… :slight_smile:

@ workhard: it seems like you don’t get any exception and everything is running. Can you try to unconnect and then later reconnect the network cable while your program is running?

I don’t know if that event will fire when the cable was already connected the time you start running the program…