Button not working on turning on LED

hi, I build a program to turn on/off a LED, but my code for turning the LED on is not working, can anyone tell me why? The button for turning off can turn on and off the red LED, i'm really confused why i have this error

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

int main(void){
  DDRD &= ~(1 << DDD3) ; 
  DDRD &= ~(1 << DDD2) ; 
  DDRB |= (1 << DDB0) | (1<<DDB1);     
  EICRA |= (1 << ISC11) | (1 << ISC01);
  EIMSK  |= (1 << INT1) | (1<<INT0);
  PORTB &= ~(1<<PORTB1);
  sei();
  while(1){
    PORTB |= (1<<PORTB1);
    _delay_ms(1000);
    PORTB &= ~(1<<PORTB1);
    _delay_ms(1000);
    }
}

ISR(INT0_vect){
  sei();                    
  PORTB |= (1<<PORTB0);
}

ISR(INT1_vect){
  PORTB &= ~(1<<PORTB0);
}
This is my setup

Looks like your 5v is connected to -

i think its not the issue

Hello
PSEUDOCODE:

digitalWrite(Led,digitalRead(Button));

i figured it out. My setup is wrong. Thanks anw

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.