» Topic: Including external librariesBreakout

Including external libraries

About Forums Forum Including external libraries

Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #980
    nikolas
    Participant

    Hey! Great work guys!

    I’ve been trying to implement an application in which I am reading over serial the data from a PS2 mouse.
    This is relatively straightforward using the ps2 library.

    However, I cannot figure out how to include the ps2 library in my breakout code, to be able to use the same functionality.

    Is this possible?

    Thanks in advance for the help!

    Nikolas

    #982

    I need more info to understand exactly what it is you are trying to do. By “ps2 library” are you referring to an arduino ps2 library or a JavaScript ps2 library (which would require some sort of a proxy)?

    Are you trying to include a ps2 library in the Arduino code or in the Breakout JavaScript code?

    #983
    nikolas
    Participant

    Thanks for the reply!

    I already have a working sketch for arduino for getting the input, using this arduino library:

    The way it works is that at the beginning of the sketch, you do:
    #include <ps2.h>
    PS2 mouse(6, 5);

    so that later on you can do:
    mouse.write(0xff); // reset
    mouse.read(); // ack byte
    etc…

    So basically I could port this code to Breakout Javascript, as long as I can include the Arduino library ps2.h.

    Thanks again!

    #984

    You will need to create a custom Firmata sketch that mixes the ps2 functionality with any other functionality you may need for your application (analog i/o, digital i/o, i2c, etc).

    This is not easy however. Do you know which functionality you need other than the ps2 device or is the ps2 device the only component you’re connecting to the Arduino?

    #985

    You will need to create a custom Firmata sketch that mixes the ps2 functionality with any other functionality you may need for your application (analog i/o, digital i/o, i2c, etc).

    This is not easy however. Do you know which functionality you need other than the ps2 device or is the ps2 device the only component you’re connecting to the Arduino?

    #986
    nikolas
    Participant

    I ended up just modifying the ps2 library into normal arduino code that I can have inside a single script.
    However this might be an interesting feature request in general, i.e. the ability to load external libraries, without having to customize Firmata.

    #987

    It would be impossible to load an external library without writing custom firmware unless that external library already conforms to the Firmata protocol. Most libraries do not (there is really no reason to) so you have to write a wrapper to make it conform to the protocol (wrapping the sysex send and receive methods of the Arduino Firmata library). You then need to add support to the client side (JavaScript) code as well.

    That said, there is work being done to make adding custom features easier: . ConfigurableFirmata is like a plugin system for Firmata that makes it easier to mix and match custom and standard features. You would still have to wrap an external library using the proper Firmata methods.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Forum’ is closed to new topics and replies.