GithubHelp home page GithubHelp logo

rlishtaba / ruby-serial-port Goto Github PK

View Code? Open in Web Editor NEW
6.0 5.0 1.0 151 KB

Ruby cross-platform interface to native Serial Port (RS-232). Ruby native extension.

Home Page: https://github.com/rlishtaba/ruby-rs-232

License: MIT License

Ruby 19.62% C 80.38%
serial-ports serial rs-232 transport native-extensions communication ruby-serialport

ruby-serial-port's Introduction

Build Status

Ruby Serial Port implementation as C Native Extension. [ RS-232 ]

Rubygem offering simple API in order to start using Serial Port communication in your project running on Linux, Mac OS X or Windows.

Installation

Add this line to your application's Gemfile:

gem 'rs_232'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rs_232

Usage

You may use this gem directly as a low-level transport layer in your communication module. As an alternative you may check another gem called (ruby-digital-transport)[https://github.com/rlishtaba/ruby-digital-transport] which is kind of transport abstraction porviding unified interface to SerialPort (using this gem), TCP and USB-HID.

   > include Rs232
   > port = new_serial_port('/dev/tty.ACM0', baud_rate: 9600)
   #=> #<Rs232::Impl @port='/dev/tty.ACM0'>
   > port.open?
   #=> false
   > port.connect # rasing IOError in case of port couldn't be opened.
   #=> #<Rs232::Impl @port='/dev/tty.ACM0'> 
   > port.pending_bytes
   #=> 15
   > port.read(15)
   #=> 'Hello, World!!!'
   > port.write("Hi")
   #=> 2
   > port.close
   #=> true
   > port.open?
   #=> false

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rlishtaba/ruby-rs-232. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

ruby-serial-port's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

qume

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.