Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Paulo Jardim

Member Since 09 Mar 2012
Offline Last Active Nov 22 2012 03:08 PM
-----

Posts I've Made

In Topic: Ethernet and Debug

10 November 2012 - 03:40 PM

Paulo,

Can you post a copy of your software? IPAddress?

Regards,







Im using Fiexed IP. 192.168.1.200

using System;
using Microsoft.SPOT;
using System.Net.Sockets;
using System.Net;
using System.Threading;
using System.Text;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace WebserverHelloWorld
{
    public class WebServer : IDisposable
    {


        private Socket socket = null;
        //open connection to onbaord led so we can blink it with every request
        private OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
        public WebServer()
        {
            //Initialize Socket class
            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //Request and bind to an IP from DHCP server


            socket.Bind(new IPEndPoint(IPAddress.Any, 80));
            //Debug print our IP address
            Debug.Print(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);

            string ip = (Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);
            //Start listen for web requests
            socket.Listen(10);


            ListenForRequest();
        }

        public void ListenForRequest()
        {
            MovimentosCarro moveCarro = new MovimentosCarro();


            while (true)
            {

                using (Socket clientSocket = socket.Accept())
                {



                    //Get clients IP
                    IPEndPoint clientIP = clientSocket.RemoteEndPoint as IPEndPoint;
                    EndPoint clientEndPoint = clientSocket.RemoteEndPoint;
                    //int byteCount = cSocket.Available;
                    int bytesReceived = clientSocket.Available;
                    if (bytesReceived > 0)
                    {
                        //Get request
                        byte[] buffer = new byte[bytesReceived];
                        int byteCount = clientSocket.Receive(buffer, bytesReceived, SocketFlags.None);



                        led.Write(true);
                        Thread.Sleep(500);
                        led.Write(false);
                        led.Dispose();


                        switch (buffer[0])
                        {


                            case 0: { moveCarro.moverEsquerda(buffer[1]); } break;
                            case 1: { moveCarro.moverDireita(buffer[1]); } break;
                            case 3: { moveCarro.moverTraz(buffer[1]); } break;
                            case 4: { moveCarro.moverFrente(buffer[1]); } break;
                            case 5: { moveCarro.parar((buffer[1])); } break;
                        }

                    }
                }
            }
        }


        #region IDisposable Members
        ~WebServer()
        {
            Dispose();
        }
        public void Dispose()
        {
            if (socket != null)
                socket.Close();
        }
        #endregion
    }
}



In Topic: Netduino Ethernet Problem

04 October 2012 - 04:34 PM

Chris Walker, Ty for explanation, worked with static IP puted in CODE. but i wanna know if i can debug my code using ethernet....because when i try bebug i cant ping, only after reconcting the board. But if i do that the debug should stop right?

In Topic: Netduino Ethernet Problem

04 October 2012 - 01:13 PM

Another information... i changed the line to put a static Ip in code: Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("192.168.1.200", "255.255.255.0", "192.168.1.1"); Now look my problem are solved...dont know why...but worked.. But when i try debug never work....after click in debug tryed to ping and nothing...sometimes the etherned led loke like crazy... But after reconect netduino ping work Fine... But if i do that...the debug still working???

In Topic: Netduino Pins aways in High Voltage

29 September 2012 - 06:48 PM

Hi Paulo,

When Netduino first boots, all of its pins are in "input, pullup" state. This will provide a weak current (at 3.3V) which may cause your LEDs to light up very weakly. When you create an OutputPort as set it to True, that will drive current.

If you are setting the OutputPort to False and still have voltage on the pin, that shouldn't happen. If that's the case, please create a simple project (4-5 lines of code) and post the full code sample here so we can help take a look.

Chris



Chiris all digital pins has about 3.23 Voltage.

I tryed sent the fallow code to board:

OutputPort motor = new OutputPort(Pins.GPIO_PIN_D1, false);

motor.Write(true);
Thread.Sleep(10000);
motor.Write(false);
motor.Dispose();

but aways all pins show me 2.23v in low and when motor is on voltage go to 3.3v and led lights strong.

when motor is of voltage from pin 1 go to 2.3V.

Looks lime only tension change....not voltage....

In Topic: Netduino Pins aways in High Voltage

28 September 2012 - 12:47 PM

OutputPort motor = new OutputPort(Pins.GPIO_PIN_D1, false);

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.