Giter VIP home page Giter VIP logo

Comments (5)

SolidSoils avatar SolidSoils commented on June 26, 2024

Hi,

SetDigitalPin() sets an analog value on a PWM or Servo enabled pin. When you need to set a digital value on a digital port, you need method SetDigitalPort().

SetDigitalPort(0, 32) sets pin 6 of port 0 on an Arduino Uno. SetDigitalPort(0, 0) clears the pin (or actually all pins on the port).

The IFirmata protocol is designed to map closely to the Firmata protocol standard. Setting each pin individually would also be a bit inefficient, because it would require multiple commands to set all pins on a port where only one would do the job as well.

from arduino.

richardjharding avatar richardjharding commented on June 26, 2024

Thanks for the explanation - so in practice when setting a single pin I need to read all the pins and merge my desired pin state with the current state of the other pins so as not to accidentally overwrite the current state of other pins on the same port?

from arduino.

SolidSoils avatar SolidSoils commented on June 26, 2024

Yes, this is also how Firmata on Arduino works. You cannot set a single bit/pin on a hardware register ('port') without affecting the other bits.

Googling such a feature brought me to this page on Github: firmata/arduino#102. It's a discussion I initiated when I was designing this library. (Totally forgot about it, LOL.) At the end of the discussion Soundanalogous commented (a few weeks ago) he added the ability to set individual pin values.

My library is currently on version 2.3 of the Firmata protocol, but I hope to upgrade it to version 2.5 later this year.

from arduino.

SolidSoils avatar SolidSoils commented on June 26, 2024

Added an overload for SetDigitalPin:

SetDigitalPin(int pin, bool value)

sets a pin that has been set in digital output mode.

from arduino.

kuklovod13 avatar kuklovod13 commented on June 26, 2024

SetDigitalPin(int pin, bool value)
is not working

Firmata.h (v2.4.3) does not contain the command 0xF5

from arduino.

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.