Answered step by step
Verified Expert Solution
Question
1 Approved Answer
will this run? const int segmentPins [ ] = { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9
will this run? const int segmentPins; Pins for segments A to G DP
const int digitPins; Pins for digit control
const int countdownDuration ; Set the countdown duration in seconds
void setup
Set all segment and digit pins as OUTPUT
for int i ; i ; i
pinModesegmentPinsi OUTPUT;
for int i ; i ; i
pinModedigitPinsi OUTPUT;
void loop
Countdown loop
for int count countdownDuration; count ; count
displayNumbercount;
delay; second delay
void displayNumberint num
Display a number on the segment display
const byte numMap
B
B
B
B
B
B
B
B
B
B
;
for int i ; i ; i
Enable the corresponding digit
digitalWritedigitPinsi LOW;
Set the segments based on the number to be displayed
for int j ; j ; j
digitalWritesegmentPinsj bitReadnumMapnum j;
delay; A short delay to make the display stable
Turn off the segments for the next iteration
for int j ; j ; j
digitalWritesegmentPinsj HIGH;
Disable the digit for the next iteration
digitalWritedigitPinsi HIGH;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started