Git Product home page Git Product logo

arduino-simple-rpc's Introduction

Arduino simpleRPC API client library and CLI

https://readthedocs.org/projects/simplerpc/badge/?version=latest

This library provides a simple way to interface to Arduino functions exported with the simpleRPC protocol. The exported method definitions are communicated to the host, which is then able to generate an API interface using this library.

Features:

  • User friendly API library.
  • Command line interface (CLI) for method discovery and testing.
  • Function and parameter names are defined on the Arduino.
  • API documentation is defined on the Arduino.
  • Support for disconnecting and reconnecting.
  • Support for serial and ethernet devices.

Please see ReadTheDocs for the latest documentation.

Quick start

Export any function e.g., digitalRead() and digitalWrite() on the Arduino, these functions will show up as member functions of the Interface class instance.

First, we make an Interface class instance and tell it to connect to the serial device /dev/ttyACM0.

>>> from simple_rpc import Interface
>>>
>>> interface = Interface('/dev/ttyACM0')

We can use the built-in help() function to see the API documentation of any exported method.

>>> help(interface.digital_read)
Help on method digital_read:

digital_read(pin) method of simple_rpc.simple_rpc.Interface instance
    Read digital pin.

    :arg int pin: Pin number.

    :returns int: Pin value.

All exposed methods can be called like any other class method.

>>> interface.digital_read(8)         # Read from pin 8.
0
>>> interface.digital_write(13, True) # Turn LED on.

Further reading

For more information about the host library and other interfaces, please see the Usage and Library sections.

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.