Skip to content
4ntoine edited this page Feb 1, 2012 · 12 revisions

Welcome to the 4ntoine/Firmata wiki!

This project removes processing. dependency* (import processing.core.*; import processing.serial.*) of original Firmata implementation and gives you an opportunity to use it in:

  • plain Java apps
  • Android apps
  • JavaFX apps

The code is totally refactored, tested and i believe it is beautiful ;)

Origins

I took current original Firmata code, removed PApplet and Processing Serial imports, introduced Serial level of abstraction (ISerial interface) to eliminate hard Serial implementations dependency and created adapters:

  • Processing Serial (to use it with your existing code)
  • RxTx Serial

Installation

As a professional Java developer, i used to use Maven in my job.

Processing is not located in maven repos, so you should:

  1. install java sdk, your favorite java IDE, maven.
  2. add procesing jars as maven modules
  3. build 'parent' module

For this:

  1. download processing binaries zip archive and unpack it. At this time it has 1.5.1 version.
  2. copy *.bat files to archive root folder, near processing.exe.
  3. execute install_processing_core.bat (change '1.5.1' to according processing version, if needed)
  4. execute install_processing_serial.bat (change '1.5.1' to according processing version, if needed)
  5. execute maven clean install in 4ntoine/Firmata project root folder. (change <version>1.5.1</version> to according processing version in '/ProcessingSerial/pom.xml', if needed)

You will get [INFO] BUILD SUCCESS if it's okay.

Usage

Firmata class usage is describes here.

Create Firmata class with according adapter:

public Firmata(ISerial serial)

Use ProcessingSerialAdapter with processing.serial.Serial or IndepProcessingSeriaAdapter with IndepProcessingSerial, which is also based on Processing Serial and RxTx.

IndepProcessingSeriaAdapter example:

ISerial serial = new IndepProcessingSeriaAdapter(new IndepProcessingSerial("COM1", 57600));
Firmata firmata = new Firmata(serial);
serial.start();
// (work with firmata)
serial.stop();

Note: processing.serial.Serial class invokes start() in constructor, in IndepProcessingSerial you should invoke start() yourself in your code.

Restrictions

At this moment:

  • There are no digital pins methods (exactly as in protocol).

Thanks

Thanks to Tasos Valsamidis (visit Sharpduino page, his Firmata implementation for .NET).

Clone this wiki locally