Im writting a program that uses the function attachinterrupt . The pins are different form that of the arduino pins . Im attaching the snippet where Im using the interrupt. Please help me out by saying which pin I hav to connect in order to use INT0?
define LCD_REFRESH_INTERVAL_MS 100/* Pin assignments */#define INTERRUPT_INPUT 2#define NUM_CODES (32)#define NUM_WORDS (32)#define NUM_ABB (33)// variables to store it in array and conversionint i=0;char pattern[6];char english[50];char *final_string[50];char fin[40];int index=0;int abb_flag=0;
void interrupt_handler(){ pulse_counter = pulse_counter + 1;}void setup(){ // for interrupt of the microphone Serial.begin(9600); emicSerial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); // For noise suppression, enable pullup on interrupt pin digitalWrite(INTERRUPT_INPUT, HIGH); attachInterrupt(INTERRUPT_INPUT - 2, // 2-2=0, 0th pin interrupt_handler, RISING); // interrupt microphone ends }
....
.
..
...
Here the pin I hvae used is PIN 0 (i.e) analog0 . Please correct me if I'm wrong
Hi satabios,
If you are going to use INT0 for external Interrupt then you have to use digital pin D1.
See the below GR Peach Pin Map.
INT0- D1
INT1- D0
INT2- A0
INT3- A1
INT4- A2
INT5- A3
Sample Program for using INT0 (D1) for External Interrupt in GR Peach:-
#include <Arduino.h>
int
ledpin = PIN_LED_BLUE;
intpin = 1;
volatile
state = LOW;
void
blink()
{
state = !state;
}
setup()
pinMode(ledpin, OUTPUT);
pinMode(intpin, INPUT_PULLUP);
attachInterrupt(0, blink, CHANGE);
loop()
digitalWrite(ledpin, state);
Hope you find this information useful!!