SlideShare a Scribd company logo
How can i get the code below to have one light remain on continuosly until the button is pressed
and then the first led will shut off, and the second will turn on and with the button being pressed
again it will do the opposite?
const int BUTTON_PIN = 2; // Pin number for the push button
const int LED_PIN_1 = 3; // Pin number for the first LED
const int LED_PIN_2 = 4; // Pin number for the second LED
void setup() {
// Set the button pin as input and enable the internal pull-up resistor
DDRD &= ~(1 << BUTTON_PIN);
PORTD |= (1 << BUTTON_PIN);
// Set the LED pins as outputs
DDRD |= (1 << LED_PIN_1) | (1 << LED_PIN_2);
// Turn on the first LED and turn off the second LED
PORTD |= (1 << LED_PIN_1);
PORTD &= ~(1 << LED_PIN_2);
}
void loop() {
// Check if the button is pressed
if (!(PIND & (1 << BUTTON_PIN))) {
// Toggle the state of the LEDs
PORTD ^= (1 << LED_PIN_1) | (1 << LED_PIN_2);
// Wait for a short period to debounce the button
delay(1000);
}
}

More Related Content

More from ThomasXUMParsonsx

How to fixed these provide listsort-asm assembly code as same as the l.pdf
How to fixed these provide listsort-asm assembly code as same as the l.pdfHow to fixed these provide listsort-asm assembly code as same as the l.pdf
How to fixed these provide listsort-asm assembly code as same as the l.pdf
ThomasXUMParsonsx
 
How to measure effectiveness using 1- The goal approach2- The human-ba.pdf
How to measure effectiveness using 1- The goal approach2- The human-ba.pdfHow to measure effectiveness using 1- The goal approach2- The human-ba.pdf
How to measure effectiveness using 1- The goal approach2- The human-ba.pdf
ThomasXUMParsonsx
 
How should a company evaluate a society's level of interdependence exp.pdf
How should a company evaluate a society's level of interdependence exp.pdfHow should a company evaluate a society's level of interdependence exp.pdf
How should a company evaluate a society's level of interdependence exp.pdf
ThomasXUMParsonsx
 
How much would the force of gravity at the surface of the Earth differ.pdf
How much would the force of gravity at the surface of the Earth differ.pdfHow much would the force of gravity at the surface of the Earth differ.pdf
How much would the force of gravity at the surface of the Earth differ.pdf
ThomasXUMParsonsx
 
How is the human population changing globally- What general difference.pdf
How is the human population changing globally- What general difference.pdfHow is the human population changing globally- What general difference.pdf
How is the human population changing globally- What general difference.pdf
ThomasXUMParsonsx
 
How many different groups of two students can be formed out of 4 stud.pdf
How many different groups of two students can be formed out  of 4 stud.pdfHow many different groups of two students can be formed out  of 4 stud.pdf
How many different groups of two students can be formed out of 4 stud.pdf
ThomasXUMParsonsx
 
How might environment might influence the total phenotypic variance in.pdf
How might environment might influence the total phenotypic variance in.pdfHow might environment might influence the total phenotypic variance in.pdf
How might environment might influence the total phenotypic variance in.pdf
ThomasXUMParsonsx
 
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdfHow long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
ThomasXUMParsonsx
 
How many samples should we collect for the following scenario- We want.pdf
How many samples should we collect for the following scenario- We want.pdfHow many samples should we collect for the following scenario- We want.pdf
How many samples should we collect for the following scenario- We want.pdf
ThomasXUMParsonsx
 
How is of_type modeled- Not modeled into any relationship Relation and.pdf
How is of_type modeled- Not modeled into any relationship Relation and.pdfHow is of_type modeled- Not modeled into any relationship Relation and.pdf
How is of_type modeled- Not modeled into any relationship Relation and.pdf
ThomasXUMParsonsx
 
How is Plane_service modeled- Relation and foreign key with single att.pdf
How is Plane_service modeled- Relation and foreign key with single att.pdfHow is Plane_service modeled- Relation and foreign key with single att.pdf
How is Plane_service modeled- Relation and foreign key with single att.pdf
ThomasXUMParsonsx
 
