Successfully Added To Cart

EXERCISE SOLUTIONS:

Question 1

Find this variable:

int power

By default, its value is 150.

You can set the mood lamp to its maximum brightness by changing this to 255, or to its minimum brightness by changing this to 2.

Question 2

Solution 1: Change the value of 'pulseSpeed' in 'User Defined Variables'. A lower number will change the colours faster.

Solution 2: Change the value of 'CommonMathVariable' in User Definied Variables. Try a number like 200 in place of 180/PI.

Solution 3: Change the increment value in the 'for loop' under 'void loop'. Remove one zero to change it from 0.00005 to 0.0005.

Question 3

Under 'User Defined Variables', type in this code:

int ambientLimit = 600;

/* This value can range from 0-1024. At 0, the lamp is always on. At 1024, the room must be pitch black for the lamp to turn on.*/

Find this line in the code:

if (ambientLight > 600) {

and replace it with this:

if (ambientLight > ambientLimit) {