do you mean I need to set the pin HIGH?
set pin as input
then set its mode to HIGH?
(or use an external resistor?)
correct?
(for whatever reason Im having trouble with my Arduino IDE..it just HANGS on compiling sketches when I verify them) ![]()
int pin = 13;
int pin2 = 2
volatile int state = LOW;
void setup(){
// initialize the serial communications:
Serial.begin(9600);
//set pim13 mode
pinMode(pin, OUTPUT);
// set pin2 mode & set internal pull up resistor
pinMode(pin2, INPUT);
digitalWrite(pin2, HIGH);
//attach interrupt 'listener' to pin2 on Arduino
attachInterrupt(0, ISR1, HIGH);
}
void loop(){
if(state == HIGH){
Serial.println("--EVENT TRIGGERED--");
digitalWrite(pin, state);
delay(500);
state = LOW;
}
}
void ISR1(){
//tone(8, 350, 250);
state = HIGH;
}
like this perhaps?
every time I try to verify IDE crashes/locks up..lol