How has the Internet created a new marketing model- What are the main.pdf
How has the Internet created a new marketing model- What are the main.pdfHow has the Internet created a new marketing model- What are the main.pdf
How has the Internet created a new marketing model- What are the main.pdf
ThomasXUMParsonsx
 
How have human diseases changed from pre-1950 to the present- and how.pdf
How have human diseases changed from pre-1950 to the present- and how.pdfHow have human diseases changed from pre-1950 to the present- and how.pdf
How have human diseases changed from pre-1950 to the present- and how.pdf
ThomasXUMParsonsx
 
How frequently are incidents of violence and-or corruption in policing.pdf
How frequently are incidents of violence and-or corruption in policing.pdfHow frequently are incidents of violence and-or corruption in policing.pdf
How frequently are incidents of violence and-or corruption in policing.pdf
ThomasXUMParsonsx
 
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdfHow does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
ThomasXUMParsonsx
 
How does Fogel justify using only one year of data in his social savin.pdf
How does Fogel justify using only one year of data in his social savin.pdfHow does Fogel justify using only one year of data in his social savin.pdf
How does Fogel justify using only one year of data in his social savin.pdf
ThomasXUMParsonsx
 
How Effective Managers Use Information Systems Advances in computer-ba.pdf
How Effective Managers Use Information Systems Advances in computer-ba.pdfHow Effective Managers Use Information Systems Advances in computer-ba.pdf
How Effective Managers Use Information Systems Advances in computer-ba.pdf
ThomasXUMParsonsx
 
How do you update an address according to this code- Currently- I fig.pdf
How do you update an address according to this code-  Currently- I fig.pdfHow do you update an address according to this code-  Currently- I fig.pdf
How do you update an address according to this code- Currently- I fig.pdf
ThomasXUMParsonsx
 
How does bias affect human resource function How does bias affect huma.pdf
How does bias affect human resource function How does bias affect huma.pdfHow does bias affect human resource function How does bias affect huma.pdf
How does bias affect human resource function How does bias affect huma.pdf
ThomasXUMParsonsx
 
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdfHow do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
ThomasXUMParsonsx
 

More from ThomasXUMParsonsx (20)

How to fixed these provide listsort-asm assembly code as same as the l.pdf
How to fixed these provide listsort-asm assembly code as same as the l.pdfHow to fixed these provide listsort-asm assembly code as same as the l.pdf
How to fixed these provide listsort-asm assembly code as same as the l.pdf
 
How to measure effectiveness using 1- The goal approach2- The human-ba.pdf
How to measure effectiveness using 1- The goal approach2- The human-ba.pdfHow to measure effectiveness using 1- The goal approach2- The human-ba.pdf
How to measure effectiveness using 1- The goal approach2- The human-ba.pdf
 
How should a company evaluate a society's level of interdependence exp.pdf
How should a company evaluate a society's level of interdependence exp.pdfHow should a company evaluate a society's level of interdependence exp.pdf
How should a company evaluate a society's level of interdependence exp.pdf
 
How much would the force of gravity at the surface of the Earth differ.pdf
How much would the force of gravity at the surface of the Earth differ.pdfHow much would the force of gravity at the surface of the Earth differ.pdf
How much would the force of gravity at the surface of the Earth differ.pdf
 
How is the human population changing globally- What general difference.pdf
How is the human population changing globally- What general difference.pdfHow is the human population changing globally- What general difference.pdf
How is the human population changing globally- What general difference.pdf
 
How many different groups of two students can be formed out of 4 stud.pdf
How many different groups of two students can be formed out  of 4 stud.pdfHow many different groups of two students can be formed out  of 4 stud.pdf
How many different groups of two students can be formed out of 4 stud.pdf
 
How might environment might influence the total phenotypic variance in.pdf
How might environment might influence the total phenotypic variance in.pdfHow might environment might influence the total phenotypic variance in.pdf
How might environment might influence the total phenotypic variance in.pdf
 
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdfHow long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
How long will it take $100 to grow to $400 if invested at 4-5- compoun.pdf
 
