SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By zfields
#233556
Here is my sketch...
Code: Select all
#define BUTTON 10

void buttonISR () {
    isr_fired = true;
}

void setup () {
    ::pinMode(LED_BUILTIN, OUTPUT);
    ::pinMode(BUTTON, INPUT_PULLUP);
    ::attachInterrupt(digitalPinToInterrupt(BUTTON), buttonISR, RISING);
}

void loop () {
    if (isr_fired) {
        isr_fired = false;
        ::digitalWrite(LED_BUILTIN, HIGH);
        ::delay(250);
    }
    ::digitalWrite(LED_BUILTIN, LOW);
}
The LED flashes when I check the button with my multimeter (leg closest to the battery JST connector), however it doesn't work when I simply press the user button (10).
FTR, I can even touch the button leg with the leg of a resistor while the other leg is in my hand to get the same effect... :o

The schematic shows the button is a short to GND when pressed, so I assume D10 should have a builtin pull-up to Vcc.
Code: Select all
D10 ___ \____ GND
      USER
FWIW, I can reproduce this behavior while the board is powered from USB, a battery via the JST, or both at the same time.

Is this a board defect, or am I doing something wrong?
User avatar
By zfields
#233576
Just in case, I have confirmed neither `14` nor `D14` work.

I have also confirmed both `10` and `D10` do work (as I originally stated).

Unless I have poorly configured the board or missed a step along the way, then the problem has to do with hardware. I'm curious if it's MY hardware (manufacturing defect), or if it has to do with THE hardware (board layout).

For some reason the button itself does not fire the interrupt, but if I use a resistor (only in my hand, connected to nothing) to touch the leg of the button (closest to the battery JST connector) the interrupt on `10` or `D10` will fire.

This is one of the few boards of which I only have one, so I don't have a way to test it on a separate piece of hardware.
By paulvha
#233594
Thanks.
So it seems there is an error in the schematics where pin D10 is connected to pad 10 and not to pad 14 on the processor. (I already found it wierd).

Maybe the switch is just not pulling to GND.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum