Figure 5. Click the “Intensity” port on the light sensor block,
then the “Power” port on the motor block to connect the
two with a “data wire.”
of values, and try to find the formula we’d need to make
them a reality.
Start by considering the first row of values and asking
yourself “What would I need to do to the number 0 to
change it to the number 100?” The first possibility is
obvious: You could add 100 to 0 to make it equal 100.
(0) + 100 = 100
(IN) + 100 = OUT
Let’s try that with the second set of values:
100 + 100 =/= 0
So, that formula is a no-go. We could also try the
opposite operation: subtraction. How could we use the
number 0 in a subtraction operation to equal the number
100? We can’t subtract a positive number from 0 because
that would only make a negative output. We could,
Figure 7. Start by clicking the data wire to select it, then
pressing delete to delete it.
Figure 6. Click the tab under the move action again to collapse
the unused data ports.
however, subtract 0 from the number 100 to equal 100.
100 - (0) = 100
100 - (IN) = OUT
Let’s try that with the second row of values:
100 - (100) = 0
Looks good so far! Let’s just try it with the other three
100 - ( 50) = 50
100 - ( 25) = 75
100 - ( 75) = 25
Success! Our formula works! Now we just need to
implement it in the program. We do this by using the
Figure 8. Find the “Math” block in the “Data” menu on the right
and drag it between the light sensor and motor blocks.
SERVO 12.2010 49