User`s manual

ThinkCore DA-660 WinCE User’s Manual Programming Examples
5-9
private void ErrorEvent(object sender, SerialErrorReceivedEventArgs e)
{
Console.WriteLine("error");
}
private void DataReceived(object sender, SerialDataReceivedEventArgs e)
{
while (port.BytesToRead > 0)
{
Console.WriteLine("Receiving Data: " + port.ReadByte());
}
}
private bool IsOpen()
{
return port.IsOpen;
}
static void Main(string[] args)
{
MxComPortEx comPort = new MxComPortEx("COM3:", 115200);
comPort.Open();
if (comPort.IsOpen())
{
int count = 0;
while (count++ < 10)
{
comPort.SendData("ABCDEFGH" + count);
}
comPort.Close();
}
}
}
}
Example #2—Buzzer
For example, the following code triggers the buzzer for 50 milliseconds at frequency 2200Hzs.
using System;
using System.Collections.Generic;
using System.Text;
using moxa;
namespace test
{