Giter VIP home page Giter VIP logo

arduino-pinchangeint's People

Contributors

greygnome avatar

Watchers

 avatar

arduino-pinchangeint's Issues

SoftwareSerial.h incompatible with PinChangeInt.h in 1.0

Including both SoftwareSerial and PinChangeInt libraries such as the following 
will result in compile errors while commenting out one or the other will not:

#include SoftwareSerial.h
#include PinChangeInt.h
#include Adaencoder.h

void setup()  
{

}

void loop() 
{
}

Original issue reported on code.google.com by [email protected] on 12 Mar 2012 at 12:53

interrupt on analog port

I have downloaded latest build and i tried to use interrupt on analog Port with 
Arduino uno. It seems that the interrupt Will he invoked on Port a0 a1 and a2 
but none on Port a3 a4 and a5. On every Digital Port Works fine. Someone has 
any idea?
flavio



Original issue reported on code.google.com by [email protected] on 2 Apr 2014 at 7:46

Should PCintPort::curr be volatile?


PCintPort::curr is modified in the ISRs.
Should it be volatile?

ISR(PCINT0_vect) {
    PCintPort::curr = portB.portInputReg; // version 1.6
    portB.PCint();
}

Original issue reported on code.google.com by [email protected] on 14 Jun 2012 at 12:50

Issues with Arduino Mega

Hi, ran the 2560 example on my arduino mega, and also another code derived from 
the same example , which counts the falling edges at two pins but it 
is giving wrong results e.g if i press the button 3 time it'll give higer
values i.e 10, 15 etc and not give 3. Code and the screenshot of the output is 
attached. Please help and i have to use it in my final year project.

Regards, Jani.




Original issue reported on code.google.com by [email protected] on 13 Feb 2015 at 9:12

Attachments:

Mega support for PinChangeInt

What steps will reproduce the problem?
1. Attempt to use PinChangeInt with an Arduino Mega.

I have not attempted to do this yet, but am considering my board options for a 
current project.  How much work is involved to modify this library to work with 
the Mega?


Original issue reported on code.google.com by [email protected] on 28 Nov 2011 at 7:20

additional issue with the problem addressed recently

What steps will reproduce the problem?
1. Open the example sketch, PinChangeIntExample 
2. Complile the sketch 
3.

What is the expected output?
The fact the sketch compiled.

What do you see instead? The following error message.
In file included from sketch_dec04a.cpp:5:
C:\Program Files\arduino-1.0\libraries\PinChangeInt/PinChangeInt.h: In 
constructor 'PCintPort::PCintPort(int, volatile uint8_t&)':
C:\Program Files\arduino-1.0\libraries\PinChangeInt/PinChangeInt.h:104: error: 
'((PCintPort*)this)->PCintPort::portInputReg' cannot be used as a function


What version of the product are you using?
Arduino 1.0

On what operating system?
Windows XP (32 bit)

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 5 Dec 2011 at 12:47

The wiki is down


http://code.google.com/p/arduino-pinchangeint/w/list

Click on this link- it displays "500. That’s an error. "

Original issue reported on code.google.com by [email protected] on 13 Mar 2012 at 5:08

Modify code comments AND documentation regarding the location of NO_PORTX_PINCHANGES


This is not a formal bug, but an attempt to provide clearer
comments in the code and documentation.

// #define NO_PORTB_PINCHANGES // to indicate that port b will not be used for 
pin change interrupts
// #define NO_PORTC_PINCHANGES // to indicate that port c will not be used for 
pin change interrupts
// #define NO_PORTD_PINCHANGES // to indicate that port d will not be used for 
pin change interrupts

If you define any of the three defines above,
these must be defined in the users code BEFORE
#include <PinChangeInt.h>.

Defining any of the definitions above after including
PinChangeInt.h, will have no effect on the size of the compiled code.

Original issue reported on code.google.com by [email protected] on 13 Mar 2012 at 9:47

Support for PORTA pin changes (>28-pin ATmegas)

(Note: Winging the template here because the option to select an issue type 
(defect, enhancement, etc.) seems to have gone missing just lately. This should 
be enhancement/feature request :-) )

One of the open issues is for Mega support (80-pin ATmegas e.g. 2560), which 
looks like it might be more work. But, the mid-size (40-pin) ATmegas such as 
'644 (used in Sanguino, Mosquino) can be supported easily by adding the code 
for PORTA pin change interrupts.

I tested the attached file on an ATmega644-based Mosquino board and it appears 
to work correctly. Specific changes I made were: 

