Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which code will will blink led1 (connected to pin 0 port C) at 40Hz? Assume you

ID: 3838608 • Letter: W

Question

Which code will will blink led1 (connected to pin 0 port C) at 40Hz? Assume you have a delay function called delay_xms(x) that will delay x ms. Ex delay_xms(5); delays for 5ms. A. for(;;){gpo_c(0, 1);//led off delay_xms (40); gpo_c(0, 0);//led on delay_xms(40); B. for(;;){gpo_c(0, 1);//led off delay_xms(25); gpo_c(0, 0);//lead on delay_xms(10);) C. for(;;){gpo_c(0, 1);//led off delay_xms(25); gpo_c(0, 0);//led on delay_xms(25);} D. for(;;){gpo_c (0, 1);//led off delay_xms(12); gpo_c(0, 0);//let on delay_xms(13);}

Explanation / Answer

When saying blink, we mean that the led will on for some interval of time and then it will be off for the same interval of time and it will continue to do so in a loop.

Here, option A will make the led blink at 40Hz because the delay time is 40ms and by formula,

frequency = 1 / time

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote