Comments (5)
By the way, this code works on an Arduino Uno. It doesn't work on an Arduino
Mega.
Original comment by [email protected]
on 30 Oct 2012 at 10:19
from arduino-pinchangeint.
There is a link from the front page to the "Groups", which is the forum. I wish
the forum were more prominent, *sigh*.
Regarding your issue, there are a couple of problems with your code. You have
correctly set encoderPos to be volatile, but not A_set and B_set. Those are
used in both of your interrupts. The general rule is, if a variable is shared
with any interrupt, you must make it volatile. Sharing a variable between two
interrupts means they should be volatile.
Also, you do not perform the digitalWrite(PIN, HIGH) to turn on the resistors
on your input pins. I can imagine that the high input impedance is creating all
sorts of noise on the pins and preventing the code from reaching your "Start!"
print statement.
You do not need to use the digitalRead() commands in your interrupt handlers.
See http://code.google.com/p/arduino-pinchangeint/wiki/Usage . The
PCintPort::pinState variable will tell you if it's HIGH or LOW. That will save
a few micros, anyway. Besides, the pinState may have changed (because of switch
bounce) by the time you read it in the Interrupt handler. Switch bounce is a
very annoying thing.
Finally, if you are working on rotary encoders, you may want to refer to
http://code.google.com/p/adaencoder/ . There I have a rotary encoder class.
Maybe I have already done what you are trying to do.
Original comment by [email protected]
on 1 Nov 2012 at 4:50
- Changed state: Started
from arduino-pinchangeint.
Original comment by [email protected]
on 1 Nov 2012 at 4:50
from arduino-pinchangeint.
P.S. The Mega uses entirely different pins, and mostly different ports, than
its smaller cousins. Refer to the other posting in this issue section, and the
Wiki, for more information. Good luck.
Also, sorry it has taken me a number of days to get back to you. I've been
hacking on an MP3 chip outside of work and haven't checked my email lately.
Original comment by [email protected]
on 1 Nov 2012 at 4:52
from arduino-pinchangeint.
No updates in a month; I am going to close this issue. Note there are a number
of changes to the PinChangeInt code lately; try to take a look at that.
Original comment by [email protected]
on 29 Nov 2012 at 2:45
- Changed state: WontFix
from arduino-pinchangeint.
Related Issues (20)
- Support for PORTA pin changes (>28-pin ATmegas) HOT 6
- Need # define for MAx # of interruptable pins HOT 4
- Should PCintPort::curr be volatile? HOT 3
- PCintPort not declared.... HOT 3
- Seems not to distinguish between RISING/FALLING HOT 6
- [Question] HOT 1
- Only working 60%. HOT 2
- Interupt functions not getting called HOT 4
- Compatible with Arduino Pro-Mini? HOT 3
- interrupt on analog port
- interrupt on analog port HOT 1
- Incompatible with oficial SoftwareSerial library? HOT 1
- Issues with Arduino Mega HOT 1
- Recommended strategy for using of PinChangeInt to read RC receiver pulses HOT 26
- Issues testing interrupts on PORT D HOT 15
- Issue with pins 14 through 19 HOT 5
- SoftwareSerial.h incompatible with PinChangeInt.h in 1.0 HOT 5
- The wiki is down HOT 1
- Modify code comments AND documentation regarding the location of NO_PORTX_PINCHANGES HOT 1
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-pinchangeint.