Professional Documents
Culture Documents
Lab 2 in Our Arduino Uno Board Rev 3 We Use ATMEGA328P ATMEGA328 Pinout and The Corresponding Arduino Header Pins
Lab 2 in Our Arduino Uno Board Rev 3 We Use ATMEGA328P ATMEGA328 Pinout and The Corresponding Arduino Header Pins
// Port D initialization
// Port B initialization
SW is connected to
PD2 with internal
configure PB5 as pull up resistor
output to connect activated on that
the LED pin
and put 0 to turn it
off
void setup() {
DDRB = 0b00100000;
// to turn off the LED ( 1 turns is ON and 0 turn it OFF) ===> PORTB5 = 0
//The switch will be connected to PORTD bit 2 (PD2), we will use the internal pull up resistor
DDRD = 0b00000000;
void loop() {
PORTB ^= (1<<PORTB5);
delay(1000);