-
Notifications
You must be signed in to change notification settings - Fork 18
Home
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 ;)
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
As a professional Java developer, i used to use Maven in my job.
Processing is not located in maven repos, so you should:
- install java sdk, your favorite java IDE, maven.
- add procesing jars as maven modules
- build 'parent' module
For this:
- download processing binaries zip archive and unpack it. At this time it has 1.5.1 version.
- copy *.bat files to archive root folder, near processing.exe.
- execute
install_processing_core.bat
(change '1.5.1' to according processing version, if needed) - execute
install_processing_serial.bat
(change '1.5.1' to according processing version, if needed) - 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.
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.
At this moment:
- There are no digital pins methods (exactly as in protocol).
Thanks to Tasos Valsamidis (visit Sharpduino page, his Firmata implementation for .NET).