Giter Site home page Giter Site logo

libserialport.jl's Introduction

Build Status

LibSerialPort.jl

libserialport is a small, well-documented C library for general-purpose serial port communication. This is a julia wrapper for the library.

Apart from a very few non-essential functions, the entire library API (about 75 functions) is wrapped using ccall. In addition, a higher-level interface is also provided that follows Julia's IO stream interface.

Installation

pkg> add LibSerialPort

Usage

Try

julia> using LibSerialPort
julia> list_ports()  # or get_port_list() for an array of names

The examples/ directory contains a simple serial console for the command line. This may serve as a useful starting point for your application. The serial_example.ino sketch can be flashed to a microcontroller supported by the Arduino environment.

using LibSerialPort

# Modify these as needed
portname = "/dev/ttyS0"
baudrate = 115200

# Snippet from examples/mwe.jl
LibSerialPort.open(portname, baudrate) do sp
	sleep(2)

	if bytesavailable(sp) > 0
    	println(String(read(sp)))
	end

    write(sp, "hello\n")
    sleep(0.1)
    println(readline(sp))
end

The tests are also worth looking at for demonstration of i/o and configuration. They can be run via julia test/runtests.jl <address> <baudrate>. Unless the address of your device matches that in runtests.jl, doing pkg> test LibSerialPort will fail. This problem would be addressed by support for args in the Pkg REPL.

Note that on Windows, returning an OS-level port handle is not yet supported.

libserialport.jl's People

Contributors

andrewadare avatar ianbutterworth avatar juliatagbot avatar mgkuhn avatar octogonapus avatar reubenhill avatar samuelpowell avatar scls19fr avatar tknopp avatar yakir12 avatar

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.