- Netduino Forums
- → Flores's Content
Flores's Content
There have been 64 items by Flores (Search limited from 06-June 23)
#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)
#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)
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)
#4570 Shield Request: Self-upgrade shield
Posted by Flores on 07 November 2010 - 08:28 AM in Netduino Plus 2 (and Netduino Plus 1)
#4374 Drive more leds with Netduino
Posted by Flores on 30 October 2010 - 01:29 PM in Netduino 2 (and Netduino 1)
#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)
#4030 Ideas onexpanding analog ports
Posted by Flores on 20 October 2010 - 09:13 AM in Netduino 2 (and Netduino 1)
#4013 Ideas onexpanding analog ports
Posted by Flores on 19 October 2010 - 09:33 PM in Netduino 2 (and Netduino 1)
#4002 USB Dual Interface
Posted by Flores on 19 October 2010 - 08:07 PM in Netduino Plus 2 (and Netduino Plus 1)
#4000 USB Dual Interface
Posted by Flores on 19 October 2010 - 07:59 PM in Netduino Plus 2 (and Netduino Plus 1)
#3931 Netduino output pin and external LED
Posted by Flores on 16 October 2010 - 06:42 PM in Netduino 2 (and Netduino 1)
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)
#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)
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)
#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)
new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
And in the client:
SendTo instead of Send
In the server:
Bind instead of Listenand
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)
#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)
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)
#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)
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)
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)
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
- Netduino Forums
- → Flores's Content
- Privacy Policy