Question: Please perform atleast two of the problems below (parts E, F and G) Problem 2. A 8-light lighting machine is controlled by an array of

Please perform atleast two of the problems below (parts E, F and G)Please perform atleast two of the problems below (parts E, F andG) Problem 2. A 8-light lighting machine is controlled by an array

Problem 2. A 8-light lighting machine is controlled by an array of 8-bit registers. The first element of the array controls light #1, the second element of the array controls light #2, and so on. We call these registers Light Status Register or LSR. For each LSR, the bits control the light based on the below specification Bit 7-6: control the light intensity: 00 off, 01 low, 10 medium, 11 high. Bit 5-4: control the color: blue 00, green 01, red 10, yellow 11 Bit 3 controls whether the light flickers: 0 no flicker, 1 flicker Bit 2-0 are unused. . Examples If we write 0x0 to an LSR, it means that the corresponding light should be off. with the highest intensity and it should flicker intensity red with flicker. If we write OxFF to an LSR, it means that the corresponding light should be yellow If we write 0x68 to an LSR, it means that the corresponding light should be low E. Write a function that receives the value contained in an LSR and returns the intensity of that lamp. The function declaration and example is shown below. 10 points // Example:extractIntensity(oxff) returns HIGH INTENSITy extract Intensity(unsigned int LSR) F. Write a function that receives three integers representing lamp flickering status, color, and intensity and returns the LSR value that will create that light combination. Use Os for unused bits in the LSR. The function declaration and example is shown below. 12 points // Example: makeLSR (MED_INTENSITY, BLUE, NO_FLICKER) returns 0x80 unsigned int makeLSR (INTENSITY newIntensity, COLOR newColor, FLICKERING newFlickering)i G. Write a snippet of code, part of the main function, that increases the intensity of al the lights by one step. If a light is off, it will be turned on with the lowest intensity The lights with the highest intensity will remain unchanged. Do not modify settings for color or flickering. Assume LSR ARRAY [0 ] is the LSR location of the first lamp and LSR ARRAY [7 ] is the LSR location of the last lamp, 16 points Hint: In a loop, you need to read LSRs one by one, change them and write them back to the same location

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!