* in class PCintPort: change portInputReg(*portInputRegister(index + 2)) to 
index + 1 (actually, created a #define for this value)
* Add PCintPort portA=PCintPort(0,PCMSK0); and renumber remaining entries
* Add case for "1" (PORTA) in attachInterrupt, detachInterrupt
* Add ISR(PCINT0_vect){...} for PORTA case.

(bonus change: use Arduino 1.0's LED_BUILTIN pin definition for the LED pin, if 
available)

NOTE: I didn't add any code (#ifdef...) for making PORTA support switchable - 
I'm not entirely certain I understand your code and don't want to break 
anything! :-)

Original issue reported on code.google.com by [email protected] on 10 May 2012 at 4:18

Attachments:

Issue with using pinchangeint

If there was a discussion forum, I would post this there, as it would be a more 
appropriate setting.

Anyways, pinchangeint has been very finnicky for me.  Sometimes it works, 
sometimes it doesn't.  It's not a compilation issue, but rather a runtime 
issue.  Sometimes it simply crashes my sketch.

This sketch compiles, and as far as I know SHOULD work, but doesn't:

#include <PinChangeInt.h>

int encoderPinA = 8;
int encoderPinB = 7;
bool A_set = false;
bool B_set = false;
volatile long encoderPos = 0;
long lastReportedPos = 1;

// Interrupt on A changing state
void doEncoderA(){
    // Test transition
    A_set = digitalRead(encoderPinA) == HIGH;
    // and adjust counter + if A leads B
    encoderPos += (A_set != B_set) ? +1 : -1;
}

// Interrupt on B changing state
void doEncoderB(){
    // Test transition
    B_set = digitalRead(encoderPinB) == HIGH;
    // and adjust counter + if B follows A
    encoderPos += (A_set == B_set) ? +1 : -1;
}

void setup()
{
    pinMode(encoderPinA, INPUT);
    pinMode(encoderPinB, INPUT);

    Serial.begin(9600);

    PCintPort::attachInterrupt(encoderPinA, &doEncoderA, CHANGE);
    PCintPort::attachInterrupt(encoderPinB, &doEncoderB, CHANGE);

    Serial.println("Start!");
}

void loop()
{
    if (encoderPos != lastReportedPos)
    {
        lastReportedPos = encoderPos;
        Serial.println(encoderPos);
    }
}

Any suggestions would be welcome.  

(The symptom: the Serial.println("Start!") never happens...because I never see 
it printed over the serial line)

Original issue reported on code.google.com by [email protected] on 26 Oct 2012 at 10:07

PCintPort not declared....

What steps will reproduce the problem?
1.Ran example code, and own code....likel something simple I missed, but just 
checking...I don't see any mention of what or how to assign this port 
variable...
2.
3.

What is the expected output?  Interrupt Port declaration

 What do you see instead?  not assigned


What version of the product are you using? latest
On what operating system?Windows 7


Please provide any additional information below.

Trying to incorporate this library, but I don't see where the port is declared. 
 Maybe smarter people than me know by default, but thought I would ask before 
spending hours figuring it out.  Seems to me the example code should run right 
out of the box?



Original issue reported on code.google.com by [email protected] on 3 Apr 2013 at 3:56

Recommended strategy for using of PinChangeInt to read RC receiver pulses

What steps will reproduce the problem?
1. Connect Arduino Uno or Nano to an RC receiver
2. Each receiver channel is connected to a separate digital input pin on the 
Arduino
3. Attempt to read the pulsewidth for each channel in the background of the 
main control code using PinChangeInt

This is not a defect but just a request for guidance on how to best use this 
library.  The posted ReadReceiver Arduino sketch detaches and reattaches 
interrupts in the Arduino Loop function.  To me, this opens up an opportunity 
for missing pulses and does not seem like a good strategy. It also uses the 
timer1 library for measuring the pulsewidths.  This will cause a conflict will 
driving servos, so my preference is to simply use the micros function to 
determine the pulsewidth, leveraging the already utilized Timer0.  I would 
store the millis time on the pulse rise, and subtract this from the millis time 
on the pulse drop.

The strategies I am considering fall into two options:  use the same userFunc 
for all pin changes, or a separate userFunc for each pin change.  In the former 
case, this matches your examples, but I then need to determine in the sketch 
which pin change caused the interrupt by querying the arduinoPin variable.  
Having this extra logic in the ISR seems like an unnecessary performance hit, 
since this logic is already evaluated in the library code.  

My currently preferred approach is the later:  have a separate userFunc for 
each pin.  In reading over the library code, it appears that this is supported. 
 Namely, that there is a linked list between pins and user functions.  In this 
case, I would use the millis function to measure the pulsewidth in each 
userFunc, and I only need to evaluate whether the pin is high or low to 
properly manage the logic to read the pulsewidth.  

It appears that my second approach should work, but I don’t see it in any of 
your examples.  Am I on the right track?

