Question

In: Computer Science

FOR an mbed LPC 1768 have 4 LEDs flash 5 times in turn (i.e., LED1 flashes...

FOR an mbed LPC 1768

have 4 LEDs flash 5 times in turn (i.e., LED1 flashes 5 times, followed by LED2, then followed by LED3, and finally followed by LED4, and it repeats). Design the hardware connection of your LEDs to mbed. Build your circuit and include all the required information about your hardware design in your lab report.

Create a new program to fulfill the function of the blinking LEDs as described in last step.

I need the C++ code plz!

Solutions

Expert Solution

Please go through code and comment. I can not display hardware.

CODE:

#include "lpc17xx.h"

#define LED1 25 // led1
#define LED2 26 // led2
#define LED3 27 // led3
#define LED4 28 // led4

int main (void)
{      
   uint32_t i,j,k;  
   uint32 array[4] = {LED1, LED2, LED3, LED4};
   SystemInit();

   LPC_GPIO1->FIODIR |= 1 << LED1;           // P1.25 = Outputs
   LPC_GPIO1->FIOCLR = 1 << LED1;           // LED OFF
  
   LPC_GPIO1->FIODIR |= 1 << LED2;           // P1.26 = Outputs
   LPC_GPIO1->FIOCLR = 1 << LED2;           // LED OFF
  
   LPC_GPIO1->FIODIR |= 1 << LED3;           // P1.27 = Outputs
   LPC_GPIO1->FIOCLR = 1 << LED3;           // LED OFF
  
   LPC_GPIO1->FIODIR |= 1 << LED4;           // P1.28 = Outputs
   LPC_GPIO1->FIOCLR = 1 << LED4;           // LED OFF

   while(1)
   {
       for(i=0; i<4; i++) // led change one by one
       {
           for(j =0; j<5; j++) // led blink 5 times
           {
               LPC_GPIO1->FIOSET = 1 << array[i];       // LED ON
               for(k = 10000000; k > 0; k--); // Delay for arond 1 seconds
               LPC_GPIO1->FIOCLR = 1 << array[i];   // LED OFF
               for(j = 10000000; j > 0; j--); // Delay for arond 1 seconds
           }
       }
   }
}


Related Solutions

FOR ARDUINO PROGRAMMING NEED TO HAVE ALL LEDS FLASH 5 TIMES WHEN THE BOARD STARTS.
FOR ARDUINO PROGRAMMING NEED TO HAVE ALL LEDS FLASH 5 TIMES WHEN THE BOARD STARTS.
Question 4 Flash Inc. was founded 5 years ago. It has been profitable for the last...
Question 4 Flash Inc. was founded 5 years ago. It has been profitable for the last 2 years, but it has needed all of its earnings to support growth and thus has never paid a dividend. Management has indicated that it plans to pay a $1 dividend starting from today, then it will increase the dividend growth by 50% for the next two years, and then the company will achieve a long run growth rate of 7.5%. Assuming a required...
You play roulette and observe the ball land in the 1st dozen (i.e., 1-12) 5 times...
You play roulette and observe the ball land in the 1st dozen (i.e., 1-12) 5 times out of 5 spins. You want to perform a test to determine if the wheel is fair. a. State the null and alternative hypothesis. b. What is the p-value of this test? c. For an∝=.05 significance level, what do you conclude?
You play roulette and observe the ball land in the 1st dozen (i.e., 1-12) 5 times...
You play roulette and observe the ball land in the 1st dozen (i.e., 1-12) 5 times out of 5 spins. You want to perform a test to determine if the wheel is fair. a. State the null and alternative hypothesis. b. What is the p-value of this test? c. For an∝=.05 significance level, what do you conclude?
Question 5: (Marks: 5) A group of students compared the number of times they have been...
Question 5: (Marks: 5) A group of students compared the number of times they have been to the movies in the past year. The following table illustrates how many times each person went to the movie theatre in each month. You need to show your work. Jan. Feb. Mar. Apr. May June July Aug. Sep. Oct. Nov. Dec. Eric 1 2 3 5 2 1 3 1 2 1 3 1 Kyle 1 2 1 3 1 2 3 2...
5. Four different paints are advertised to have the same drying times. To verify the manufacturer’s...
5. Four different paints are advertised to have the same drying times. To verify the manufacturer’s claim, seven samples were tested for each of the paints. The time in minutes until the paint was dry enough for a second coat to be applied was recorded. Below are the results which may be imported into MSExcel for analysis: (Assume the populations are normally distributed, the populations are independent and the population variances are equal) Paint 1 Paint 2 Paint 3 Paint...
You roll a die 48 times with the following results. Number 1 2 3 4 5...
You roll a die 48 times with the following results. Number 1 2 3 4 5 6 Frequency 3 1 15 13 4 12 Use a significance level of 0.05 to test the claim that the die is fair. (PLEASE SHOW ALL YOUR WORK)
I have asked this question 4 times and no one has done it right yet!!!!! PLEASE...
I have asked this question 4 times and no one has done it right yet!!!!! PLEASE HELP ME I need a Risk Management Plan for a made up supply chain company. This should be several pages including: 1   INTRODUCTION.. 1 1.1         Purpose Of The Risk Management Plan. 1 2   risk management Procedure.. 1 2.1         Process. 1 2.2         Risk Identification. 1 2.3         Risk Analysis. 1 2.3.1    Qualitative Risk Analysis. 1 2.3.2    Quantitative Risk Analysis. 1 2.4         Risk Response Planning. 1 2.5        ...
4. (5 pts) You have purchased a piece of depreciable equipment and have decided to use...
4. (5 pts) You have purchased a piece of depreciable equipment and have decided to use the double declining-balance depreciation method for depreciation charges. Use the following table to conduct and determine: a. Annual depreciation and annual book value through the useful life of the equipment. b. Determine the value of the capital gain or loss. Cost Basis: $100,000 Market Value: $10,000 Useful Life: 5 years MARR: 5%
1. Premium 2. Times interest earned ratio 3. Sinking fund 4. Market interest rate 5. Discount...
1. Premium 2. Times interest earned ratio 3. Sinking fund 4. Market interest rate 5. Discount 6. Stated interest rate 7. Capital lease 8. Amortization schedule 9. Operating lease 10. Debt to equity ratio The rate quoted in the bond contract used to calculate the cash payments for interest. The lessor owns the asset and the lessee simply uses the asset temporarily. Total liabilities divided by total stockholders' equity; measure a company's risk. The true interest rate used by investors...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT