All Projects → euantorano → serial.nim

euantorano / serial.nim

Licence: BSD-3-Clause license
A Nim library for accessing serial ports.

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to serial.nim

Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (+401.69%)
Mutual labels:  serial-ports, serialport
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-59.32%)
Mutual labels:  serial-ports, serialport
Androidserialport
Android串口通信示例
Stars: ✭ 497 (+742.37%)
Mutual labels:  serial-ports, serialport
serialport
PHP Serial Port
Stars: ✭ 42 (-28.81%)
Mutual labels:  serial-ports, serialport
etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-66.1%)
Mutual labels:  serial-ports, serialport
Raspberry-Pi-Electricity-Monitor
Software for monitoring the electricity consumption of a home with a Raspberry Pi
Stars: ✭ 33 (-44.07%)
Mutual labels:  serial-ports, rs232
RxSerialPort
基于Rxjava2.x的串口通信library
Stars: ✭ 11 (-81.36%)
Mutual labels:  serial-ports, serialport
serialPort
Android通用的串口通信库
Stars: ✭ 39 (-33.9%)
Mutual labels:  serial-ports, serialport
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (+140.68%)
Mutual labels:  serial-ports, serialport
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (+67.8%)
Mutual labels:  serial-ports, serialport
Node Serialport
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Stars: ✭ 5,015 (+8400%)
Mutual labels:  serial-ports, serialport
Common
Yet another serial port debugger.
Stars: ✭ 245 (+315.25%)
Mutual labels:  serial-ports, serialport
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (+8.47%)
Mutual labels:  serial-ports, serialport
Libserial
Serial Port Programming in C++
Stars: ✭ 201 (+240.68%)
Mutual labels:  serial-ports, serialport
SerialPundit
Serial port communication in Java - FTDI D2XX, HID API, X/Y modem
Stars: ✭ 116 (+96.61%)
Mutual labels:  rs232, serialport
RS232-Monitor-Database
🔌📺 This is a public database for all the known RS232 commands for professionnal screens, monitors and projectors. Feel free to contribute !
Stars: ✭ 22 (-62.71%)
Mutual labels:  rs232
ParadoxRs232toMqtt
esp8266, serial bus to mqtt for Paradox alarm systems
Stars: ✭ 66 (+11.86%)
Mutual labels:  rs232
libcssl
Columbo Simple Serial Library is an easy to use, event driven serial port communication library for Linux.
Stars: ✭ 38 (-35.59%)
Mutual labels:  serialport
JavaSerial
Use serial ports from Java using standard IO methods.
Stars: ✭ 14 (-76.27%)
Mutual labels:  serial-ports
bluetooth-serial-port
multi-platform bluetooth serial port library for C++
Stars: ✭ 59 (+0%)
Mutual labels:  serial-ports

serial.nim

A library to work with serial ports using pure Nim.

Installation

serial can be installed using Nimble:

nimble install serial

Or add the following to your .nimble file:

# Dependencies

requires "serial >= 1.0.0"

Usage

There are some examples in the examples directory, showing reading from and writing to a serialport.

Listing serial ports

import serial # Or: `import serial/utils`

for port in listSerialPorts():
  echo port

Reading from/writing to a serial port (echoing data)

import serial # Or: `import serial/serialport`

let port = newSerialPort("COM1")
# use 9600bps, no parity, 8 data bits and 1 stop bit
port.open(9600, Parity.None, 8, StopBits.One)

# You can modify the baud rate, parity, databits, etc. after opening the port
port.baudRate = 2400

var receiveBuffer = newString(1024)
while true:
  let numReceived = port.read(receiveBuffer)
  discard port.write(receiveBuffer[0 ..< numReceived])

Using the SerialStream

import serial # Or: `import serial/serialstream`

let port = newSerialStream("COM1", 9600, Parity.None, 8, StopBits.One, buffered=true)

while true:
  # Read a line from the serial port then write it back.
  port.writeLine(port.readLine())

Features

  • Basic port reading/writing for Windows/Posix
  • Port setting control - baud rate, stop bits, databits, parity, handshaking
  • Port listing to list available serial ports
    • Windows, using SetupDiGetClassDevs
    • Mac, using I/O Kit
    • Posix, by iterating possible device files
  • High level SerialPortStream that complies with the streams API
  • Async API using asyncdispatch for reading from and writing to a port
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].