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

Use Matlab programming and the Arduino board with one RGB LED and three resistor

ID: 2082772 • Letter: U

Question

Use Matlab programming and the Arduino board with one RGB LED and three resistors (330 Ohm for instance) to generate different colors. Your program MUST prompt the user to enter 3 numbers in the range 0-255 and then display the corresponding color in the LED. Your program MUST also allow the user to START OVER as often he/she wishes. WITHOUT THE NEED to rerun the program. The Table below lists the decimal value for few selected colors. In this Table the decimal 255 corresponds to the maximum voltage applied to the LED (for example 5V corresponds to the decimal 255 and 0 V corresponds to decimal 0)

Explanation / Answer

clc;
disp('::Matlab program to select the color of RGB LED::')
disp('::Enter the value of the R/G/B between 0 to 255 to select the color of LED::')
R = input('Enter the value of R:'); %Initial value for R output
G = input('Enter the value of G:'); %Initial value for G output
B = input('Enter the value of B:'); %Initial value for B output
disp(R)
disp(G)
disp(B)
if R==0 && G==0 && B==0
disp('Invalid Entry')
end
if R==255 && G==255 && B==255
disp('White')
end
if R==255 && G==0 && B==0
disp('Red')
end
if R==0 && G==255 && B==0
disp('Green')
end
if R==0 && G==0 && B==255
disp('Blue')
end
if R==0 && G==255 && B==255
disp('Cyan')
end
if R==255 && G==0 && B==255
disp('Magenta')
end
if R==128 && G==0 && B==0
disp('Maroon')
end
if R==128 && G==128 && B==0
disp('Olive')
end
if R==128 && G==0 && B==128
disp('Purple')
end
if R==0 && G==0 && B==128
disp('Navy')
end
if R >0 && R~=128 && R<255
disp('R = Invalid Entry')
end
if B >0 && B~=128 && B<255
disp('B = Invalid Entry')
end
if G >0 && G~=128 && G<255
disp('G = Invalid Entry')
end

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