Comments (5)
Interrupts are currently used behind the scenes. In fact if you use StandardFirmata an Arduino Uno or similar board all of the interrupts are currently in use. PWM uses interrupts, Servo uses interrupts, millis() uses an interrupt, etc. This has been one of the larger problems when trying to scale Firmata. We're working on a new firmata example called ConfigurableFirmata (see the configurable branch and the new utility directory as well as the ConfigurableFirmata example). With ConfigurableFirmata you select features for a particular application rather than the general purpose StandardFirmata approach. This could free up a timer as long as conflicting features are not chosen. For example if you don't need a Servo, then you don't include the Servo class and that frees up a timer or if you don't need PWM you could free up multiple timers. Then we could add a RotaryEncoder feature class, but you'd need to sacrifice an existing feature in order to add a new feature that relies on interrupts so you couldn't use both a rotary encoder and a servo or a rotary encoder and pwm for example.
For more capable boards such as the Due this may not be an issue as there may be additional timers available.
from arduino.
Thanks a lot ! I will give a try to ConfigurableFirmata then.
Best regards
from arduino.
are you specifically interested in a rotary encoder feature or just interrupts in general. If you would like a rotary encoder feature class for configurable firmata that can be added as a feature issue and I'd be happy to accept a pull request, just be aware of this:
"Inside the attached function, delay() won't work and the value returned by millis() will not increment. Serial data received while in the function may be lost. You should declare as volatile any variables that you modify within the attached function."
So an interrupt handler needs to be extremely quick. I'm assuming the issue here is that millis shares the same timer that is allocated for attachInterrupt. The work around is to use another timer, but that would have to be done with avr-gcc syntax, instead of attachInterrupt (which abstracts away a ton of complexity) and would be processor dependent to some extent.
from arduino.
In fact I'd like to use incremental rotary (or linear) optical encoders with my arduino MEGA, more informations here .
Because I'm not very comfortable with C / C + +, I thought Firmata could be a solution.
Anyway I'll try to follow your advice.
As soon as my encoder works I will send the pull request ;)
from arduino.
As discussed, I'm trying to implement a new feature to manage encoders (EncoderFeature) but I'm facing a problem I can't deal with :
During sketch compilation, Arduino IDE returns the following error : IS_PIN_INTERRUPT and PIN_TO_INTERRUPT not defined in EncoderFeature.cpp (however these constants are defined in the Boards.h file and everything seems ok)
I tried to include files using double quotes instead of brackets but nothing works
have you ever had this problem?
Note : If you want to reproduce the error, you can use nicolaspanel/Firmata(interrup branch)/test/unit/encoder_test/encoder_test.ino (or any other sketch)
UPDATE (15/07/2013) :
I was finally able to find a (temporary) solution (even if it is not ideal), by redefining macros IS_PIN_INTERRUPT and PIN_TO_INTERRUPT in EncoderFirmata.cpp file .
This implementation uses arduino external interrupts and my first tests are encouraging.
I'll send the pull request once I could test that there are no regressions on the other features.
Best regards
from arduino.
Related Issues (20)
- Analog pin as digital. HOT 3
- Analog Pins on Constant Voltage HOT 1
- Additional Firmata Java library
- Inconsistent state for additional analog pins (A6 - A11) on Arduino Leonardo HOT 1
- Pyfirmata and arduino leonardo mouse and keyboard abilities HOT 2
- T HOT 1
- Error compiling for board Arduino Uno. HOT 1
- Error compiling Firmata for board Arduino Nano Every HOT 8
- Error when compiling StandardFirmata 2.5.8 for Ardbox Analog HF + Wifi from Industrialshields HOT 2
- broken link in readme.md
- Last released version is from 2018 despite a lot of new work being merged HOT 10
- How to change TX RX pin for Nano HOT 3
- To drive a Servo what Capabilities do i need from a board? HOT 2
- Ethernet server mode versus client mode HOT 1
- Arduino HOT 1
- Arduino Nano Every doesn't report A6 and A7 on StandardFirmata HOT 3
- add Arduino UNO R4 MINIMA to boards.h please HOT 11
- [Question] How to add support for Jolly-dev to StandardFirmataWiFi HOT 9
- Firmata for Raspberry Pi Pico HOT 1
- Problem compiling firmata for Giga R1 Wifi board HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino.