Giter Club home page Giter Club logo

Comments (10)

MCUdude avatar MCUdude commented on August 12, 2024

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.

MCUdude avatar MCUdude commented on August 12, 2024

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.

jrozner avatar jrozner commented on August 12, 2024

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.

MCUdude avatar MCUdude commented on August 12, 2024

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.

jrozner avatar jrozner commented on August 12, 2024

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).
screen shot 2017-04-04 at 12 36 30 pm

#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.

MCUdude avatar MCUdude commented on August 12, 2024

I found the issue. Turned out that these lines didn't match the current pinout.

from megacore.

jrozner avatar jrozner commented on August 12, 2024

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.

MCUdude avatar MCUdude commented on August 12, 2024

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.

jrozner avatar jrozner commented on August 12, 2024

Gave this a try and it's working now. Thanks!

from megacore.

MCUdude avatar MCUdude commented on August 12, 2024

Great! Thanks for reporting 😃

from megacore.

Related Issues (20)

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.