2021-10-21 19:55:33 +02:00
|
|
|
#include <avr/io.h>
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led_init (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
DDRB = 0xFF; // Set all bits in the B Data-Direction Register to output
|
|
|
|
PORTB = 0x00; // Set all bits in the PORT B Register to low to turn all LEDs off
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led1_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<7); // Set the bit for LED_1 to hight to turn it on
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led1_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<7); // Set the bit for LED_1 to low to turn it off
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led2_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<6);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led2_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<6);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led3_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<5);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led3_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<5);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led4_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<4);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
|
|
|
|
Led4_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<4);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led5_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<3);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led5_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<3);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led6_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<2);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led6_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<2);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led7_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<1);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led7_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<1);
|
|
|
|
}
|
|
|
|
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led8_On (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB |= (1<<0);
|
|
|
|
}
|
2021-10-28 19:24:52 +02:00
|
|
|
void
|
|
|
|
Led8_Off (void){
|
2021-10-21 19:55:33 +02:00
|
|
|
PORTB &= ~(1<<0);
|
|
|
|
}
|