项目作者: nariichi3322

项目描述 :
Simple serial port handler.
高级语言: C#
项目地址: git://github.com/nariichi3322/SimpleSerial.git
创建时间: 2020-07-01T08:30:39Z
项目社区:https://github.com/nariichi3322/SimpleSerial

开源协议:MIT License

下载


SimpleSerial

Simple serial port handler.

Intro

A simple serial port handler with receive buffer, received data will be stored in queue until user is taking out them.

Usage

  1. using SimpleSerial;
  2. using SimpleSerial.Serial;
  3. class Program
  4. {
  5. static void main()
  6. {
  7. /* New simple serial class with buffer size 256 */
  8. ISimpleSerial Serial = new ClassSerialPort(256);
  9. /* Get port list */
  10. Serial.GetPortList(out string[] portList);
  11. /* Initialize port with port name and baud rate */
  12. Serial.PortInitialize(portList[0], 115200);
  13. /* Open port */
  14. Serial.OpenPort();
  15. /* Write a data byte to port */
  16. Serial.Write(0x30);
  17. /* Read a data byte from port */
  18. Serial.Read(out byte readData);
  19. /* Close port */
  20. Serial.ClosePort();
  21. }
  22. }