- Netduino Forums
- → remllik's 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.
remllik's Content
There have been 3 items by remllik (Search limited from 06-June 23)
#691 How to wire up the serial port
Posted by remllik on 17 August 2010 - 07:11 PM in Netduino 2 (and Netduino 1)
Thanks. I guess I will need an RS232 shield? If that is the case I might use an ethernet shield or usb shield instead.
#683 How to wire up the serial port
Posted by remllik on 17 August 2010 - 06:42 PM in Netduino 2 (and Netduino 1)
Yes. I used a serial cable from the computer. I cut the end of the cable off to expose the wires.
#677 How to wire up the serial port
Posted by remllik on 17 August 2010 - 06:24 PM in Netduino 2 (and Netduino 1)
I am trying to wire up the serial port and have the AdvancedButton demo send a message when the button is pressed. I am trying to use HyperTerminal to monitor the messages from the NetDuino.
I connected pin 5 on the serial cable to Gnd next to digital pin 13.
I tried connecting Pin 2 on the serial cable to D0 and Pin 3 to D1.
Hyperterminal is configured for 4800,8,N,1 with no handshaking.
Here is the code I am using. Stepping through the code the port.open works and the send returns 12 bytes written.
Am I doing anything wrong?
I connected pin 5 on the serial cable to Gnd next to digital pin 13.
I tried connecting Pin 2 on the serial cable to D0 and Pin 3 to D1.
Hyperterminal is configured for 4800,8,N,1 with no handshaking.
Here is the code I am using. Stepping through the code the port.open works and the send returns 12 bytes written.
Am I doing anything wrong?
using System; using System.IO.Ports; using System.Text; // UTF Encoding using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace NetduinoApplication1 { public class Program { static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); //instantiate the serial port connection static SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One); public static void Main() { serialPort.Open(); if (serialPort.IsOpen) { Debug.Print("Serial Port is open."); } InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); button.OnInterrupt += new NativeEventHandler(button_OnInterrupt); Thread.Sleep(Timeout.Infinite); } static void button_OnInterrupt(uint data1, uint data2, DateTime time) { // Set the led led.Write(data2 == 0); // Encode to UTF8 UTF8Encoding enc = new UTF8Encoding(); // Encode Byte array string tempString = "Button Press"; byte[] tempData = enc.GetBytes(tempString); // Write to Serial Port int bytesWritten = serialPort.Write(tempData, 0, tempData.Length); Debug.Print("Bytes Written" + bytesWritten.ToString()); } } }
- Netduino Forums
- → remllik's Content
- Privacy Policy