Main Site Documentation

Ethernet on 4.2 MF Gadgeteer (FEZ Spider)


#1

Hey guys,

I’m new to MF Gadgeteer, and I’m having trouble with conectivity using the Ethernet J11D module provided on the GHI Electronics kit.

Basically, I need a code that catch a number on a website (www.arvoredaenergia.com.br/pinos.php) , and the number will be the variable who will set the configuration of some pins.
The control of the pins itself I did successfully, but I`m having trouble with going to the internet and getting this number.

I just need to know where and what to put in the code to set internet, go through a website, and receive this number.

This is how my code looks like:

using System;
using System.Net;
using System.Net.Sockets;

using System.Collections;
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 Microsoft.SPOT.Net.NetworkInformation;

using System.IO;
using System.Text;
using Microsoft.SPOT.Net.Security;
using System.Security.Cryptography.X509Certificates;

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

namespace Testpin
{
public partial class Program
{
GT.Interfaces.DigitalOutput ledControl3;
GT.Interfaces.DigitalOutput ledControl4;

    // This method is run when the mainboard is powered up or reset.   

  
   
    void ProgramStarted()
    {
        GT.Socket socket = GT.Socket.GetSocket(11, true, null, null);

        ledControl3 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Three, false, null);
        ledControl4 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Four, false, null);
    

        int pino = 9;


        //caso 0 : Nothing happens

        if (pino == 0)
        {
            

        }

        //case 1 :  1 pin set

        if (pino == 1)
        {
            //set pin 3
            ledControl3.Write(true);

        }

        //case 2 :  2 pin set

        if (pino == 2)
        {
            //set pin 3 and 4
            ledControl3.Write(true);
            Thread.Sleep(3000); //pause
            //acende pino4
            ledControl4.Write(true);

        }

#2

In that code I set the “pino” to 9 ) , but actually I need the Gadgeteer to get this number on the provided website.

(the cases are from 1 to 9, I omitted the rest of the code here for simpicity purposes.)


#3

Welcome to the forum.

Please use code tags for programming content.

Check these tutorials:

http://www.ghielectronics.com/docs/69/ethernet-j11d-module
http://www.ghielectronics.com/docs/30/networking