using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using System.Text; using System.IO.Ports; namespace Netduinoser { public class Program{ private static SerialPort s1; private static string s; public static void Main() { InterruptPort port = new InterruptPort(Cpu.Pin.GPIO_Pin10, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); port.OnInterrupt += new NativeEventHandler(port_OnInterrupt); s1 = new SerialPort("COM1", 115200, Parity.None,8,StopBits.One); s1.DataReceived += new SerialDataReceivedEventHandler(s1_DataReceived); s1.Open (); byte[] OutBuf=Encoding.UTF8.GetBytes("All right?\r"); byte[] InBuf=new byte[2]; byte[] temp2 = new byte[] { 0xFE, 0x01 };//clrs while(true) { s1.Write(OutBuf, 0, OutBuf.Length); Thread.Sleep(500); // s1.Write (temp2, 0, temp2.Length); // Debug.Print("OK"); } }
Edited by Chris Walker, 29 January 2011 - 06:48 PM.
moderator added [code][/code] tags