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"); } }
- Netduino Forums
- → Viewing Profile: Topics: skywalker
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.
Community Stats
- Group Members
- Active Posts 4
- Profile Views 6106
- Member Title New Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
Neutral
User Tools
Friends
skywalker hasn't added any friends yet.
Topics I've Started
hardware interrupt
28 January 2011 - 03:35 PM
Get Error "no overload for port_OnInterrupt matches delegate 'Microsoft.Spot.Hardware.NativeEventHandler
Serial datarecieved event
15 December 2010 - 07:17 PM
Having trouble fireing the serial datareceived event. I use com2 for programming. Then I stop debugging, Use putty
on the same port to send characters. The receive event should blink an led.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoMini;
using System.Text;
using System.IO.Ports;
namespace blink
{
public class Program
{
public static SerialPort port2 = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One);
public static OutputPort outpt=new OutputPort(Pins.GPIO_PIN_5,false);
public static void Main()
{
port2.Open();
port2.DataReceived += new SerialDataReceivedEventHandler(ReceiveData);
Thread.Sleep(Timeout.Infinite);
}
public static void ReceiveData(object sender, SerialDataReceivedEventArgs e)
{
outpt.Write(true);
Thread.Sleep(500);
outpt.Write(false);
Thread.Sleep(500);
}
}
}
ttl serial port
10 December 2010 - 07:14 PM
I got the chip running using rs232 port for download. I would like to use the usart for talking to a serial display at the same time.
Can this be done? I tried some netduino code. "s1=new(serialports(com1)); " but got an error.
- Netduino Forums
- → Viewing Profile: Topics: skywalker
- Privacy Policy