How many samples should we collect for the following scenario- We want.pdf
How many samples should we collect for the following scenario- We want.pdfHow many samples should we collect for the following scenario- We want.pdf
How many samples should we collect for the following scenario- We want.pdf
 
How is of_type modeled- Not modeled into any relationship Relation and.pdf
How is of_type modeled- Not modeled into any relationship Relation and.pdfHow is of_type modeled- Not modeled into any relationship Relation and.pdf
How is of_type modeled- Not modeled into any relationship Relation and.pdf
 
How is Plane_service modeled- Relation and foreign key with single att.pdf
How is Plane_service modeled- Relation and foreign key with single att.pdfHow is Plane_service modeled- Relation and foreign key with single att.pdf
How is Plane_service modeled- Relation and foreign key with single att.pdf
 
How has the Internet created a new marketing model- What are the main.pdf
How has the Internet created a new marketing model- What are the main.pdfHow has the Internet created a new marketing model- What are the main.pdf
How has the Internet created a new marketing model- What are the main.pdf
 
How have human diseases changed from pre-1950 to the present- and how.pdf
How have human diseases changed from pre-1950 to the present- and how.pdfHow have human diseases changed from pre-1950 to the present- and how.pdf
How have human diseases changed from pre-1950 to the present- and how.pdf
 
How frequently are incidents of violence and-or corruption in policing.pdf
How frequently are incidents of violence and-or corruption in policing.pdfHow frequently are incidents of violence and-or corruption in policing.pdf
How frequently are incidents of violence and-or corruption in policing.pdf
 
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdfHow does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
How does myosin II differ from myosin V- Myosin II assembles into bipo.pdf
 
How does Fogel justify using only one year of data in his social savin.pdf
How does Fogel justify using only one year of data in his social savin.pdfHow does Fogel justify using only one year of data in his social savin.pdf
How does Fogel justify using only one year of data in his social savin.pdf
 
How Effective Managers Use Information Systems Advances in computer-ba.pdf
How Effective Managers Use Information Systems Advances in computer-ba.pdfHow Effective Managers Use Information Systems Advances in computer-ba.pdf
How Effective Managers Use Information Systems Advances in computer-ba.pdf
 
How do you update an address according to this code- Currently- I fig.pdf
How do you update an address according to this code-  Currently- I fig.pdfHow do you update an address according to this code-  Currently- I fig.pdf
How do you update an address according to this code- Currently- I fig.pdf
 
How does bias affect human resource function How does bias affect huma.pdf
How does bias affect human resource function How does bias affect huma.pdfHow does bias affect human resource function How does bias affect huma.pdf
How does bias affect human resource function How does bias affect huma.pdf
 
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdfHow do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
How do you model Plane-Type- One Atomic Attribute Relation Set of simp.pdf
 

Recently uploaded

Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 

Recently uploaded (20)

Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 

How can i get the code below to have one light remain on continuosly u.pdf

  • 1. How can i get the code below to have one light remain on continuosly until the button is pressed and then the first led will shut off, and the second will turn on and with the button being pressed again it will do the opposite? const int BUTTON_PIN = 2; // Pin number for the push button const int LED_PIN_1 = 3; // Pin number for the first LED const int LED_PIN_2 = 4; // Pin number for the second LED void setup() { // Set the button pin as input and enable the internal pull-up resistor DDRD &= ~(1 << BUTTON_PIN); PORTD |= (1 << BUTTON_PIN); // Set the LED pins as outputs DDRD |= (1 << LED_PIN_1) | (1 << LED_PIN_2); // Turn on the first LED and turn off the second LED PORTD |= (1 << LED_PIN_1); PORTD &= ~(1 << LED_PIN_2); } void loop() { // Check if the button is pressed if (!(PIND & (1 << BUTTON_PIN))) { // Toggle the state of the LEDs PORTD ^= (1 << LED_PIN_1) | (1 << LED_PIN_2); // Wait for a short period to debounce the button delay(1000); }
  • 2. }