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.

Flores's Content

There have been 64 items by Flores (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#11714 Serial to PC just wont work, What am I Doing Wrong

Posted by Flores on 06 April 2011 - 08:53 AM in Netduino 2 (and Netduino 1)

If the cable is the problem, and you want a cheap solution for converting the signals you could use the TI MAX232. Works for me.



#7601 If you were to get two netduinos to talk to each other, what would you use?

Posted by Flores on 13 January 2011 - 08:55 PM in Netduino 2 (and Netduino 1)

Connect pin 1 on netduino 1 to pin 2 on netduino 2, pin 2 on netduino 1 to pin 1 on netduino 2, and connect the grounds.

On the sender:

  1:          public static void Main()
   2:          {
   3:              SerialPort port = new SerialPort(SerialPorts.COM1,115200);
   4:              OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
   5:   
   6:              port.Open();
   7:   
   8:              while (true)
   9:              {
  10:                  led.Write(true);
  11:                  port.Write(buff, 0, buff.Length);
  12:                  Thread.Sleep(100);
  13:                  led.Write(false);
  14:                  Thread.Sleep(900);
  15:                  buff = Encoding.UTF8.GetBytes(DateTime.Now.TimeOfDay.ToString());
  16:              }
  17:          }

On the receiver:

  1:          public static void Main()
   2:          {
   3:   
   4:              SerialPort serial = new SerialPort(SerialPorts.COM1, 115200);
   5:              serial.ReadTimeout = 8;
   6:              serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);
   7:              serial.Open();
   8:              while (true)
   9:              {
  10:   
  11:                  Thread.Sleep(Timeout.Infinite);
  12:              }
  13:   
  14:          }
  15:   
  16:          static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
  17:          {
  18:              int bytesReceived = ((SerialPort)sender).BytesToRead;
  19:              byte[] bytes = new byte[bytesReceived];
  20:              ((SerialPort)sender).Read(bytes, 0, bytes.Length);
  21:              string received = new string(System.Text.Encoding.UTF8.GetChars(bytes));
  22:              Debug.Print(received); 
  23:   
  24:          }



#7599 If you were to get two netduinos to talk to each other, what would you use?

Posted by Flores on 13 January 2011 - 08:48 PM in Netduino 2 (and Netduino 1)

Serial.. by far the easiest.



#4570 Shield Request: Self-upgrade shield

Posted by Flores on 07 November 2010 - 08:28 AM in Netduino Plus 2 (and Netduino Plus 1)

You don't state this directly.. but this would allow upgrades by network, right?



#4374 Drive more leds with Netduino

Posted by Flores on 30 October 2010 - 01:29 PM in Netduino 2 (and Netduino 1)

Then you have to use a transistor for each output.



#4372 Drive more leds with Netduino

Posted by Flores on 30 October 2010 - 01:17 PM in Netduino 2 (and Netduino 1)

Hello,
I have made a simple circuit to power a Led with Netduino using a NPN transistor to amplify the Netduino PIN base current (8mA) to 20mA for the Led. Now I want to drive more then one Led with more then one pin.I have to use a single transistor for each led ? Or is there a different solution ?

Thanks,
Paolo


If you want to drive more leds this way (up to eight), the uln2803 could be handy.



#4318 Introduction + where to buy NetDuino Plus board

Posted by Flores on 28 October 2010 - 01:42 PM in Netduino Plus 2 (and Netduino Plus 1)

I'm not sure, but I believe the Plus was available for a short time/amount with the resellers. And a selected group of community members got one. It's exactly the same platform as the regular netduino, with the addition of a network connection and a microsd card reader.



#4030 Ideas onexpanding analog ports

Posted by Flores on 20 October 2010 - 09:13 AM in Netduino 2 (and Netduino 1)

Analog Mux?

http://www.sparkfun....roducts_id=9056



Yes. that's it. Thanks



#4013 Ideas onexpanding analog ports

