Code Monkey home page Code Monkey logo

ardutooth's Introduction

Ardutooth

Ardutooth Version Download

Ardutooth Banner

Ardutooth is a lightweight Android Archive Library (.aar) that allows you to create easily a stable bluetooth connection with an Arduino board. Once a connection has been established, you can fetch information about it or send data to the board (reading has not been implemented yet).

How to use it

The first thing you need is to get an instance of Arduooth, preferably insde the onCreate() callback, by the getInstance(activity) method: Ardutooth mArdutooth = Ardutooth.getInstance(activity); where the parameter represents the current activity.

After that you can allows user to established a bluetooth connection with mArdutooth.setConnection();. This simply method will check if bluetooth is supported on the current device, if is it turned on and if it's already connected with another bluetooth device. If bluetooth is supported but not turned on or disconnected a series of dialogs will guide user through the process. Bluetooth off Bluetooth not connected

You can check if connection has successfully established using mArdutooth.isConnected();

Once a stable connection has been established, you can send data to your Arduino throgh the Serial Monitor with these methods:

  • mArdutooh.sendInt(value)
  • mArdutooh.sendLong(value)
  • mArdutooh.sendShort(value)
  • mArdutooh.sendFloat(value)
  • mArdutooh.sendDouble(value)
  • mArdutooh.sendBoolean(value)
  • mArdutooh.sendChar(value)
  • mArdutooh.sendString(value)

The library offers also methods to retrieve information about Bluetooth module, output stream and socket.

To close communication, simply use mArdutooh.disconnect();

Arduino Side

You can find a very basic sketch for arduino to the path /Arduino_Basic_Sketch/Basic_Sketch.ino. Obviously this is a basic demo but it shows you how arduino could read data through the Serial Monitor and could be a starting point for your own sketch.

Final Note

You can download the latest ardutooth .aar file in here

If you don't know how add an .aar file to your Android Project take a look here: Add your library as a dependency - Android Developer

If you want add/edit features, any improvements is really appreciated. Just fork and pull request.

ardutooth's People

Contributors

giuseppebrb avatar

Watchers

 avatar  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.