Question

The toggling speed of LEDs gradually changes from fast to slow and after reaching the slowest poi...

the toggling speed of LEDs gradually changes from fast to slow and after reaching the slowest point, it starts gradually increasing until it reaches the fastest speed and so on. Please use only a single “for Loop” to reduce the computational cost. Paste your Code here (only the for loop part)

I need the code written for MSP430 chip in Code Composer Studio please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

for(int i=0,j=100;i<100 && j>0;)
{
   if(i<99) //put your code for fast to slow in if loop
   {
       P1OUT=0x00;
       _delay_cycles(i*100); //delay in milliseconds
       P1OUT=0x01;
       _delay_cycles(i*100);  
       i++;      
   }
   elseif(j>1) //put your code for slow to fast in elseif loop
   {
       P1OUT=0x01;
       _delay_cycles(j*100);
       P1OUT=0x00;
       _delay_cycles(j*100);
       j--;
   }
   else
   {
       i=0;
       j=100;
   }
}

Add a comment
Know the answer?
Add Answer to:
The toggling speed of LEDs gradually changes from fast to slow and after reaching the slowest poi...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow...

    1. According to the paper, what does lactate dehydrogenase (LDH) do and what does it allow to happen within the myofiber? (5 points) 2. According to the paper, what is the major disadvantage of relying on glycolysis during high-intensity exercise? (5 points) 3. Using Figure 1 in the paper, briefly describe the different sources of ATP production at 50% versus 90% AND explain whether you believe this depiction of ATP production applies to a Type IIX myofiber in a human....

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT