using System.IO.Ports;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespace barcode_scanner{ public class Program { public static InputPort bsr = new InputPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.Disabled); public static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); public static void Main() { SerialPort mySerialPort = new SerialPort("COM1"); mySerialPort.BaudRate = 9600; mySerialPort.Parity = Parity.None; mySerialPort.StopBits = StopBits.One; mySerialPort.DataBits = 8; mySerialPort.Handshake = Handshake.None; mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); } public static void DataReceivedHandler( object sender, SerialDataReceivedEventArgs e) { led.Write(true); Thread.Sleep(1000); led.Write(false); Thread.Sleep(Timeout.Infinite); }
[color=rgb(102,102,102);font-family:'Segoe UI', Helvetica, Garuda, Arial, sans-serif;]I'm using the above code to receive data through a serial port connected to my netduino plus 2 via a breakout board (RS232 to TTL converter- [/color]http://www.embeddedm...-TTL-Converter/[color=rgb(102,102,102);font-family:'Segoe UI', Helvetica, Garuda, Arial, sans-serif;]). The data i want to receive is from a barcode scanner whose output is a RS232 female, so i use a RS232 male to male cable and then use the above mentioned breakout board to connect to netduino plus 2. Upon use of the above code led does not blink. All i want to do is blink the led when data is read from barcode scanner i.e., when the barcode scanner scans a barcode. Please help me resolve this. Thanks in advance.[/color]