Giter Club home page Giter Club logo

Comments (2)

tino avatar tino commented on August 20, 2024

Paul Stanley wrote:

If you're running into this restriction here's a diff of changes for pyfirmata.py that worked for me. Tested with a Raspberry Pi running python 2.7 and a teensy 2.0++ with the StandardFirmata sketch from Arduino 1.0.1 (PWM tested only)
(Can't work out how to display this diff properly!)

diff pyfirmata.py pyfirmata_extended_analog.py
30a31

EXTENDED_ANALOG = 0x6F # analog write (PWM, Servo, etc) to any pin
488a490,494

  # use the extended analog feature if the pin no. >15
  # this will allow PWM and SERVO on all possible pins,
  # for teensy boards for example. 
  # Keep the old message format for pins <=15 for
  # compatibility with older firmata versions.

491,494c497,506 < msg = chr(ANALOG_MESSAGE + self.pin_number) < msg += chr(value % 128) < msg += chr(value >> 7) < self.board.sp.write(msg)

        if self.pin_number < 16:
            msg = chr(ANALOG_MESSAGE + self.pin_number)
            msg += chr(value % 128)
            msg += chr(value >> 7)
            self.board.sp.write(msg)
        else:
            msg = chr(self.pin_number)
            msg += chr(value % 128)
            msg += chr(value >> 7)
            self.board.send_sysex(EXTENDED_ANALOG, msg)

497,500c509,518 < msg = chr(ANALOG_MESSAGE + self.pin_number) < msg += chr(value % 128) < msg += chr(value >> 7) < self.board.sp.write(msg)

        if self.pin_number < 16:
            msg = chr(ANALOG_MESSAGE + self.pin_number)
            msg += chr(value % 128)
            msg += chr(value >> 7)
            self.board.sp.write(msg)
        else:
            msg = chr(self.pin_number)
            msg += chr(value % 128)
            msg += chr(value >> 7)
            self.board.send_sysex(EXTENDED_ANALOG, msg)

from pyfirmata.

setnicka avatar setnicka commented on August 20, 2024

What tests are needed to adopt this solution?

from pyfirmata.

Related Issues (20)

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.