Comments (10)
Thanks for reporting the issue, and actually validating your circuit with an oscilloscope. I'm on vacation right now, but I'll have a look at it next week 🌞
from megacore.
While you're at it, could you please test your code without using the digitalPinToInterrupt macro, but rather insert the real interrupt number? You can find the corresponding interrupt number in the pinout pic in the Readme file. I'm also interested in knowing if the rest of the interrupts work as expected
from megacore.
Gave removing digitalPinToInterrupt a try and it was no different. It's connected to pin 4 which corresponds to interrupt 4 and given the macro should end up the exact same value if I'm reading it correctly. I also tried swapping around some of the other settings than LOW like RISING and FALLING and none of those changed the behavior. I can try cutting the trace and soldering it to a different pin to try out some of the other interrupts but I don't have an easy way to test all of them as this is on a custom PCB and not a demo board.
from megacore.
You don't have to cut traces if you don't have to, I have a dev board I can test on. One thing, could your try to add sei(); at the very end of the setup function? This enables global interrupts, so nothing will happend if this is not ran (which it should be by default).
I haven't seen your entire code, but I assure you're stripped away everything to isolate this issue as much as possible?
from megacore.
I tried adding sei() at the end of setup and saw no change. Here is the isolated code that I've tested against. I've also removed the debounce logic as well with no effect. Here is the schematic of the button that should be triggering the interrupt. Trigger is just directly connected to digital I/O pin 4 (PE4).
#define TRIGGER_PIN 4
#define RED_TEAM_PIN 6
volatile boolean shouldFire = false;
const int debounceDelay = 1000;
volatile long lastDebounceTime = 0;
void setup() {
pinMode(RED_TEAM_PIN, OUTPUT);
pinMode(TRIGGER_PIN, INPUT);
digitalWrite(RED_TEAM_PIN, HIGH);
attachInterrupt(digitalPinToInterrupt(TRIGGER_PIN), triggerPress, LOW);
}
void loop() {
if (shouldFire == true) {
shoot();
shouldFire = false;
}
}
void triggerPress() {
long now = millis();
if ((now - lastDebounceTime) > debounceDelay) {
shouldFire = true;
lastDebounceTime = now;
}
}
void shoot() {
digitalWrite(RED_TEAM_PIN, LOW);
delay(1000);
digitalWrite(RED_TEAM_PIN, HIGH);
}
from megacore.
I found the issue. Turned out that these lines didn't match the current pinout.
from megacore.
Thanks! In fixing one issue on the board I was testing this on I broke something else. Still able to program the mcu but it doesn't look like it's actually executing anything. Gonna try swapping for a new one and I can give this a shot.
from megacore.
Stupid late-night coding! All interrupts are working except for INT4. Try using the avr-100-pin fork, which has this issue resolved. I'll merge this branch into the master as soon as it's a little more well tested
from megacore.
Gave this a try and it's working now. Thanks!
from megacore.
Great! Thanks for reporting 😃
from megacore.
Related Issues (20)
- ATmega 128 I2C doesn't work HOT 2
- Incorrect clock timing HOT 1
- How to wake up from sleep using WDT reset? (atmega64) HOT 3
- arduino framework does'nt work on ATmega128 HOT 2
- Trouble uploading sketch to Arduino Mega2560 after burning bootloader HOT 1
- unable to burn bootloader for mega2560 HOT 40
- stk500v2 bootloader potential issues HOT 4
- To adopt urboot for MegaCore HOT 2
- Is it possible to program with FT232 programming? Is there a schematic drawing available? HOT 5
- Customizable LED_BUILTIN HOT 4
- Arduino Mega OTEthernet not working HOT 6
- generation of the file .hex HOT 11
- cannot be compiled when using the Wire library HOT 5
- Cannot upload sketch to mega without bootloader using arduinoISP HOT 5
- Original Mega 2560 bootloader HOT 4
- Doesn't work on arduino mega 2560 (clone) HOT 2
- ArduinoOTA problems on Mega2560 using Megacore >= 3 HOT 2
- Erase bootloader
- Support for multiple UARTs at same time?
- ATmega64a serial upload problem HOT 13
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 megacore.