Posted by Flores on 19 October 2010 - 09:33 PM in Netduino 2 (and Netduino 1)

I want to make a system that monitors battery levels of as much batteries as possible. This doesn't have to happen constant.. it's okay to have some sort of loop.. check bat 1, check bat 2, check bat 3, and so on. So I want to have some sort of digital switch that can be controlled with digital outs, for switching between analog levels of the batteries. Any thoughts on which component I could use for that? Thanks



#4002 USB Dual Interface

Posted by Flores on 19 October 2010 - 08:07 PM in Netduino Plus 2 (and Netduino Plus 1)

Sorry, I guess it is not totally done yet..

See here



#4000 USB Dual Interface

Posted by Flores on 19 October 2010 - 07:59 PM in Netduino Plus 2 (and Netduino Plus 1)

I know there is a firmware with which you can debug over serial, and use the usb as you want. But never used it.



#3931 Netduino output pin and external LED

Posted by Flores on 16 October 2010 - 06:42 PM in Netduino 2 (and Netduino 1)

If you want to drive more leds this way (up to eight), the uln2803 could be handy.

See it in action with a netduino and an analog input here



#2875 Wrong network addressing breaks netduino plus

Posted by Flores on 25 September 2010 - 12:46 PM in Netduino Plus 2 (and Netduino Plus 1)

If you try to connect to a non-existant address, it's possible that lwIP has a timeout of "infinite" and will just never stop trying :) Or it's possible that there's a bug in there. .NET MF is using interop with networking, and any native code (i.e. lwIP's socket connect routines) that don't return could cause Visual Studio to wait and wait and wait... There is room to improve this--and this is great feedback to start down that path.

If I understand it right, connecting to a good address is successful--and you can easily recover by pressing the reset button on the Netduino Plus--correct? That's a good backup plan for now.

We'll look at timeout values and see what we can do to make it throw an exception quickly rather than wait forever...

Thank you very much for the feedback!

Chris



Yes, connecting to a existant address works fine. And yes, I can recover using the reset button.
I timeout would be nice, I would expect and exception.



#2862 Introducing Netduino Plus -- Notes

Posted by Flores on 25 September 2010 - 07:56 AM in Netduino Plus 2 (and Netduino Plus 1)

Chris, I have no microSD atm, so will need to buy one. Could you post a list of cards that are known to work?



#2860 Wrong network addressing breaks netduino plus

Posted by Flores on 25 September 2010 - 07:48 AM in Netduino Plus 2 (and Netduino Plus 1)

I'm experimenting with the code I posted earlier:

using System; 
using System.Threading; 
using Microsoft.SPOT; 
using Microsoft.SPOT.Hardware; 
using SecretLabs.NETMF.Hardware; 
using SecretLabs.NETMF.Hardware.Netduino; 
using Microsoft.SPOT.Net.NetworkInformation; 
using Microsoft.SPOT.Net; 
using System.Net.Sockets; 
using System.Net; 
using System.Text; 
 
namespace NetduinoApplication2 
{ 
    public class Program 
    { 
 
        public static void Main() 
        { 
 
            using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) 
            { 
 
                IPHostEntry entry = Dns.GetHostEntry("192.168.5.111"); 
                IPAddress address = entry.AddressList[0]; 
                IPEndPoint endpoint = new IPEndPoint(address, 80); 
 
                socket.Connect(endpoint); 
                socket.Send(Encoding.UTF8.GetBytes("Hallo Netduino plus")); 
            } 
 
        } 
 
    } 
}

This works.. I'v got IIS running on my notebook, and i'm seeing this in my logfiles:

2010-09-25 07:39:58 192.168.5.150 4098 192.168.5.111 80 - Hallo Netduino 400 - BadRequest -

Which is expected.


However, if I change the ip address in the code above to a non existant address (like 192.168.5.10)..just to test what happens.. this totally crashes the netduino plus and VS 2010. Only way to recover is to reset the netduino with the reset button.

