SlideShare a Scribd company logo
1 of 2
for Arduino write a program to simulate the odd number count sequence:1,3,5,7 in binary on
LEDs
Solution
Answer
#here taken odd numbers
int ledPinValues[] = {1,3,5,7};
#setup the proces
void setup()
{
for (int i =0;i<4;i++)
{
pinMode(ledPinValues[i], OUTPUT);
}
}
void loop()
{
for (byte counter =0;counter<=15; counter++)
{
displayBinaryValues(counter);
delay(500);
}
}
void displayBinaryValues(byte numToShow)
{
for (int i =0;i<4;i++)
{
if (bitRead(numToShow, i)==1)
{
digitalWrite(ledPinValues[i], HIGH);
}
else
{
digitalWrite(ledPinValues[i], LOW);
}
}
}

More Related Content

More from todd161

Find the Thevenin impedance at terminals a-b of the circuit on the rig.docx
Find the Thevenin impedance at terminals a-b of the circuit on the rig.docxFind the Thevenin impedance at terminals a-b of the circuit on the rig.docx
Find the Thevenin impedance at terminals a-b of the circuit on the rig.docxtodd161
 
Find the range and interquartile range and median of the following dat.docx
Find the range and interquartile range and median of the following dat.docxFind the range and interquartile range and median of the following dat.docx
Find the range and interquartile range and median of the following dat.docxtodd161
 
Shen yOu are told to plot log olD versus concentration- what variable.docx
Shen yOu are told to plot log olD versus concentration- what variable.docxShen yOu are told to plot log olD versus concentration- what variable.docx
Shen yOu are told to plot log olD versus concentration- what variable.docxtodd161
 
Should OSs be proprietary so that the manufacturers will be able to ma.docx
Should OSs be proprietary so that the manufacturers will be able to ma.docxShould OSs be proprietary so that the manufacturers will be able to ma.docx
Should OSs be proprietary so that the manufacturers will be able to ma.docxtodd161
 
Social Media in Healthcare What are the strengths of using social medi.docx
Social Media in Healthcare What are the strengths of using social medi.docxSocial Media in Healthcare What are the strengths of using social medi.docx
Social Media in Healthcare What are the strengths of using social medi.docxtodd161
 
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docx
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docxSirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docx
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docxtodd161
 
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0.docx
Simplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0.docxSimplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0.docx
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0.docxtodd161
 
Several years ago a ring of foreign-based hackers broke into Town Bank.docx
Several years ago a ring of foreign-based hackers broke into Town Bank.docxSeveral years ago a ring of foreign-based hackers broke into Town Bank.docx
Several years ago a ring of foreign-based hackers broke into Town Bank.docxtodd161
 
Set up the chemical equation and balance for each (please write out )-.docx
Set up the chemical equation and balance for each (please write out )-.docxSet up the chemical equation and balance for each (please write out )-.docx
Set up the chemical equation and balance for each (please write out )-.docxtodd161
 
Soil Classification systems provide a common language to express conci.docx
Soil Classification systems provide a common language to express conci.docxSoil Classification systems provide a common language to express conci.docx
Soil Classification systems provide a common language to express conci.docxtodd161
 
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docx
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docxSolution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docx
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docxtodd161
 
So I attempted drawing the new signal below- It is reflected- shifted.docx
So I attempted drawing the new signal below- It is reflected- shifted.docxSo I attempted drawing the new signal below- It is reflected- shifted.docx
So I attempted drawing the new signal below- It is reflected- shifted.docxtodd161
 
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0 (1).docx
Simplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0 (1).docxSimplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0 (1).docx
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0 (1).docxtodd161
 
Silver is immediately above gold on the periodic table and the two met.docx
Silver is immediately above gold on the periodic table and the two met.docxSilver is immediately above gold on the periodic table and the two met.docx
Silver is immediately above gold on the periodic table and the two met.docxtodd161
 
Shown below is an oxidation half-reaction in acidic solution- Which of.docx
Shown below is an oxidation half-reaction in acidic solution- Which of.docxShown below is an oxidation half-reaction in acidic solution- Which of.docx
Shown below is an oxidation half-reaction in acidic solution- Which of.docxtodd161
 
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docx
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docxShow that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docx
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docxtodd161
 

More from todd161 (16)

