Complete the code to set the PWM duty cycle to 50%.
PWM_SetDutyCycle([1]);The PWM duty cycle value ranges from 0 to 255. 128 sets it to about 50%.
Complete the code to increase the duty cycle by 10%.
dutyCycle = dutyCycle + [1];10% of 255 is about 25.5, rounded to 26 to increase duty cycle by 10%.
Fix the error in the code to prevent duty cycle overflow.
if (dutyCycle [1] 255) { dutyCycle = 255; }
The condition should check if dutyCycle is greater than 255 to cap it at max.
Fill both blanks to create a dictionary that maps LED names to their duty cycles if duty cycle is above 100.
ledDutyCycles = { [1]: [2] for [1] in leds if [2] > 100 }The dictionary comprehension uses 'led' as key and 'leds[led]' as value, filtering values above 100.
Fill all three blanks to create a dictionary of LEDs with duty cycles above 150, converting LED names to uppercase.
highDuty = { [1]: [2] for [3] in leds if [2] > 150 }The dictionary keys are LED names in uppercase, values are duty cycles, iterating over 'led'.