Thanks in advance.

Original issue reported on code.google.com by [email protected] on 4 Jan 2012 at 4:34

Need # define for MAx # of interruptable pins


Would you please add a # define that defines
the max # of interruptable pins?

//IS
uint8_t interrupt_count[20]={0}; // 20 possible arduino pins

//SHOULD BE SOMETHING SIMILAR
uint8_t interrupt_count[MAX_INT_PINS]={0}; // 20 possible arduino pins

This # define should be set based on the chip.
168/328's vs 2560, etc

All codes (especially loops) should reference the # define
to avoid overrwriting the end of the array

Original issue reported on code.google.com by [email protected] on 14 Jun 2012 at 12:45

Issue with pins 14 through 19

What steps will reproduce the problem?
1.Define Interrupts on pins 14 through 19. 
2.
3.

What is the expected output? What do you see instead?
I used a little modified version of your test program
http://arduino.cc/playground/Main/PinChangeIntExample
Value of the port changes but no interrupt is created
(funktion is not called)


What version of the product are you using? On what operating system?
I have the prblem with IDE 023 and 1.0,
PinChangeInt version 1.41 and 1.51

With version 1.0 it is working correctly and the interrupt is created.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 15 Feb 2012 at 10:22

Attachments:

Only working 60%.

Hey, I wanted to use this lib with my LCD Keypad Shield

The Keypresses are separated by voltagedividers.

So I just wanted to attach a interrupt on the analog pin thats used by the 
keypad shield on Falling (or Change). 

But it does not seem to work properly

Here is what i tested:


Simple script wo just prints in the Voltage every second. I pressed none button 
and then another one every second, results:

Spannung: 4.995
Spannung: 0.000
Spannung: 0.643
Spannung: 1.499
Spannung: 2.339
Spannung: 3.524

(Voltage readings) so ~5V while no keypress.

The 2 Buttons that wont work for the interrupt are the last two

2,33 and 3,5V

because if i run this simple sketch which just outputs the voltage reading when 
an interrupt occurs, only prints out 

Spannung: 0.000
Spannung: 0.643
Spannung: 1.499
but not the other 2 ... neither with change or falling


Original issue reported on code.google.com by [email protected] on 6 Aug 2013 at 9:04

Incompatible with oficial SoftwareSerial library?

What steps will reproduce the problem?
#include <PinChangeInt.h>
#include <SoftwareSerial.h>

What is the expected output? 
Binary sketch size: ???? bytes (of a 30 720 byte maximum)

