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.

rchelicopter

Member Since 30 Mar 2012
Offline Last Active Nov 06 2015 03:04 AM
-----

Topics I've Started

Netduino Plus 2 network question

25 January 2013 - 11:21 PM

Hello,

 

I have a Netduino Plus and a Plus 2, when I power up the Netduino Plus I also power up my dhcp router and it always seemed to wait for the router to obtain an IP address from it via DHCP.

With the Netduino Plus 2 when powered up it times out with a System.Net.Sockets.SocketException.

What was the netduino plus doing that the plus 2 is not, is there a way around this without going to a static address?


Trying to use string.Contains

11 January 2013 - 04:25 AM

Is there a string.Contains alternative in .netmf.  I want to check if a string contains a certain substring

 

Like

 

string abc = 1234

 

if (abc.Contains("1234"))

{

do stuff

}


Cannot connect to Netduino Plus 2 socket without debugging

29 December 2012 - 02:53 AM

Hello, I have been playing around with the Plus 2 and 4.2.1.2 and I just noticed that i can't connect to the socket if the usb "and" debugger are not running.  It works fine otherwise.   Can someone please have a look at this and see if I'm just doing something wrong.
using System;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;using System.Text; namespace Socket_Server{    public class Program    {        public static void Main()        {            using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))            {                socket.Bind(new IPEndPoint(IPAddress.Any, 10100));                socket.Listen(1);                {                     while (true)                    using (Socket NetduinoSocket = socket.Accept())                    {                        byte[] buffer = Encoding.UTF8.GetBytes("You Are Now Connected.....");                        NetduinoSocket.Send(buffer, 0, buffer.Length, 0);                         bool keepAlive = true;                         while (keepAlive)                        {                            if (NetduinoSocket.Poll(1, SelectMode.SelectRead))                            {                                byte[] bytes = new byte[10];                                int count = NetduinoSocket.Receive(bytes);                                 char[] chars = Encoding.UTF8.GetChars(bytes);                                string position = new string(chars, 0, count);                                Debug.Print(position);                            }                        }                    }                }            }        }    }}

Going from Netduino Plus to non Plus

13 December 2012 - 06:00 PM

Hello, Is there a way to use a project that was started on a Netduino Plus on a regular Netduino (non plus). I'm not using any networking in my current project but visual studio keeps looking for the Plus that the project was originally created for. Thanks.

Passing Servo's to another thread.

23 July 2012 - 06:47 PM

Hello all, I wonder if someone could help me with some code to pass a servo (Servo Servo1 = new Servo(Pins.GPIO_PIN_D5); from the Main method to another thread (ProcessClientRequest), here is the code that I'm playing with at the moment. using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; using Microsoft.SPOT; using SecretLabs.NETMF.Hardware.NetduinoPlus; using Servo_API; namespace Threaded_Project { public static class Program { public static void Main() { Servo Servo1 = new Servo(Pins.GPIO_PIN_D5); Servo Servo2 = new Servo(Pins.GPIO_PIN_D6); Socket Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Server.Bind(new IPEndPoint(IPAddress.Any, 10100)); Server.Listen(1); while (true) { Socket clientSocket = Server.Accept(); new ProcessClientRequest(clientSocket); } } } internal sealed class ProcessClientRequest { private Socket NetduinoSocket; public ProcessClientRequest(Socket clientSocket) { NetduinoSocket = clientSocket; new Thread(ProcessRequest).Start(); //new Thread(ReadTester).Start(); } private void ProcessRequest() { using (NetduinoSocket) { byte[] buffer = Encoding.UTF8.GetBytes("Connected"); NetduinoSocket.Send(buffer, 0, buffer.Length, 0); while (true) { if (NetduinoSocket.Poll(1, SelectMode.SelectRead)) { byte[] bytes = new byte[NetduinoSocket.Available]; int count = NetduinoSocket.Receive(bytes); string request = new String(Encoding.UTF8.GetChars(bytes)); Debug.Print(request); //Servo1.Degree = 100; //Servo2.Degree = 100; } } } } } }

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.