Question: The code for above is below const int bit_A = 2; const int bit_B = 3; const int bit_C = 4; const int bit_D =

 The code for above is below const int bit_A = 2;

The code for above is below

const int bit_A = 2;

const int bit_B = 3;

const int bit_C = 4;

const int bit_D = 5;

void setup()

{ // Initializing the Pins as OUTPUT

pinMode(bit_A, OUTPUT);

pinMode(bit_B, OUTPUT);

pinMode(bit_C, OUTPUT);

pinMode(bit_D, OUTPUT);

// ALL pins LOW at the start of program

digitalWrite(bit_A, LOW);

digitalWrite(bit_B, LOW);

digitalWrite(bit_C, LOW);

digitalWrite(bit_D, LOW);

}

void loop()

{

char i=0; // variable "counter"

for(i=0; i

{

counter(i); // Calling the counter function with the digit to display

delay(1000); // after 1 second

}

}

void counter(char digit)

{

// Making low previous digit

digitalWrite(bit_A, LOW);

digitalWrite(bit_B, LOW);

digitalWrite(bit_C, LOW);

digitalWrite(bit_D, LOW);

if(digit >= 8)

{

digitalWrite(bit_D, HIGH);

digit = digit - 8;

}

if(digit >= 4)

{

digitalWrite(bit_C, HIGH);

digit = digit - 4;

}

if(digit >= 2)

{

digitalWrite(bit_B, HIGH);

digit = digit - 2;

}

if(digit >= 1)

{

digitalWrite(bit_A, HIGH);

digit = digit - 1;

}

}

const int bit_B = 3; const int bit_C = 4; const int

Show transcribed data

In the previous lab, we developed a binary to seven-segment display decoder using TinkerCad. A binary counter, created on a virtual Arduino, was used to as the input to a CD4511BE decoder chip that translates the counter to the seven digital signals needed to display the binary count in the form of digits from 0 to 9. The objective of this lab is to read an analog input pin, map the result to a number between 09 and display that number on the seven-segment display. The pre-lab focuses on the code required to do this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!