What do you see instead?
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_3':
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial/SoftwareSerial.cpp:305: 
multiple definition of `__vector_3'
sketch_sep20b.cpp.o:C:\Users\NEO\Documents\Arduino\libraries\PinChangeInt/PinCha
ngeInt.h:563: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_4':
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial/SoftwareSerial.cpp:312: 
multiple definition of `__vector_4'
sketch_sep20b.cpp.o:C:\Users\NEO\Documents\Arduino\libraries\PinChangeInt/PinCha
ngeInt.h:573: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_5':
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial/SoftwareSerial.cpp:319: 
multiple definition of `__vector_5'
sketch_sep20b.cpp.o:C:\Users\NEO\Documents\Arduino\libraries\PinChangeInt/PinCha
ngeInt.h:583: first defined here


What version of the product are you using? On what operating system?
Version 2.19 (beta) Tue Nov 20 07:33:37 CST 2012

Please provide any additional information below.
---------------------------------
#include <PinChangeInt.h>
#include <SoftwareSerial.h>
void setup() {  
}
void loop() {  
}
--------------------------------
result in Error Compiling.

Thank you in advance for quick handling.

Original issue reported on code.google.com by [email protected] on 20 Sep 2014 at 11:14

Interupt functions not getting called

I have a 3 position keyswitch.

Position 1. Turn to the left. Arduino input pin 8 LOW when turned here
Position 2. Center common pin. Not a detectable position.
Position 3. Turn to the right. Adruino input pin 9 LOW when turned here

 pinMode(keySwitchState1,INPUT);      
 pinMode(keySwitchState2,INPUT);
 digitalWrite(keySwitchState1,HIGH);
 digitalWrite(keySwitchState2,HIGH);
 PCintPort::attachInterrupt(keySwitchState1,&keySwitch1Event,FALLING);
 PCintPort::attachInterrupt(keySwitchState2,&keySwitch2Event,FALLING);


I have 2 functions that are supposed to be called when keyswitch is turned and 
it is not happening:

void keySwitch1Event(){
      relaySet(POSITION_OPEN);
      digitalWrite(greenButtonLed,LOW);
      while (keySwitchState1 == LOW){
        digitalWrite(redButtonLed,HIGH);
        delay(200);
        digitalWrite(redButtonLed,LOW);
        delay(200);  
      }
      relaySet(POSITION_CLOSE);
      digitalWrite(redButtonLed,LOW);
      digitalWrite(greenButtonLed,HIGH);

  }

 void keySwitch2Event(){
      relaySet(POSITION_CLOSE);
      digitalWrite(redButtonLed,LOW);

      while (keySwitchState2 == LOW){
        digitalWrite(greenButtonLed,HIGH);
        delay(200);
        digitalWrite(greenButtonLed,LOW);
        delay(200);
      }
      relaySet(POSITION_CLOSE);
      digitalWrite(redButtonLed,LOW);
      digitalWrite(greenButtonLed,HIGH);

 }

Anyone have any ideas?????????????? Thanks, Justin Filiault

Original issue reported on code.google.com by [email protected] on 10 Aug 2013 at 8:02

Attachments:

Issues testing interrupts on PORT D

What steps will reproduce the problem?
1. Define Interrupts on pins 4 through 12... Port B & D
2. Create individual "pin3func() for every pin
3. Get some "bad" interrupts; can not get PORT B to interrupt.

What is the expected output? What do you see instead?

USING A NANO....Using the JAN 15 version 1.4

interrupt on pin 9 is CONTINUOUS; must DISABLE looking at pin 9.  Tested on a 
new HW and the same condition exists.  I believe the HW is GOOD.  


Get valid interrupts on pin 5,6,7

Interrupt on pin 4 INCORRECTLY triggers dual interrupts; 4 & 12


IS IT POSSIBLE THAT I HAVE NOT PROPERLY LOADED/POSITIONED THE CORRECT FILES???

Disabled ALL ports using the NO PORTB/C/C PINCHANGES defines and I still get 
the PB interrupts!!  They should have been masked OFF??? 

Help is appreciated.. I am now reading the additional information you have 
provided in the detailed sections.  I am off to babysit and read and will 
return later this evening.  

Thank you for providing the code.  I did NOT want to learn the details of yet 
another chip and its interrupt scheme and greatly appreciate the work you 
helped me avoid by sharing the code.

[email protected]


Original issue reported on code.google.com by [email protected] on 28 Jan 2012 at 1:53

[Question]

I really don't know if this is the right place to ask, but its the best i could 
see so please forgive me.

I'm just curious if something like this is possible with pinchangeinterrupts 
too:

  noInterrupts();
  // critical, time-sensitive code here
  interrupts();
  // other code here

if so, where can i read about how to do it?

Original issue reported on code.google.com by [email protected] on 5 Aug 2013 at 8:23

Seems not to distinguish between RISING/FALLING

I am trying to connect my Raspberry Pi via SPI to the Arduino UNO with the RPi 
as Master.

I have linked pin10 (SS) to pin2 (so there are no other pin changes on that 
port) and attached an interrupt to pin2.
I am trying to use the FALLING edge of the SS to detect that a new set of data 
is coming. The program works, but in testing I find that it
also detects a FALLING edge at the end of the data where I would expect a 
RISING edge.

I have tried to detect a FALLING and a RISING edge on pin2 but the program only 
sees the RISING edge and so does not work.

from the attached output which is just a proof of concept.

I expected to see
- a printout of the data sent which I do,

- a line containing the number of FALLING edges seen (followed by the number of 
RISING edges seen not currently used and so is =0) which I do

- a line starting with a "1" followed by zeros showing the position of the 
FALLING edge
here I see another 1 immediately after the data. has been sent

I am using spidev  within Python to send the data and I can see no reason for 
it to be sending another empty set of data which would possibly account for the 
problem. 

I am using Version 2.19 beta

The Arduino sketch and the Pyhton program are attached

Original issue reported on code.google.com by [email protected] on 3 Apr 2013 at 6:44

Attachments:

detachInterrupt goes into an infinite loop

What steps will reproduce the problem?
1. Attach two or more interrupts
2. Try to detach the first interrupt you attached (or any other than the last 
one)

What is the expected output? What do you see instead?
detachInterrupt newer returns.

What version of the product are you using? On what operating system?
v1, Ubuntu 10.04, arduino-0.22

Please provide any additional information below.
The loop in the delPin function that fills the holes in the pcIntPins array 
does not increment the pointer t. Adding "t++" fixes the bug.
----------------------------------------------------------
                        do { // shuffle down as we pass through the list, filling the hole
                                *t = t[1];
                                t++; // this fixes the bug
                        } while (*t);

-----------------------------------------------------------


Original issue reported on code.google.com by [email protected] on 20 Oct 2011 at 8:25

interrupt on analog port

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 2 Apr 2014 at 7:41

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.