Good morning.
I've been working on a program using Flora. I'm using the following as pin initiation and interrupt on the Flora:
pinMode(3, INPUT_PULLUP); // set interrupt pin (CALLED SCL on flora which is D3)
attachInterrupt(0, buttonISR, FALLING);
I'll be switching out the Flora to a Adafruit Trinket - Mini Microcontroller - 3.3V Logic - MicroUSB -- what pin works for the Trinket? Do I need to change the code also?
Thanks in advance!
Interrupts on Trinket 3.3
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Interrupts on Trinket 3.3
The pin assignments are in this document https://learn.adafruit.com/introducing-trinket/pinouts
- rbbtebo
- Posts: 57
- Joined: Tue Aug 18, 2015 9:12 am
Re: Interrupts on Trinket 3.3
Thanks, Franklin.
I have read that document. But I'm not familiar enough which chips and programming to understand. Can ANY pin be used as an interrupt? And don't pin numbers associate with particular interrupt numbers? For example, the Flora D3 pin is associated with interrupt 0.
Thanks in advance,
Balad
I have read that document. But I'm not familiar enough which chips and programming to understand. Can ANY pin be used as an interrupt? And don't pin numbers associate with particular interrupt numbers? For example, the Flora D3 pin is associated with interrupt 0.
Thanks in advance,
Balad
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interrupts on Trinket 3.3
On a Trinket, only pin #2 can handle the FALLING type of interrupt.
All the pins can generate pin-change interrupts, but only PB2 has the extra circuits needed to detect rising or falling edges.
All the pins can generate pin-change interrupts, but only PB2 has the extra circuits needed to detect rising or falling edges.
- rbbtebo
- Posts: 57
- Joined: Tue Aug 18, 2015 9:12 am
Re: Interrupts on Trinket 3.3
Thank you, Mike. I'll give that a try.
- rbbtebo
- Posts: 57
- Joined: Tue Aug 18, 2015 9:12 am
Re: Interrupts on Trinket 3.3
Good morning.
I'm back to working with a Flora. How do you make any pin an interrupt? I don't need rising/falling - just recognize when a switch is closed to ground. Don't pin numbers need to be associated with particular interrupt numbers? I'm already using 3v, SCL, SDA, and GND connected to a color sensor and I want a switch connected between D10 and ground to cause an interrupt. What would the attachInterrupt statement look like? "attachInterrupt(D10, buttonISR, CHANGE);"??? Thank you as always.
I'm back to working with a Flora. How do you make any pin an interrupt? I don't need rising/falling - just recognize when a switch is closed to ground. Don't pin numbers need to be associated with particular interrupt numbers? I'm already using 3v, SCL, SDA, and GND connected to a color sensor and I want a switch connected between D10 and ground to cause an interrupt. What would the attachInterrupt statement look like? "attachInterrupt(D10, buttonISR, CHANGE);"??? Thank you as always.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interrupts on Trinket 3.3
If you want to see when a pin goes low, that's a FALLING interrupt type. On the Flora, the SDA, SCL, RX, and TX pins can recognize falling edges.
This diagram shows all the names and functions: https://learn.adafruit.com/system/asset ... 1396787706
If you want to use the attachInterrupt() method, use the Arduino pin numbers (D0 through D3).
This diagram shows all the names and functions: https://learn.adafruit.com/system/asset ... 1396787706
If you want to use the attachInterrupt() method, use the Arduino pin numbers (D0 through D3).
- rbbtebo
- Posts: 57
- Joined: Tue Aug 18, 2015 9:12 am
Re: Interrupts on Trinket 3.3
Dear Mike,
I'm still somewhat confused (my usual state of mind...) On March 15, when talking about a Trinket, you said "All the pins can generate pin-change interrupts, but only PB2 has the extra circuits needed to detect rising or falling edges." How do you do this? Thanks!
And I'm sorry for the double posting... it won't happen again!
I'm still somewhat confused (my usual state of mind...) On March 15, when talking about a Trinket, you said "All the pins can generate pin-change interrupts, but only PB2 has the extra circuits needed to detect rising or falling edges." How do you do this? Thanks!
And I'm sorry for the double posting... it won't happen again!
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interrupts on Trinket 3.3
Flora or Trinket?
They have different microcontrollers, so the interrupts and pin mappings are different.
They have different microcontrollers, so the interrupts and pin mappings are different.
- rbbtebo
- Posts: 57
- Joined: Tue Aug 18, 2015 9:12 am
Re: Interrupts on Trinket 3.3
Good morning, Mike. I'm working with a Flora now....
Balad
Balad
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interrupts on Trinket 3.3
In that case, the information from two posts back is appropriate:
Information about interrupts on the Trinket has nothing to do with interrupts on the Flora. Different microcontrollers, different interrupts, different pins.adafruit_support_mike wrote:If you want to see when a pin goes low, that's a FALLING interrupt type. On the Flora, the SDA, SCL, RX, and TX pins can recognize falling edges.
This diagram shows all the names and functions: https://learn.adafruit.com/system/asset ... 1396787706
If you want to use the attachInterrupt() method, use the Arduino pin numbers (D0 through D3).
- RushabhT
- Posts: 7
- Joined: Tue Jan 03, 2017 1:03 pm
Re: Interrupts on Trinket 3.3
Hi all,
I'm a beginner in embedded tinkering, and have got my Flora, along with a vibrator motor and the built in Neopixel, pulsing at a certain frequency.
I wanted to connect a Rotary encoder to also allow changing the pulse frequency (of both the motor and the LED), but realised that my code can only act on the External Interrupt pins. I wanted to use pins #6 and #12 connected to the Rotary Encoder, but realised I need to probably change my code to use some sort of pinChangeInterrupt (compared to the example attachInterrupt) function.
Is this possible on the Flora? I tried installing some other Arduino libraries (pinChangeInterrupt) but I don't think I can get a valid reading on either of those two inputs.
Would greatly appreciate all your help.
I'm a beginner in embedded tinkering, and have got my Flora, along with a vibrator motor and the built in Neopixel, pulsing at a certain frequency.
I wanted to connect a Rotary encoder to also allow changing the pulse frequency (of both the motor and the LED), but realised that my code can only act on the External Interrupt pins. I wanted to use pins #6 and #12 connected to the Rotary Encoder, but realised I need to probably change my code to use some sort of pinChangeInterrupt (compared to the example attachInterrupt) function.
Is this possible on the Flora? I tried installing some other Arduino libraries (pinChangeInterrupt) but I don't think I can get a valid reading on either of those two inputs.
Would greatly appreciate all your help.
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: Interrupts on Trinket 3.3
@RushabhT - This is both off-topic and a quadruple post. Please do not post the same question to multiple threads!
Please be positive and constructive with your questions and comments.