The goal of this assigment was to connect three LEDs to the arduino and manipulate the intensity of each of those via keyboard input that is read through the Serial port of the arduino
Question 2:
Modified the code to read a series of characters as input (say - rrrr) and then change the intensity of the color. for example, pressing r 5 times would set the intensity of red to 50%. I used 127 as 50% of the intensity (from the base code)
Question 3: (Optional)
For this i modified the code to take the color code (r,g or b) followed by a series of either + or - . I save the previous intensity value of each of the colors and modify them based on the input. Each + or - increases or decreases the intensity by 10% respectively. For example, r++ would increase the intensity by 20% from the prev value. and b ---- would decrease the intensity of blue by 40% from its previous value.
Please look at the attachments for the codes.
- Login to post comments