Find the Thevenin impedance at terminals a-b of the circuit on the rig.docx
Find the Thevenin impedance at terminals a-b of the circuit on the rig.docxFind the Thevenin impedance at terminals a-b of the circuit on the rig.docx
Find the Thevenin impedance at terminals a-b of the circuit on the rig.docx
 
Find the range and interquartile range and median of the following dat.docx
Find the range and interquartile range and median of the following dat.docxFind the range and interquartile range and median of the following dat.docx
Find the range and interquartile range and median of the following dat.docx
 
Shen yOu are told to plot log olD versus concentration- what variable.docx
Shen yOu are told to plot log olD versus concentration- what variable.docxShen yOu are told to plot log olD versus concentration- what variable.docx
Shen yOu are told to plot log olD versus concentration- what variable.docx
 
Should OSs be proprietary so that the manufacturers will be able to ma.docx
Should OSs be proprietary so that the manufacturers will be able to ma.docxShould OSs be proprietary so that the manufacturers will be able to ma.docx
Should OSs be proprietary so that the manufacturers will be able to ma.docx
 
Social Media in Healthcare What are the strengths of using social medi.docx
Social Media in Healthcare What are the strengths of using social medi.docxSocial Media in Healthcare What are the strengths of using social medi.docx
Social Media in Healthcare What are the strengths of using social medi.docx
 
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docx
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docxSirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docx
Sirius is a binary star- consisting of Sirius A and Sirius B- Sirius B.docx
 
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0.docx
Simplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0.docxSimplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0.docx
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0.docx
 
Several years ago a ring of foreign-based hackers broke into Town Bank.docx
Several years ago a ring of foreign-based hackers broke into Town Bank.docxSeveral years ago a ring of foreign-based hackers broke into Town Bank.docx
Several years ago a ring of foreign-based hackers broke into Town Bank.docx
 
Set up the chemical equation and balance for each (please write out )-.docx
Set up the chemical equation and balance for each (please write out )-.docxSet up the chemical equation and balance for each (please write out )-.docx
Set up the chemical equation and balance for each (please write out )-.docx
 
Soil Classification systems provide a common language to express conci.docx
Soil Classification systems provide a common language to express conci.docxSoil Classification systems provide a common language to express conci.docx
Soil Classification systems provide a common language to express conci.docx
 
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docx
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docxSolution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docx
Solution Approximate Acid- Base- or Approximate pH (2- 5- 7- 9- orNeut.docx
 
So I attempted drawing the new signal below- It is reflected- shifted.docx
So I attempted drawing the new signal below- It is reflected- shifted.docxSo I attempted drawing the new signal below- It is reflected- shifted.docx
So I attempted drawing the new signal below- It is reflected- shifted.docx
 
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0 (1).docx
Simplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0 (1).docxSimplify- log 4 1Solution log  4  1 - log 1 - log 4  - 0 (1).docx
Simplify- log 4 1Solution log 4 1 - log 1 - log 4 - 0 (1).docx
 
Silver is immediately above gold on the periodic table and the two met.docx
Silver is immediately above gold on the periodic table and the two met.docxSilver is immediately above gold on the periodic table and the two met.docx
Silver is immediately above gold on the periodic table and the two met.docx
 
Shown below is an oxidation half-reaction in acidic solution- Which of.docx
Shown below is an oxidation half-reaction in acidic solution- Which of.docxShown below is an oxidation half-reaction in acidic solution- Which of.docx
Shown below is an oxidation half-reaction in acidic solution- Which of.docx
 
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docx
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docxShow that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docx
Show that the subset S - {0-2-4-6-8} of Z10 is a subring- Does S have.docx
 

Recently uploaded

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 

Recently uploaded (20)

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

for Arduino write a program to simulate the odd number count sequence-.docx

  • 1. for Arduino write a program to simulate the odd number count sequence:1,3,5,7 in binary on LEDs Solution Answer #here taken odd numbers int ledPinValues[] = {1,3,5,7}; #setup the proces void setup() { for (int i =0;i<4;i++) { pinMode(ledPinValues[i], OUTPUT); } } void loop() { for (byte counter =0;counter<=15; counter++) { displayBinaryValues(counter);
  • 2. delay(500); } } void displayBinaryValues(byte numToShow) { for (int i =0;i<4;i++) { if (bitRead(numToShow, i)==1) { digitalWrite(ledPinValues[i], HIGH); } else { digitalWrite(ledPinValues[i], LOW); } } }