Am I just the wrong code? or is this a bug?



#2858 Default behaviour

Posted by Flores on 25 September 2010 - 07:37 AM in Netduino Plus 2 (and Netduino Plus 1)

I've just found out that by default the netduino plus is responding to icmp(ping) requests.. Is this the only default behaviour of the network stack? or are there more services that run? And.. can I disable this behaviour?



#2824 How to use the new functionalities

Posted by Flores on 24 September 2010 - 09:17 PM in Netduino Plus 2 (and Netduino Plus 1)

In theory, yes. But some PCs have auto-detect and will swap the RX/TX if you use teh "wrong" cable.


Ha.. connected a cable to my notebook and all the lights come on.. I guess it's working.
Will be testing more tomorrow.. bedtime now.



#2817 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:49 PM in Netduino Plus 2 (and Netduino Plus 1)

Are you running on a Windows PC with an Ethernet jack? You could set up network connection sharing and plug the Netduino into your PC...


Good idea... won't I be needing a cross cable for that?



#2815 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:43 PM in Netduino Plus 2 (and Netduino Plus 1)

And for UDP, use:

new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))

And in the client:

SendTo instead of Send

In the server:

Bind instead of Listen
and
ReceiveFrom instead of Receive



#2814 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:38 PM in Netduino Plus 2 (and Netduino Plus 1)

Btw.. I haven't tested the code above yet.. I'll have to get a switch to connect the netduino.. i'm on wireless only atm



#2813 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:36 PM in Netduino Plus 2 (and Netduino Plus 1)

To make it complete.. here is how to receive data

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

namespace NetduinoApplication2
{
    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, 80));
                socket.Listen(1);

                using (Socket commSocket = socket.Accept())
                {
                    if (commSocket.Poll(-1,SelectMode.SelectRead))
                    {
                        byte[] bytes = new byte[commSocket.Available];
                        int count = commSocket.Receive(bytes);

                        Debug.Print(new String(Encoding.UTF8.GetChars(bytes)));
                    }
                }                
            }
        }
    }
}

Have fun !!!



#2809 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:27 PM in Netduino Plus 2 (and Netduino Plus 1)

Oh.. won't EnableDhcp() work ?



#2807 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:24 PM in Netduino Plus 2 (and Netduino Plus 1)

Sure you can.. I guess this would be the easiest:

            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();  
  
            foreach (NetworkInterface networkInterface in networkInterfaces)  
            {  
                networkInterface.EnableDhcp();
            }

When I said hardcoded.. I really meant 'defaulted to'..



#2804 How to use the new functionalities

Posted by Flores on 24 September 2010 - 08:15 PM in Netduino Plus 2 (and Netduino Plus 1)

Here's how to send data:

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

namespace NetduinoApplication2
{
    public class Program
    {

        public static void Main()
        {

            using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
            {

                IPHostEntry entry = Dns.GetHostEntry("192.168.5.111");
                IPAddress address = entry.AddressList[0];
                IPEndPoint endpoint = new IPEndPoint(address, 80);

                socket.Connect(endpoint);
                socket.Send(Encoding.UTF8.GetBytes("Hallo Netduino plus"));
            }

        }

    }
}



#2799 How to use the new functionalities

Posted by Flores on 24 September 2010 - 07:48 PM in Netduino Plus 2 (and Netduino Plus 1)

Aha.. cool.

For those interresed, here's how to list your network properties:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using Microsoft.SPOT.Net.NetworkInformation;

namespace NetduinoApplication2
{
    public class Program
    {

        public static void Main()
        {
            // write your code here
            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();

            foreach (NetworkInterface networkInterface in networkInterfaces)
            {
                Debug.Print("IP Address: " + networkInterface.IPAddress);
                Debug.Print("Subnet mask " + networkInterface.SubnetMask);
            }


        }

    }
}

Seems like my netduino plus is hardcoded to IP static IP address 192.168.5.150/24




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.