Coder Social home page Coder Social logo

ntruchsess / perl-firmata Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 11.0 4.52 MB

Perl implementation of the firmata client. Originally authored by Aki Mimoto (amimoto) this repository was transfered to Norbert Truchsess (ntruchsess) in 02/2013. Anybody willing to contribute is very wellcome! Please submitt pull-requests against branch 'dev'

Home Page: http://www.firmata.org

License: Other

Perl 80.92% JavaScript 5.32% CSS 3.18% HTML 10.58%

perl-firmata's People

Contributors

bcarroll avatar cfedde avatar jnsbyr avatar ntruchsess avatar upasana-me avatar valdasrk avatar yanick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perl-firmata's Issues

unsupported mode '2' for pin '15' at ../lib/Device/Firmata/Platform.pm line 823.

examples/test.pl is producing an error "unsupported mode '2' for pin '15' at ../lib/Device/Firmata/Platform.pm line 823."

This test was done using an Arduino Mega 2560 R3 and the StandardFirmata sketch included with Arduino 1.0.5.

I did not get this error with an Arduino Nano v3.

I read something a while ago about changing a delay to support the Mega, but I thought that had been included in the newer versions of the StandardFirmata sketch.

Support for Firmata later than 2.06

Some users of FHEM (blueberry63, Meck) try to use Perl Firmata together with a version of ConfigurableFirmata newer than 2.06. The latest version of ConfigurableFirmata that perl-firmata supports seems ot be 2.06. I saw that ConfigurableFirmata nowadays has separate version numbers for the protocol version (2.06) and the firmware version (2.10). But since the REPORT_VERSION message uses the firmware version and not the protocol version, the latest supported version is 2.06.

To solve this problem, either the user has to change the firmata version in his sketch, or perl-firmata has to be extended to support newer versions.

unsupported mode '2' for pin '15' at ../lib/Device/Firmata/Platform.pm line 823.

examples/test.pl is producing an error "unsupported mode '2' for pin '15' at ../lib/Device/Firmata/Platform.pm line 823."

This test was done using an Arduino Mega 2560 R3 and the StandardFirmata sketch included with Arduino 1.0.5.

I did not get this error with an Arduino Nano v3.

The firmata.org WIKI mentions changing the samplingInterval to 99 to support all pins on the Arduino Mega, but I thought that had been included in the newer versions of the StandardFirmata sketch.

Capability query does not respect protocol version

I'm using perl-firmata to read digital inputs and 433 MHz RC signals in FHEM (perl-firmata 0.64). The firmata implementation is RCSwitchFirmata 2.6 based on ConfigurableFirmata 2.6.

  • ConfigurableFirmata 2.6 does not have a feature with ID 0x0B.
  • RCSwitchFirmata 2.6 uses Feature-ID 0x0B for Feature RC_RECEIVE.
  • ConfigurableFirmata 2.7 and higher use Feature-ID 0x0B for Feature PIN_MODE_PULLUP.

perl-firmata seems to be sensitive for the firmata protocol version (e.g. in Constants.pm). Unfortunately, $MODENAMES in Protocol.pm is defined globally and does not respect the firmata protocol version.

Thus, RC_RECEIVE pins are reported as PIN_MODE_PULLUP pins. The application tries to configure the pullup features, which fails.

I therefore request to make Protocol.pm version-dependent.

Possible change to Device::Firmata->open()

I noticed the open() subroutine dies if the connection to the Firmata Server fails. This causes an issue for me because it kills the script that calls the open() subroutine as well. Would it not be better to return(undef) instead of dieing?

I have modified my local copy of Firmata.pm to test this, and it provides the expected functionality. I am able to test the Firmata Server connection with the initial call to open() and handle the error in the calling script instead of having Device::Firmata kill the perl process.

Here is an example:

Original code:
my $device = $package->open($serial_port,$opts) or die "Could not connect to Firmata Server";

New code:
my $device = $package->open($serial_port,$opts) or return(undef);

Error handling is controlled by the calling script, not the Device::Firmata module. This approach will allow the calling script to provide its own error handling (display an error message, try again, etc...) instead of killing the perl process.

Sample code using the return(undef).
my $serial = Device::Firmata->open( 'unavailable_serial_port' ) || die "Could not connect to Firmata Server\n";

Just wanted to see if anyone has any objections to this approach before I commit my changes.

Is Arduino Mega support built-in?

I haven't actually tried interfacing an Arduino Mega using this module, but does the Device::Firmata module include support for the Arduino Mega boards?

I noticed this line in the Constants.pm file, but didn't see anything else board specific.
$DEVICES = { 'arduino_dumilanove' => {}, };

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.